address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x093f8480185bb15b9b06c02c261b2e8001b969eb
|
/**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
// SPDX-License-Identifier: MIT
/*
- - - - - - - PYRAMID - - - - - - -
Ownership renounced at launch.
LP locked on Team.Finance
*/
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PYRAMID is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"PYRAMID"; ////
string public constant symbol = unicode"PYRAMID"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 6;
uint public _sellFee = 6;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 30000000000 * 10**9; // 3%
_maxHeldTokens = 30000000000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf91461056d578063db92dbb614610582578063dcb0e0ad14610597578063dd62ed3e146105b7578063e8078d94146105fd57600080fd5b806395d89b4114610227578063a9059cbb14610522578063b2131f7d14610542578063c3c8cd801461055857600080fd5b8063715018a6116100dc578063715018a6146104af5780637a49cddb146104c45780638da5cb5b146104e457806394b8d8f21461050257600080fd5b80635090161714610444578063590f897e146104645780636fc3eaec1461047a57806370a082311461048f57600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039d57806340b9a54b146103d657806345596e2e146103ec57806349bd5a5e1461040c57600080fd5b806327f3a72a1461032b578063313ce5671461034057806331c2d8471461036757806332d873d81461038757600080fd5b80630b78f9c0116101c15780630b78f9c0146102b957806318160ddd146102d95780631940d020146102f557806323b872dd1461030b57600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f614610267578063095ea7b31461028957600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025a604051806040016040528060078152602001661416549053525160ca1b81525081565b60405161021e9190611b8f565b34801561027357600080fd5b50610287610282366004611c09565b610612565b005b34801561029557600080fd5b506102a96102a4366004611c26565b610687565b604051901515815260200161021e565b3480156102c557600080fd5b506102876102d4366004611c52565b61069d565b3480156102e557600080fd5b50683635c9adc5dea00000610214565b34801561030157600080fd5b50610214600f5481565b34801561031757600080fd5b506102a9610326366004611c74565b610720565b34801561033757600080fd5b50610214610808565b34801561034c57600080fd5b50610355600981565b60405160ff909116815260200161021e565b34801561037357600080fd5b50610287610382366004611ccb565b610818565b34801561039357600080fd5b5061021460105481565b3480156103a957600080fd5b506102a96103b8366004611c09565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e257600080fd5b50610214600b5481565b3480156103f857600080fd5b50610287610407366004611d90565b6108a4565b34801561041857600080fd5b50600a5461042c906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045057600080fd5b5061028761045f366004611c09565b610968565b34801561047057600080fd5b50610214600c5481565b34801561048657600080fd5b506102876109d6565b34801561049b57600080fd5b506102146104aa366004611c09565b610a03565b3480156104bb57600080fd5b50610287610a1e565b3480156104d057600080fd5b506102876104df366004611ccb565b610a92565b3480156104f057600080fd5b506000546001600160a01b031661042c565b34801561050e57600080fd5b506011546102a99062010000900460ff1681565b34801561052e57600080fd5b506102a961053d366004611c26565b610ba1565b34801561054e57600080fd5b50610214600d5481565b34801561056457600080fd5b50610287610bae565b34801561057957600080fd5b50610287610be4565b34801561058e57600080fd5b50610214610c80565b3480156105a357600080fd5b506102876105b2366004611db7565b610c98565b3480156105c357600080fd5b506102146105d2366004611dd4565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561060957600080fd5b50610287610d15565b6008546001600160a01b0316336001600160a01b03161461063257600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b600061069433848461105c565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106bd57600080fd5b600a8211156106cb57600080fd5b600a8111156106d957600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561074e57506001600160a01b03831660009081526004602052604090205460ff16155b80156107675750600a546001600160a01b038581169116145b156107b6576001600160a01b03831632146107b65760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107c1848484611180565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107f0908490611e23565b90506107fd85338361105c565b506001949350505050565b600061081330610a03565b905090565b6008546001600160a01b0316336001600160a01b03161461083857600080fd5b60005b81518110156108a05760006006600084848151811061085c5761085c611e3a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061089881611e50565b91505061083b565b5050565b6000546001600160a01b031633146108ce5760405162461bcd60e51b81526004016107ad90611e69565b6008546001600160a01b0316336001600160a01b0316146108ee57600080fd5b600081116109335760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107ad565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd89060200161067c565b6009546001600160a01b0316336001600160a01b03161461098857600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a530149060200161067c565b6008546001600160a01b0316336001600160a01b0316146109f657600080fd5b47610a00816117ee565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a485760405162461bcd60e51b81526004016107ad90611e69565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ab257600080fd5b60005b81518110156108a057600a5482516001600160a01b0390911690839083908110610ae157610ae1611e3a565b60200260200101516001600160a01b031614158015610b32575060075482516001600160a01b0390911690839083908110610b1e57610b1e611e3a565b60200260200101516001600160a01b031614155b15610b8f57600160066000848481518110610b4f57610b4f611e3a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b9981611e50565b915050610ab5565b6000610694338484611180565b6008546001600160a01b0316336001600160a01b031614610bce57600080fd5b6000610bd930610a03565b9050610a0081611873565b6000546001600160a01b03163314610c0e5760405162461bcd60e51b81526004016107ad90611e69565b60115460ff1615610c5b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107ad565b6011805460ff19166001179055426010556801a055690d9db80000600e819055600f55565b600a54600090610813906001600160a01b0316610a03565b6000546001600160a01b03163314610cc25760405162461bcd60e51b81526004016107ad90611e69565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161067c565b6000546001600160a01b03163314610d3f5760405162461bcd60e51b81526004016107ad90611e69565b60115460ff1615610d8c5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107ad565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610dc93082683635c9adc5dea0000061105c565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2b9190611e9e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9c9190611e9e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0d9190611e9e565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f3d81610a03565b600080610f526000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fba573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fdf9190611ebb565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611038573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a09190611ee9565b6001600160a01b0383166110be5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107ad565b6001600160a01b03821661111f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107ad565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111e45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107ad565b6001600160a01b0382166112465760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107ad565b600081116112a85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107ad565b6001600160a01b03831660009081526006602052604090205460ff161561131d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107ad565b600080546001600160a01b0385811691161480159061134a57506000546001600160a01b03848116911614155b1561178f57600a546001600160a01b03858116911614801561137a57506007546001600160a01b03848116911614155b801561139f57506001600160a01b03831660009081526004602052604090205460ff16155b1561162b5760115460ff166113f65760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107ad565b60105442036114355760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107ad565b42601054610e106114469190611f06565b11156114c057600f5461145884610a03565b6114629084611f06565b11156114c05760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107ad565b6001600160a01b03831660009081526005602052604090206001015460ff16611528576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115389190611f06565b111561160c57600e548211156115905760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107ad565b61159b42600f611f06565b6001600160a01b0384166000908152600560205260409020541061160c5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107ad565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611645575060115460ff165b801561165f5750600a546001600160a01b03858116911614155b1561178f5761166f42600f611f06565b6001600160a01b038516600090815260056020526040902054106116e15760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107ad565b60006116ec30610a03565b905080156117785760115462010000900460ff161561176f57600d54600a5460649190611721906001600160a01b0316610a03565b61172b9190611f1e565b6117359190611f3d565b81111561176f57600d54600a5460649190611758906001600160a01b0316610a03565b6117629190611f1e565b61176c9190611f3d565b90505b61177881611873565b47801561178857611788476117ee565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806117d157506001600160a01b03841660009081526004602052604090205460ff165b156117da575060005b6117e785858584866119e7565b5050505050565b6008546001600160a01b03166108fc611808600284611f3d565b6040518115909202916000818181858888f19350505050158015611830573d6000803e3d6000fd5b506009546001600160a01b03166108fc61184b600284611f3d565b6040518115909202916000818181858888f193505050501580156108a0573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118b7576118b7611e3a565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611910573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119349190611e9e565b8160018151811061194757611947611e3a565b6001600160a01b03928316602091820292909201015260075461196d913091168461105c565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119a6908590600090869030904290600401611f5f565b600060405180830381600087803b1580156119c057600080fd5b505af11580156119d4573d6000803e3d6000fd5b50506011805461ff001916905550505050565b60006119f38383611a09565b9050611a0186868684611a50565b505050505050565b6000808315611a49578215611a215750600b54611a49565b50600c54601054611a3490610384611f06565b421015611a4957611a46600582611f06565b90505b9392505050565b600080611a5d8484611b2d565b6001600160a01b0388166000908152600260205260409020549193509150611a86908590611e23565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ab6908390611f06565b6001600160a01b038616600090815260026020526040902055611ad881611b61565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b1d91815260200190565b60405180910390a3505050505050565b600080806064611b3d8587611f1e565b611b479190611f3d565b90506000611b558287611e23565b96919550909350505050565b30600090815260026020526040902054611b7c908290611f06565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bbc57858101830151858201604001528201611ba0565b81811115611bce576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a0057600080fd5b8035611c0481611be4565b919050565b600060208284031215611c1b57600080fd5b8135611a4981611be4565b60008060408385031215611c3957600080fd5b8235611c4481611be4565b946020939093013593505050565b60008060408385031215611c6557600080fd5b50508035926020909101359150565b600080600060608486031215611c8957600080fd5b8335611c9481611be4565b92506020840135611ca481611be4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611cde57600080fd5b823567ffffffffffffffff80821115611cf657600080fd5b818501915085601f830112611d0a57600080fd5b813581811115611d1c57611d1c611cb5565b8060051b604051601f19603f83011681018181108582111715611d4157611d41611cb5565b604052918252848201925083810185019188831115611d5f57600080fd5b938501935b82851015611d8457611d7585611bf9565b84529385019392850192611d64565b98975050505050505050565b600060208284031215611da257600080fd5b5035919050565b8015158114610a0057600080fd5b600060208284031215611dc957600080fd5b8135611a4981611da9565b60008060408385031215611de757600080fd5b8235611df281611be4565b91506020830135611e0281611be4565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3557611e35611e0d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e6257611e62611e0d565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611eb057600080fd5b8151611a4981611be4565b600080600060608486031215611ed057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611efb57600080fd5b8151611a4981611da9565b60008219821115611f1957611f19611e0d565b500190565b6000816000190483118215151615611f3857611f38611e0d565b500290565b600082611f5a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611faf5784516001600160a01b031683529383019391830191600101611f8a565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212200e7f040c1655d725eeda469844db750835260ef9142ec527d773eb4e95a9e25164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,900 |
0xb12e260275bcd28e6f8820666ba02c67c9600843
|
pragma solidity ^0.4.19;
contract ERC721 {
function approve(address to, uint256 tokenId) public;
function balanceOf(address owner) public view returns (uint256 balance);
function implementsERC721() public pure returns (bool);
function ownerOf(uint256 tokenId) public view returns (address addr);
function takeOwnership(uint256 tokenId) public;
function totalSupply() public view returns (uint256 total);
function transferFrom(address from, address to, uint256 tokenId) public;
function transfer(address to, uint256 tokenId) public;
event Transfer(address indexed from, address indexed to, uint256 tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
function name() external view returns (string name);
function symbol() external view returns (string symbol);
function tokenURI(uint256 _tokenId) external view returns (string uri);
}
contract ExoplanetToken is ERC721 {
using SafeMath for uint256;
event Birth(uint256 indexed tokenId, string name, uint32 numOfTokensBonusOnPurchase, address owner);
event TokenSold(uint256 tokenId, uint256 oldPriceInEther, uint256 newPriceInEther, address prevOwner, address winner, string name);
event Transfer(address from, address to, uint256 tokenId);
event ContractUpgrade(address newContract);
string private constant CONTRACT_NAME = "ExoPlanets";
string private constant CONTRACT_SYMBOL = "XPL";
string public constant BASE_URL = "https://exoplanets.io/metadata/planet_";
uint32 private constant NUM_EXOPLANETS_LIMIT = 10000;
uint256 private constant STEP_1 = 5.0 ether;
uint256 private constant STEP_2 = 10.0 ether;
uint256 private constant STEP_3 = 26.0 ether;
uint256 private constant STEP_4 = 36.0 ether;
uint256 private constant STEP_5 = 47.0 ether;
uint256 private constant STEP_6 = 59.0 ether;
uint256 private constant STEP_7 = 67.85 ether;
uint256 private constant STEP_8 = 76.67 ether;
mapping (uint256 => address) public currentOwner;
mapping (address => uint256) private numOwnedTokens;
mapping (uint256 => address) public approvedToTransfer;
mapping (uint256 => uint256) private currentPrice;
address public ceoAddress;
address public cooAddress;
bool public inPresaleMode = true;
bool public paused = false;
bool public allowMigrate = true;
address public newContractAddress;
bool public _allowBuyDirect = false;
struct ExoplanetRec {
uint8 lifeRate;
bool canBePurchased;
uint32 priceInExoTokens;
uint32 numOfTokensBonusOnPurchase;
string name;
string nickname;
string cryptoMatch;
string techBonus1;
string techBonus2;
string techBonus3;
string scientificData;
}
ExoplanetRec[] private exoplanets;
address public marketplaceAddress;
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
modifier migrateAllowed() {
require(allowMigrate);
_;
}
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function turnMigrateOff() public onlyCEO() {
allowMigrate = false;
}
function pause() public onlyCEO() whenNotPaused() {
paused = true;
}
function unpause() public onlyCEO() whenPaused() {
paused = false;
}
modifier allowBuyDirect() {
require(_allowBuyDirect);
_;
}
function setBuyDirectMode(bool newMode, address newMarketplace) public onlyCEO {
_allowBuyDirect = newMode;
marketplaceAddress = newMarketplace;
}
function setPurchaseableMode(uint256 tokenId, bool _canBePurchased, uint256 _newPrice) public afterPresaleMode() {
require(owns(msg.sender, tokenId));
exoplanets[tokenId].canBePurchased = _canBePurchased;
setPriceInEth(tokenId, _newPrice);
}
function getPurchaseableMode(uint256 tokenId) public view returns (bool) {
return exoplanets[tokenId].canBePurchased;
}
function setNewAddress(address _v2Address) public onlyCEO() whenPaused() {
newContractAddress = _v2Address;
ContractUpgrade(_v2Address);
}
modifier onlyCOO() {
require(msg.sender == cooAddress);
_;
}
modifier presaleModeActive() {
require(inPresaleMode);
_;
}
modifier afterPresaleMode() {
require(!inPresaleMode);
_;
}
modifier onlyCLevel() {
require(
msg.sender == ceoAddress ||
msg.sender == cooAddress
);
_;
}
function setCEO(address newCEO) public onlyCEO {
require(newCEO != address(0));
ceoAddress = newCEO;
}
function setCOO(address newCOO) public onlyCEO {
require(newCOO != address(0));
cooAddress = newCOO;
}
function setPresaleMode(bool newMode) public onlyCEO {
inPresaleMode = newMode;
}
/*** CONSTRUCTOR ***/
function ExoplanetToken() public {
ceoAddress = msg.sender;
cooAddress = msg.sender;
marketplaceAddress = msg.sender;
}
function approve(address to, uint256 tokenId) public {
require(owns(msg.sender, tokenId));
approvedToTransfer[tokenId] = to;
Approval(msg.sender, to, tokenId);
}
function balanceOf(address owner) public view returns (uint256 balance) {
balance = numOwnedTokens[owner];
}
function bytes32ToString(bytes32 x) private pure returns (string) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
function migrateSinglePlanet(
uint256 origTokenId, string name, uint256 priceInEther, uint32 priceInExoTokens,
string cryptoMatch, uint32 numOfTokensBonusOnPurchase,
uint8 lifeRate, string scientificData, address owner) public onlyCLevel migrateAllowed {
_migrateExoplanet(origTokenId, name, priceInEther, priceInExoTokens,
cryptoMatch, numOfTokensBonusOnPurchase, lifeRate, scientificData, owner);
}
function _migrateExoplanet(
uint256 origTokenId, string name, uint256 priceInEther, uint32 priceInExoTokens,
string cryptoMatch, uint32 numOfTokensBonusOnPurchase, uint8 lifeRate,
string scientificData, address owner) private {
require(totalSupply() < NUM_EXOPLANETS_LIMIT);
require(origTokenId == uint256(uint32(origTokenId)));
ExoplanetRec memory _exoplanet = ExoplanetRec({
name: name,
nickname: "",
priceInExoTokens: priceInExoTokens,
cryptoMatch: cryptoMatch,
numOfTokensBonusOnPurchase: numOfTokensBonusOnPurchase,
lifeRate: lifeRate,
techBonus1: "",
techBonus2: "",
techBonus3: "",
scientificData: scientificData,
canBePurchased: false
});
uint256 tokenId = exoplanets.push(_exoplanet) - 1;
currentPrice[tokenId] = priceInEther;
numOwnedTokens[owner]++;
exoplanets[tokenId].canBePurchased = false;
currentOwner[tokenId] = owner;
}
function createContractExoplanet(
string name, uint256 priceInEther, uint32 priceInExoTokens,
string cryptoMatch, uint32 numOfTokensBonusOnPurchase,
uint8 lifeRate, string scientificData) public onlyCLevel returns (uint256) {
return _createExoplanet(name, address(this), priceInEther, priceInExoTokens,
cryptoMatch, numOfTokensBonusOnPurchase, lifeRate,
scientificData);
}
function _createExoplanet(
string name, address owner, uint256 priceInEther, uint32 priceInExoTokens,
string cryptoMatch, uint32 numOfTokensBonusOnPurchase, uint8 lifeRate,
string scientificData) private returns (uint256) {
require(totalSupply() < NUM_EXOPLANETS_LIMIT);
ExoplanetRec memory _exoplanet = ExoplanetRec({
name: name,
nickname: "",
priceInExoTokens: priceInExoTokens,
cryptoMatch: cryptoMatch,
numOfTokensBonusOnPurchase: numOfTokensBonusOnPurchase,
lifeRate: lifeRate,
techBonus1: "",
techBonus2: "",
techBonus3: "",
scientificData: scientificData,
canBePurchased: false
});
uint256 newExoplanetId = exoplanets.push(_exoplanet) - 1;
require(newExoplanetId == uint256(uint32(newExoplanetId)));
Birth(newExoplanetId, name, numOfTokensBonusOnPurchase, owner);
currentPrice[newExoplanetId] = priceInEther;
_transfer(address(0), owner, newExoplanetId);
return newExoplanetId;
}
function unownedPlanet(uint256 tokenId) private view returns (bool) {
return currentOwner[tokenId] == address(this);
}
function getPlanetName(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].name;
}
function getNickname(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].nickname;
}
function getPriceInExoTokens(uint256 tokenId) public view returns (uint32) {
return exoplanets[tokenId].priceInExoTokens;
}
function getLifeRate(uint256 tokenId) public view returns (uint8) {
return exoplanets[tokenId].lifeRate;
}
function getNumOfTokensBonusOnPurchase(uint256 tokenId) public view returns (uint32) {
return exoplanets[tokenId].numOfTokensBonusOnPurchase;
}
function getCryptoMatch(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].cryptoMatch;
}
function getTechBonus1(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].techBonus1;
}
function getTechBonus2(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].techBonus2;
}
function getTechBonus3(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].techBonus3;
}
function getScientificData(uint256 tokenId) public view returns (string) {
return exoplanets[tokenId].scientificData;
}
function setTechBonus1(uint256 tokenId, string newVal) public {
require(msg.sender == marketplaceAddress || msg.sender == ceoAddress);
exoplanets[tokenId].techBonus1 = newVal;
}
function setTechBonus2(uint256 tokenId, string newVal) public {
require(msg.sender == marketplaceAddress || msg.sender == ceoAddress);
exoplanets[tokenId].techBonus2 = newVal;
}
function setTechBonus3(uint256 tokenId, string newVal) public {
require(msg.sender == marketplaceAddress || msg.sender == ceoAddress);
exoplanets[tokenId].techBonus3 = newVal;
}
function setPriceInEth(uint256 tokenId, uint256 newPrice) public afterPresaleMode() {
require(owns(msg.sender, tokenId));
currentPrice[tokenId] = newPrice;
}
function setUnownedPriceInEth(uint256 tokenId, uint256 newPrice) public onlyCLevel {
require(unownedPlanet(tokenId));
currentPrice[tokenId] = newPrice;
}
function setUnownedPurchaseableMode(uint256 tokenId, bool _canBePurchased) public onlyCLevel {
require(unownedPlanet(tokenId));
exoplanets[tokenId].canBePurchased = _canBePurchased;
}
function setPriceInExoTokens(uint256 tokenId, uint32 newPrice) public afterPresaleMode() {
require(owns(msg.sender, tokenId));
exoplanets[tokenId].priceInExoTokens = newPrice;
}
function setUnownedPriceInExoTokens(uint256 tokenId, uint32 newPrice) public onlyCLevel {
require(unownedPlanet(tokenId));
exoplanets[tokenId].priceInExoTokens = newPrice;
}
function setScientificData(uint256 tokenId, string newData) public onlyCLevel {
exoplanets[tokenId].scientificData = newData;
}
function setUnownedName(uint256 tokenId, string newData) public onlyCLevel {
require(unownedPlanet(tokenId));
exoplanets[tokenId].name = newData;
}
function setUnownedNickname(uint256 tokenId, string newData) public onlyCLevel {
require(unownedPlanet(tokenId));
exoplanets[tokenId].nickname = newData;
}
function setCryptoMatchValue(uint256 tokenId, string newData) public onlyCLevel {
exoplanets[tokenId].cryptoMatch = newData;
}
function setUnownedNumOfExoTokensBonus(uint256 tokenId, uint32 newData) public onlyCLevel {
require(unownedPlanet(tokenId));
exoplanets[tokenId].numOfTokensBonusOnPurchase = newData;
}
function setUnownedLifeRate(uint256 tokenId, uint8 newData) public onlyCLevel {
require(unownedPlanet(tokenId));
exoplanets[tokenId].lifeRate = newData;
}
function getExoplanet(uint256 tokenId) public view returns (
uint8 lifeRate,
bool canBePurchased,
uint32 priceInExoTokens,
uint32 numOfTokensBonusOnPurchase,
string name,
string nickname,
string cryptoMatch,
string scientificData,
uint256 sellingPriceInEther,
address owner) {
ExoplanetRec storage exoplanet = exoplanets[tokenId];
lifeRate = exoplanet.lifeRate;
canBePurchased = exoplanet.canBePurchased;
priceInExoTokens = exoplanet.priceInExoTokens;
numOfTokensBonusOnPurchase = exoplanet.numOfTokensBonusOnPurchase;
name = exoplanet.name;
nickname = exoplanet.nickname;
cryptoMatch = exoplanet.cryptoMatch;
scientificData = exoplanet.scientificData;
sellingPriceInEther = currentPrice[tokenId];
owner = currentOwner[tokenId];
}
function implementsERC721() public pure returns (bool) {
return true;
}
function ownerOf(uint256 tokenId) public view returns (address owner) {
owner = currentOwner[tokenId];
}
function transferUnownedPlanet(address newOwner, uint256 tokenId) public onlyCLevel {
require(unownedPlanet(tokenId));
require(newOwner != address(0));
_transfer(currentOwner[tokenId], newOwner, tokenId);
TokenSold(tokenId, currentPrice[tokenId], currentPrice[tokenId], address(this), newOwner, exoplanets[tokenId].name);
}
function purchase(uint256 tokenId) public payable whenNotPaused() presaleModeActive() {
require(currentOwner[tokenId] != msg.sender);
require(addressNotNull(msg.sender));
uint256 planetPrice = currentPrice[tokenId];
require(msg.value >= planetPrice);
uint paymentPrcnt;
uint stepPrcnt;
if (planetPrice <= STEP_1) {
paymentPrcnt = 93;
stepPrcnt = 200;
} else if (planetPrice <= STEP_2) {
paymentPrcnt = 93;
stepPrcnt = 150;
} else if (planetPrice <= STEP_3) {
paymentPrcnt = 93;
stepPrcnt = 135;
} else if (planetPrice <= STEP_4) {
paymentPrcnt = 94;
stepPrcnt = 125;
} else if (planetPrice <= STEP_5) {
paymentPrcnt = 94;
stepPrcnt = 119;
} else if (planetPrice <= STEP_6) {
paymentPrcnt = 95;
stepPrcnt = 117;
} else if (planetPrice <= STEP_7) {
paymentPrcnt = 95;
stepPrcnt = 115;
} else if (planetPrice <= STEP_8) {
paymentPrcnt = 95;
stepPrcnt = 113;
} else {
paymentPrcnt = 96;
stepPrcnt = 110;
}
currentPrice[tokenId] = planetPrice.mul(stepPrcnt).div(100);
uint256 payment = uint256(planetPrice.mul(paymentPrcnt).div(100));
address seller = currentOwner[tokenId];
if (seller != address(this)) {
seller.transfer(payment);
}
_transfer(seller, msg.sender, tokenId);
TokenSold(tokenId, planetPrice, currentPrice[tokenId], seller, msg.sender, exoplanets[tokenId].name);
}
function buyDirectInMarketplace(uint256 tokenId) public payable
whenNotPaused() afterPresaleMode() allowBuyDirect() {
require(exoplanets[tokenId].canBePurchased);
uint256 planetPrice = currentPrice[tokenId];
require(msg.value >= planetPrice);
address seller = currentOwner[tokenId];
if (seller != address(this)) {
seller.transfer(planetPrice);
}
_transfer(seller, msg.sender, tokenId);
TokenSold(tokenId, planetPrice, currentPrice[tokenId], seller, msg.sender, exoplanets[tokenId].name);
}
function priceOf(uint256 tokenId) public view returns (uint256) {
return currentPrice[tokenId];
}
function takeOwnership(uint256 tokenId) public whenNotPaused() {
require(addressNotNull(msg.sender));
require(approved(msg.sender, tokenId));
_transfer(currentOwner[tokenId], msg.sender, tokenId);
}
function tokensOfOwner(address owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalExoplanets = totalSupply();
uint256 resultIndex = 0;
uint256 exoplanetId;
for (exoplanetId = 0; exoplanetId <= totalExoplanets; exoplanetId++) {
if (currentOwner[exoplanetId] == owner) {
result[resultIndex] = exoplanetId;
resultIndex++;
}
}
return result;
}
}
function name() external view returns (string name) {
name = CONTRACT_NAME;
}
function symbol() external view returns (string symbol) {
symbol = CONTRACT_SYMBOL;
}
function tokenURI(uint256 _tokenId) external view returns (string uri) {
uri = appendNumToString(BASE_URL, _tokenId);
}
function totalSupply() public view returns (uint256 total) {
total = exoplanets.length;
}
function transfer(address to, uint256 tokenId) public whenNotPaused() {
require(owns(msg.sender, tokenId));
require(addressNotNull(to));
_transfer(msg.sender, to, tokenId);
}
function transferFrom(address from, address to, uint256 tokenId) public whenNotPaused() {
require(owns(from, tokenId));
require(approved(msg.sender, tokenId));
require(addressNotNull(to));
_transfer(from, to, tokenId);
}
function addressNotNull(address addr) private pure returns (bool) {
return addr != address(0);
}
function approved(address to, uint256 tokenId) private view returns (bool) {
return approvedToTransfer[tokenId] == to;
}
function owns(address claimant, uint256 tokenId) private view returns (bool) {
return claimant == currentOwner[tokenId];
}
function payout() public onlyCLevel {
ceoAddress.transfer(this.balance);
}
function payoutPartial(uint256 amount) public onlyCLevel {
require(amount <= this.balance);
ceoAddress.transfer(amount);
}
function _transfer(address from, address to, uint256 tokenId) private {
numOwnedTokens[to]++;
exoplanets[tokenId].canBePurchased = false;
currentOwner[tokenId] = to;
if (from != address(0)) {
numOwnedTokens[from]--;
delete approvedToTransfer[tokenId];
}
Transfer(from, to, tokenId);
}
function appendNumToString(string baseUrl, uint256 tokenId) private pure returns (string) {
string memory _b = numToString(tokenId);
bytes memory bytes_a = bytes(baseUrl);
bytes memory bytes_b = bytes(_b);
string memory length_ab = new string(bytes_a.length + bytes_b.length);
bytes memory bytes_c = bytes(length_ab);
uint k = 0;
for (uint i = 0; i < bytes_a.length; i++) {
bytes_c[k++] = bytes_a[i];
}
for (i = 0; i < bytes_b.length; i++) {
bytes_c[k++] = bytes_b[i];
}
return string(bytes_c);
}
function numToString(uint256 tokenId) private pure returns (string str) {
uint uintVal = uint(tokenId);
bytes32 bytes32Val = uintToBytes32(uintVal);
return bytes32ToString(bytes32Val);
}
function uintToBytes32(uint v) private pure returns (bytes32 ret) {
if (v == 0) {
ret = '0';
}
else {
while (v > 0) {
ret = bytes32(uint(ret) / (2 ** 8));
ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
v /= 10;
}
}
return ret;
}
}
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;
}
}
|
0x60606040526004361061030b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306d91eea811461031057806306f33ae21461051f57806306fdde031461053d578063095ea7b3146105c75780630a0f8168146105e95780631051db341461061857806312cacbb51461063f57806318160ddd146106525780631d017b28146106775780631d8b4dd11461069657806323b872dd1461078c57806327d7874c146107b45780632ba73c15146107d35780632f0ddcb2146107f257806334c2b620146108085780633f4ba83a1461081e5780634777c1f4146108315780635c975abb1461084a57806362133a6c1461085d5780636352211e1461087357806363bd1d4a146108895780636af04a571461089c5780636d25ba1d146108af5780636f7a6b8b1461090557806370a082311461091b578063715879881461093a578063798ce54f146109595780637be5b5ae1461096f5780637dc45e27146109935780637f78636a146109e95780637ffc0712146109fc57806381bc365714610a285780638456cb5914610b2e5780638462151c14610b415780638bfff5a014610bb35780638f8db73714610bd157806395d89b4114610bdc578063a594056f14610bef578063a715df5814610c1e578063a9059cbb14610c74578063ad50039f14610c96578063afe1d4cf14610cec578063b047fb5014610d42578063b2e6ceeb14610d55578063b3ef774b14610d6b578063b629d74114610d81578063b8a2511914610da3578063b9186d7d14610dbb578063bd62104214610dd1578063bf8edd8514610df0578063c87b56dd14610e09578063cbe7a15014610e1f578063ccdaeab014610e35578063d19b99b514610e4b578063d6c5d82314610e5e578063daa17f4914610e74578063e12925a914610e87578063e2f77ae214610edd578063e545110314610efc578063e780444414610f12578063e785daaf14610f25578063efef39a114610f40578063f13b68e814610f4b578063f36a1fd914610f61578063f4ae0d2f14610f74578063f6e5e29814610f8a575b600080fd5b341561031b57600080fd5b610326600435610fe0565b60405160ff8b168152891515602082015263ffffffff808a166040830152881660608201526101008101839052600160a060020a038216610120820152610140608082018181529060a083019060c084019060e085019085018b818151815260200191508051906020019080838360005b838110156103af578082015183820152602001610397565b50505050905090810190601f1680156103dc5780820380516001836020036101000a031916815260200191505b5085810384528a818151815260200191508051906020019080838360005b838110156104125780820151838201526020016103fa565b50505050905090810190601f16801561043f5780820380516001836020036101000a031916815260200191505b50858103835289818151815260200191508051906020019080838360005b8381101561047557808201518382015260200161045d565b50505050905090810190601f1680156104a25780820380516001836020036101000a031916815260200191505b50858103825288818151815260200191508051906020019080838360005b838110156104d85780820151838201526020016104c0565b50505050905090810190601f1680156105055780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b341561052a57600080fd5b61053b60043560ff60243516611336565b005b341561054857600080fd5b6105506113b6565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561058c578082015183820152602001610574565b50505050905090810190601f1680156105b95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105d257600080fd5b61053b600160a060020a03600435166024356113f7565b34156105f457600080fd5b6105fc61146f565b604051600160a060020a03909116815260200160405180910390f35b341561062357600080fd5b61062b61147e565b604051901515815260200160405180910390f35b341561064a57600080fd5b61062b611484565b341561065d57600080fd5b610665611494565b60405190815260200160405180910390f35b341561068257600080fd5b61053b60043563ffffffff6024351661149a565b34156106a157600080fd5b61066560046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949686359660208082013563ffffffff169750919550606081019450604090810135860180830194503592508291601f8301819004810201905190810160405281815292919060208401838380828437509496863563ffffffff169660208082013560ff169750919550606081019450604090810135860180830194503592508291601f83018190048102019051908101604052818152929190602084018383808284375094965061152795505050505050565b341561079757600080fd5b61053b600160a060020a036004358116906024351660443561157c565b34156107bf57600080fd5b61053b600160a060020a03600435166115e1565b34156107de57600080fd5b61053b600160a060020a0360043516611633565b34156107fd57600080fd5b610550600435611685565b341561081357600080fd5b61055060043561174c565b341561082957600080fd5b61053b6117dc565b341561083c57600080fd5b61053b600435602435611830565b341561085557600080fd5b61062b61188c565b341561086857600080fd5b61055060043561189c565b341561087e57600080fd5b6105fc60043561192c565b341561089457600080fd5b61053b611947565b34156108a757600080fd5b6105fc6119b8565b34156108ba57600080fd5b61053b600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506119c795505050505050565b341561091057600080fd5b6105fc600435611a2f565b341561092657600080fd5b610665600160a060020a0360043516611a4a565b341561094557600080fd5b61053b600160a060020a0360043516611a65565b341561096457600080fd5b61053b600435611af3565b341561097a57600080fd5b61053b6004351515600160a060020a0360243516611b76565b341561099e57600080fd5b61053b600480359060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650611be195505050505050565b34156109f457600080fd5b610550611c49565b3415610a0757600080fd5b610a12600435611ca9565b60405160ff909116815260200160405180910390f35b3415610a3357600080fd5b61053b600480359060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949686359660208082013563ffffffff169750919550606081019450604090810135860180830194503592508291601f8301819004810201905190810160405281815292919060208401838380828437509496863563ffffffff169660208082013560ff169750919550606081019450604090810135860180830194503592508291601f83018190048102019051908101604052818152929190602084018383808284375094965050509235600160a060020a03169250611cd4915050565b3415610b3957600080fd5b61053b611d51565b3415610b4c57600080fd5b610b60600160a060020a0360043516611daa565b60405160208082528190810183818151815260200191508051906020019060200280838360005b83811015610b9f578082015183820152602001610b87565b505050509050019250505060405180910390f35b3415610bbe57600080fd5b61053b6004356024351515604435611e8b565b61053b600435611ef7565b3415610be757600080fd5b610550612107565b3415610bfa57600080fd5b610c05600435612148565b60405163ffffffff909116815260200160405180910390f35b3415610c2957600080fd5b61053b600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061217c95505050505050565b3415610c7f57600080fd5b61053b600160a060020a03600435166024356121f8565b3415610ca157600080fd5b61053b600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061224795505050505050565b3415610cf757600080fd5b61053b600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506122af95505050505050565b3415610d4d57600080fd5b6105fc612317565b3415610d6057600080fd5b61053b600435612326565b3415610d7657600080fd5b610c05600435612389565b3415610d8c57600080fd5b61053b600160a060020a03600435166024356123c1565b3415610dae57600080fd5b61053b6004351515612558565b3415610dc657600080fd5b6106656004356125a2565b3415610ddc57600080fd5b61053b60043563ffffffff602435166125b4565b3415610dfb57600080fd5b61053b600435602435612641565b3415610e1457600080fd5b610550600435612662565b3415610e2a57600080fd5b6105506004356126d6565b3415610e4057600080fd5b610550600435612766565b3415610e5657600080fd5b61053b6127f6565b3415610e6957600080fd5b610550600435612833565b3415610e7f57600080fd5b6105fc6128c3565b3415610e9257600080fd5b61053b600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506128d295505050505050565b3415610ee857600080fd5b61053b60043563ffffffff6024351661294e565b3415610f0757600080fd5b6105fc60043561296f565b3415610f1d57600080fd5b61062b61298a565b3415610f3057600080fd5b61053b60043560243515156129ad565b61053b600435612a31565b3415610f5657600080fd5b61062b600435612d76565b3415610f6c57600080fd5b61062b612da6565b3415610f7f57600080fd5b610550600435612db6565b3415610f9557600080fd5b61053b600480359060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650612e4695505050505050565b600080600080610fee613971565b610ff6613971565b610ffe613971565b611006613971565b600080600060078c81548110151561101a57fe5b906000526020600020906008020190508060000160009054906101000a900460ff169a508060000160019054906101000a900460ff1699508060000160029054906101000a900463ffffffff1698508060000160069054906101000a900463ffffffff169750806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111185780601f106110ed57610100808354040283529160200191611118565b820191906000526020600020905b8154815290600101906020018083116110fb57829003601f168201915b50505050509650806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111b75780601f1061118c576101008083540402835291602001916111b7565b820191906000526020600020905b81548152906001019060200180831161119a57829003601f168201915b50505050509550806003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112565780601f1061122b57610100808354040283529160200191611256565b820191906000526020600020905b81548152906001019060200180831161123957829003601f168201915b50505050509450806007018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112f55780601f106112ca576101008083540402835291602001916112f5565b820191906000526020600020905b8154815290600101906020018083116112d857829003601f168201915b50505060009e8f525050600360209081526040808f2054918f9052909d20549b9d9a9c999b989a979996989597909695600160a060020a0316945092505050565b60045433600160a060020a0390811691161480611361575060055433600160a060020a039081169116145b151561136c57600080fd5b61137582612eae565b151561138057600080fd5b8060078381548110151561139057fe5b60009182526020909120600890910201805460ff191660ff929092169190911790555050565b6113be613971565b60408051908101604052600a81527f45786f506c616e657473000000000000000000000000000000000000000000006020820152919050565b6114013382612ecf565b151561140c57600080fd5b600081815260026020526040908190208054600160a060020a031916600160a060020a03858116918217909255839290913316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925905160405180910390a45050565b600454600160a060020a031681565b60015b90565b60055460a060020a900460ff1681565b60075490565b60045433600160a060020a03908116911614806114c5575060055433600160a060020a039081169116145b15156114d057600080fd5b6114d982612eae565b15156114e457600080fd5b806007838154811015156114f457fe5b906000526020600020906008020160000160066101000a81548163ffffffff021916908363ffffffff1602179055505050565b60045460009033600160a060020a0390811691161480611555575060055433600160a060020a039081169116145b151561156057600080fd5b6115708830898989898989612eef565b98975050505050505050565b60055460a860020a900460ff161561159357600080fd5b61159d8382612ecf565b15156115a857600080fd5b6115b23382613203565b15156115bd57600080fd5b6115c682613223565b15156115d157600080fd5b6115dc838383613231565b505050565b60045433600160a060020a039081169116146115fc57600080fd5b600160a060020a038116151561161157600080fd5b60048054600160a060020a031916600160a060020a0392909216919091179055565b60045433600160a060020a0390811691161461164e57600080fd5b600160a060020a038116151561166357600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b61168d613971565b600780548390811061169b57fe5b90600052602060002090600802016005018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b820191906000526020600020905b81548152906001019060200180831161172357829003601f168201915b50505050509050919050565b611754613971565b600780548390811061176257fe5b90600052602060002090600802016002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b60045433600160a060020a039081169116146117f757600080fd5b60055460a860020a900460ff16151561180f57600080fd5b6005805475ff00000000000000000000000000000000000000000019169055565b60045433600160a060020a039081169116148061185b575060055433600160a060020a039081169116145b151561186657600080fd5b61186f82612eae565b151561187a57600080fd5b60009182526003602052604090912055565b60055460a860020a900460ff1681565b6118a4613971565b60078054839081106118b257fe5b90600052602060002090600802016001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b600090815260208190526040902054600160a060020a031690565b60045433600160a060020a0390811691161480611972575060055433600160a060020a039081169116145b151561197d57600080fd5b600454600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156119b657600080fd5b565b600654600160a060020a031681565b60085433600160a060020a03908116911614806119f2575060045433600160a060020a039081169116145b15156119fd57600080fd5b80600783815481101515611a0d57fe5b90600052602060002090600802016004019080516115dc929160200190613983565b600260205260009081526040902054600160a060020a031681565b600160a060020a031660009081526001602052604090205490565b60045433600160a060020a03908116911614611a8057600080fd5b60055460a860020a900460ff161515611a9857600080fd5b60068054600160a060020a031916600160a060020a0383161790557f450db8da6efbe9c22f2347f7c2021231df1fc58d3ae9a2fa75d39fa44619930581604051600160a060020a03909116815260200160405180910390a150565b60045433600160a060020a0390811691161480611b1e575060055433600160a060020a039081169116145b1515611b2957600080fd5b600160a060020a03301631811115611b4057600080fd5b600454600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515611b7357600080fd5b50565b60045433600160a060020a03908116911614611b9157600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a931515939093029290921790915560088054600160a060020a031916600160a060020a03909216919091179055565b60045433600160a060020a0390811691161480611c0c575060055433600160a060020a039081169116145b1515611c1757600080fd5b80600783815481101515611c2757fe5b90600052602060002090600802016003019080516115dc929160200190613983565b606060405190810160405280602681526020017f68747470733a2f2f65786f706c616e6574732e696f2f6d657461646174612f7081526020017f6c616e65745f000000000000000000000000000000000000000000000000000081525081565b6000600782815481101515611cba57fe5b600091825260209091206008909102015460ff1692915050565b60045433600160a060020a0390811691161480611cff575060055433600160a060020a039081169116145b1515611d0a57600080fd5b600554760100000000000000000000000000000000000000000000900460ff161515611d3557600080fd5b611d4689898989898989898961334c565b505050505050505050565b60045433600160a060020a03908116911614611d6c57600080fd5b60055460a860020a900460ff1615611d8357600080fd5b6005805475ff000000000000000000000000000000000000000000191660a860020a179055565b611db2613971565b6000611dbc613971565b6000806000611dca87611a4a565b9450841515611dfa576000604051805910611de25750595b90808252806020026020018201604052509550611e81565b84604051805910611e085750595b90808252806020026020018201604052509350611e23611494565b925060009150600090505b828111611e7d57600081815260208190526040902054600160a060020a0388811691161415611e755780848381518110611e6457fe5b602090810290910101526001909101905b600101611e2e565b8395505b5050505050919050565b60055460a060020a900460ff1615611ea257600080fd5b611eac3384612ecf565b1515611eb757600080fd5b81600784815481101515611ec757fe5b6000918252602090912060089091020180549115156101000261ff00199092169190911790556115dc8382612641565b600554600090819060a860020a900460ff1615611f1357600080fd5b60055460a060020a900460ff1615611f2a57600080fd5b60065460a060020a900460ff161515611f4257600080fd5b6007805484908110611f5057fe5b6000918252602090912060089091020154610100900460ff161515611f7457600080fd5b60008381526003602052604090205491503482901015611f9357600080fd5b50600082815260208190526040902054600160a060020a039081169030168114611fe857600160a060020a03811682156108fc0283604051600060405180830381858888f193505050501515611fe857600080fd5b611ff3813385613231565b7e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f83836003600087815260200190815260200160002054843360078981548110151561203a57fe5b90600052602060002090600802016001016040518681526020810186905260408101859052600160a060020a0380851660608301528316608082015260c060a082018181528354600260001961010060018416150201909116049183018290529060e0830190849080156120ef5780601f106120c4576101008083540402835291602001916120ef565b820191906000526020600020905b8154815290600101906020018083116120d257829003601f168201915b505097505050505050505060405180910390a1505050565b61210f613971565b60408051908101604052600381527f58504c00000000000000000000000000000000000000000000000000000000006020820152919050565b600060078281548110151561215957fe5b600091825260209091206008909102015462010000900463ffffffff1692915050565b60045433600160a060020a03908116911614806121a7575060055433600160a060020a039081169116145b15156121b257600080fd5b6121bb82612eae565b15156121c657600080fd5b806007838154811015156121d657fe5b90600052602060002090600802016001019080516115dc929160200190613983565b60055460a860020a900460ff161561220f57600080fd5b6122193382612ecf565b151561222457600080fd5b61222d82613223565b151561223857600080fd5b612243338383613231565b5050565b60085433600160a060020a0390811691161480612272575060045433600160a060020a039081169116145b151561227d57600080fd5b8060078381548110151561228d57fe5b90600052602060002090600802016005019080516115dc929160200190613983565b60085433600160a060020a03908116911614806122da575060045433600160a060020a039081169116145b15156122e557600080fd5b806007838154811015156122f557fe5b90600052602060002090600802016006019080516115dc929160200190613983565b600554600160a060020a031681565b60055460a860020a900460ff161561233d57600080fd5b61234633613223565b151561235157600080fd5b61235b3382613203565b151561236657600080fd5b600081815260208190526040902054611b7390600160a060020a03163383613231565b600060078281548110151561239a57fe5b60009182526020909120600890910201546601000000000000900463ffffffff1692915050565b60045433600160a060020a03908116911614806123ec575060055433600160a060020a039081169116145b15156123f757600080fd5b61240081612eae565b151561240b57600080fd5b600160a060020a038216151561242057600080fd5b60008181526020819052604090205461244390600160a060020a03168383613231565b600081815260036020526040902054600780547e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f9284929091829130918891908690811061248c57fe5b90600052602060002090600802016001016040518681526020810186905260408101859052600160a060020a0380851660608301528316608082015260c060a082018181528354600260001961010060018416150201909116049183018290529060e0830190849080156125415780601f1061251657610100808354040283529160200191612541565b820191906000526020600020905b81548152906001019060200180831161252457829003601f168201915b505097505050505050505060405180910390a15050565b60045433600160a060020a0390811691161461257357600080fd5b6005805491151560a060020a0274ff000000000000000000000000000000000000000019909216919091179055565b60009081526003602052604090205490565b60045433600160a060020a03908116911614806125df575060055433600160a060020a039081169116145b15156125ea57600080fd5b6125f382612eae565b15156125fe57600080fd5b8060078381548110151561260e57fe5b906000526020600020906008020160000160026101000a81548163ffffffff021916908363ffffffff1602179055505050565b60055460a060020a900460ff161561265857600080fd5b61186f3383612ecf565b61266a613971565b6126d0606060405190810160405280602681526020017f68747470733a2f2f65786f706c616e6574732e696f2f6d657461646174612f7081526020017f6c616e65745f00000000000000000000000000000000000000000000000000008152508361361a565b92915050565b6126de613971565b60078054839081106126ec57fe5b90600052602060002090600802016003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b61276e613971565b600780548390811061277c57fe5b90600052602060002090600802016006018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b60045433600160a060020a0390811691161461281157600080fd5b6005805476ff0000000000000000000000000000000000000000000019169055565b61283b613971565b600780548390811061284957fe5b90600052602060002090600802016007018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b600854600160a060020a031681565b60045433600160a060020a03908116911614806128fd575060055433600160a060020a039081169116145b151561290857600080fd5b61291182612eae565b151561291c57600080fd5b8060078381548110151561292c57fe5b90600052602060002090600802016002019080516115dc929160200190613983565b60055460a060020a900460ff161561296557600080fd5b6125f33383612ecf565b600060208190529081526040902054600160a060020a031681565b600554760100000000000000000000000000000000000000000000900460ff1681565b60045433600160a060020a03908116911614806129d8575060055433600160a060020a039081169116145b15156129e357600080fd5b6129ec82612eae565b15156129f757600080fd5b80600783815481101515612a0757fe5b6000918252602090912060089091020180549115156101000261ff00199092169190911790555050565b6000806000806000600560159054906101000a900460ff16151515612a5557600080fd5b60055460a060020a900460ff161515612a6d57600080fd5b60008681526020819052604090205433600160a060020a0390811691161415612a9557600080fd5b612a9e33613223565b1515612aa957600080fd5b60008681526003602052604090205494503485901015612ac857600080fd5b674563918244f400008511612ae457605d935060c89250612bb7565b678ac7230489e800008511612b0057605d935060969250612bb7565b680168d28e3f002800008511612b1d57605d935060879250612bb7565b6801f399b1438a1000008511612b3a57605e9350607d9250612bb7565b68028c418afbbb5c00008511612b5757605e935060779250612bb7565b680332ca1b67940c00008511612b7457605f935060759250612bb7565b6803ad9b9f83ea4100008511612b9157605f935060739250612bb7565b680428028ec8f13300008511612bae57605f935060719250612bb7565b60609350606e92505b612bd86064612bcc878663ffffffff61375716565b9063ffffffff61378d16565b600087815260036020526040902055612bfc6064612bcc878763ffffffff61375716565b600087815260208190526040902054909250600160a060020a03908116915030168114612c5457600160a060020a03811682156108fc0283604051600060405180830381858888f193505050501515612c5457600080fd5b612c5f813388613231565b7e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f8686600360008a815260200190815260200160002054843360078c815481101515612ca657fe5b90600052602060002090600802016001016040518681526020810186905260408101859052600160a060020a0380851660608301528316608082015260c060a082018181528354600260001961010060018416150201909116049183018290529060e083019084908015612d5b5780601f10612d3057610100808354040283529160200191612d5b565b820191906000526020600020905b815481529060010190602001808311612d3e57829003601f168201915b505097505050505050505060405180910390a1505050505050565b6000600782815481101515612d8757fe5b6000918252602090912060089091020154610100900460ff1692915050565b60065460a060020a900460ff1681565b612dbe613971565b6007805483908110612dcc57fe5b90600052602060002090600802016004018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117405780601f1061171557610100808354040283529160200191611740565b60045433600160a060020a0390811691161480612e71575060055433600160a060020a039081169116145b1515612e7c57600080fd5b80600783815481101515612e8c57fe5b90600052602060002090600802016007019080516115dc929160200190613983565b60009081526020819052604090205430600160a060020a0390811691161490565b600090815260208190526040902054600160a060020a0390811691161490565b6000612ef9613a01565b6000612710612f06611494565b10612f1057600080fd5b610160604051908101604052808660ff1681526020016000151581526020018963ffffffff1681526020018763ffffffff1681526020018c8152602001602060405190810160405280600081525081526020018881526020016020604051908101604052806000815250815260200160206040519081016040528060008152508152602001602060405190810160405260008152815260200185905260078054919350600191808301612fc38382613a85565b600092835260209092208591600802018151815460ff191660ff91909116178155602082015181549015156101000261ff00199091161781556040820151815463ffffffff91909116620100000265ffffffff0000199091161781556060820151815463ffffffff9190911666010000000000000269ffffffff00000000000019909116178155608082015181600101908051613064929160200190613983565b5060a08201518160020190805161307f929160200190613983565b5060c08201518160030190805161309a929160200190613983565b5060e0820151816004019080516130b5929160200190613983565b50610100820151816005019080516130d1929160200190613983565b50610120820151816006019080516130ed929160200190613983565b5061014082015181600701908051613109929160200190613983565b50505003905063ffffffff8116811461312157600080fd5b807f9b2c63e473707556567cadc162b1c1e8ed0c0d2684032a847e7ed74cda7291da8c888d60405163ffffffff83166020820152600160a060020a038216604082015260608082528190810185818151815260200191508051906020019080838360005b8381101561319d578082015183820152602001613185565b50505050905090810190601f1680156131ca5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a260008181526003602052604081208a90556131f5908b83613231565b9a9950505050505050505050565b600090815260026020526040902054600160a060020a0391821691161490565b600160a060020a0316151590565b600160a060020a0382166000908152600160208190526040822080549091019055600780548390811061326057fe5b60009182526020808320600890920290910180549315156101000261ff00199094169390931790925582815290819052604090208054600160a060020a03808516600160a060020a0319909216919091179091558316156132f757600160a060020a03831660009081526001602090815260408083208054600019019055838352600290915290208054600160a060020a03191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838383604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b613354613a01565b6000612710613361611494565b1061336b57600080fd5b63ffffffff8b168b1461337d57600080fd5b610160604051908101604052808660ff1681526020016000151581526020018963ffffffff1681526020018763ffffffff1681526020018b81526020016020604051908101604052806000815250815260200188815260200160206040519081016040528060008152508152602001602060405190810160405280600081525081526020016020604051908101604052600081528152602001859052600780549193506001918083016134308382613a85565b600092835260209092208591600802018151815460ff191660ff91909116178155602082015181549015156101000261ff00199091161781556040820151815463ffffffff91909116620100000265ffffffff0000199091161781556060820151815463ffffffff9190911666010000000000000269ffffffff000000000000199091161781556080820151816001019080516134d1929160200190613983565b5060a0820151816002019080516134ec929160200190613983565b5060c082015181600301908051613507929160200190613983565b5060e082015181600401908051613522929160200190613983565b506101008201518160050190805161353e929160200190613983565b506101208201518160060190805161355a929160200190613983565b5061014082015181600701908051613576929160200190613983565b5050500360008181526003602090815260408083208d9055600160a060020a0387168352600191829052822080549091019055600780549293509091839081106135bc57fe5b60009182526020808320600890920290910180549315156101000261ff001990941693909317909255918252819052604090208054600160a060020a03909316600160a060020a031990931692909217909155505050505050505050565b613622613971565b61362a613971565b613632613971565b61363a613971565b613642613971565b61364a613971565b600080613656896137a4565b965089955086945084518651016040518059106136705750595b818152601f19601f83011681016020016040529050935083925060009150600090505b85518110156136ec578581815181106136a857fe5b016020015160f860020a900460f860020a028383806001019450815181106136cc57fe5b906020010190600160f860020a031916908160001a905350600101613693565b5060005b84518110156137495784818151811061370557fe5b016020015160f860020a900460f860020a0283838060010194508151811061372957fe5b906020010190600160f860020a031916908160001a9053506001016136f0565b509098975050505050505050565b60008083151561376a5760009150613786565b5082820282848281151561377a57fe5b041461378257fe5b8091505b5092915050565b600080828481151561379b57fe5b04949350505050565b6137ac613971565b8160006137b8826137cb565b90506137c381613829565b949350505050565b60008115156137fb57507f3000000000000000000000000000000000000000000000000000000000000000613824565b60008211156138245761010081049050600a820660300160f860020a0217600a820491506137fb565b919050565b613831613971565b613839613971565b6000806000613846613971565b60206040518059106138555750595b818152601f19601f83011681016020016040529050945060009350600092505b60208310156138e8576008830260020a870291507fff000000000000000000000000000000000000000000000000000000000000008216156138dd57818585815181106138be57fe5b906020010190600160f860020a031916908160001a9053506001909301925b600190920191613875565b836040518059106138f65750595b818152601f19601f830116810160200160405290509050600092505b838310156139675784838151811061392657fe5b016020015160f860020a900460f860020a0281848151811061394457fe5b906020010190600160f860020a031916908160001a905350600190920191613912565b9695505050505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106139c457805160ff19168380011785556139f1565b828001600101855582156139f1579182015b828111156139f15782518255916020019190600101906139d6565b506139fd929150613ab1565b5090565b6101606040519081016040908152600080835260208301819052908201819052606082015260808101613a32613971565b8152602001613a3f613971565b8152602001613a4c613971565b8152602001613a59613971565b8152602001613a66613971565b8152602001613a73613971565b8152602001613a80613971565b905290565b8154818355818115116115dc576008028160080283600052602060002091820191016115dc9190613acb565b61148191905b808211156139fd5760008155600101613ab7565b61148191905b808211156139fd57805469ffffffffffffffffffff191681556000613af96001830182613b56565b613b07600283016000613b56565b613b15600383016000613b56565b613b23600483016000613b56565b613b31600583016000613b56565b613b3f600683016000613b56565b613b4d600783016000613b56565b50600801613ad1565b50805460018160011615610100020316600290046000825580601f10613b7c5750611b73565b601f016020900490600052602060002090810190611b739190613ab15600a165627a7a723058201ac725bf589917ae019613eb109df68d343d3967e911d88e4d772933b1a019070029
|
{"success": true, "error": null, "results": {}}
| 2,901 |
0xb934cc8832ea1af8c02ac888486624694443cb8e
|
// 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 ALPHAMUS is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ALPHAMUS";
string private constant _symbol = "ALPHA";
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 = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xF5Bec39d8756f5F78875E49847081727005aF82A);
address payable private _marketingAddress = payable(0xF5Bec39d8756f5F78875E49847081727005aF82A);
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 = 7000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ae57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195b565b6105f9565b005b34801561020a57600080fd5b50604080518082019091526008815267414c5048414d555360c01b60208201525b6040516102389190611a20565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a75565b610698565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b5066038d7ea4c680005b604051908152602001610238565b3480156102d957600080fd5b506102616102e8366004611aa1565b6106af565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610238565b34801561032b57600080fd5b50601554610291906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611ae2565b610718565b34801561036b57600080fd5b506101fc61037a366004611b0f565b610763565b34801561038b57600080fd5b506101fc6107ab565b3480156103a057600080fd5b506102bf6103af366004611ae2565b6107f6565b3480156103c057600080fd5b506101fc610818565b3480156103d557600080fd5b506101fc6103e4366004611b2a565b61088c565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611ae2565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610291565b34801561045657600080fd5b506101fc610465366004611b0f565b6108bb565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b50604080518082019091526005815264414c50484160d81b602082015261022b565b3480156104ba57600080fd5b506101fc6104c9366004611b2a565b610903565b3480156104da57600080fd5b506101fc6104e9366004611b43565b610932565b3480156104fa57600080fd5b50610261610509366004611a75565b610970565b34801561051a57600080fd5b50610261610529366004611ae2565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc61097d565b34801561055f57600080fd5b506101fc61056e366004611b75565b6109d1565b34801561057f57600080fd5b506102bf61058e366004611bf9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611b2a565b610a72565b3480156105e557600080fd5b506101fc6105f4366004611ae2565b610aa1565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611c32565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611c67565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611c93565b91505061062f565b5050565b60006106a5338484610b8b565b5060015b92915050565b60006106bc848484610caf565b61070e843361070985604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111eb565b610b8b565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611c32565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611c32565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611225565b50565b6001600160a01b0381166000908152600260205260408120546106a99061125f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611c32565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611c32565b601655565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062390611c32565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161062390611c32565b601855565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161062390611c32565b600893909355600a91909155600955600b55565b60006106a5338484610caf565b6012546001600160a01b0316336001600160a01b031614806109b257506013546001600160a01b0316336001600160a01b0316145b6109bb57600080fd5b60006109c6306107f6565b90506107f3816112e3565b6000546001600160a01b031633146109fb5760405162461bcd60e51b815260040161062390611c32565b60005b82811015610a6c578160056000868685818110610a1d57610a1d611c67565b9050602002016020810190610a329190611ae2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6481611c93565b9150506109fe565b50505050565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161062390611c32565b601755565b6000546001600160a01b03163314610acb5760405162461bcd60e51b815260040161062390611c32565b6001600160a01b038116610b305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610c4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610d755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610dd75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610e0357506000546001600160a01b03838116911614155b156110e457601554600160a01b900460ff16610e9c576000546001600160a01b03848116911614610e9c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610eee5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3057506001600160a01b03821660009081526010602052604090205460ff16155b610f885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461100d5760175481610faa846107f6565b610fb49190611cae565b1061100d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b6000611018306107f6565b6018546016549192508210159082106110315760165491505b8080156110485750601554600160a81b900460ff16155b801561106257506015546001600160a01b03868116911614155b80156110775750601554600160b01b900460ff165b801561109c57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c157506001600160a01b03841660009081526005602052604090205460ff16155b156110e1576110cf826112e3565b4780156110df576110df47611225565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112657506001600160a01b03831660009081526005602052604090205460ff165b8061115857506015546001600160a01b0385811691161480159061115857506015546001600160a01b03848116911614155b15611165575060006111df565b6015546001600160a01b03858116911614801561119057506014546001600160a01b03848116911614155b156111a257600854600c55600954600d555b6015546001600160a01b0384811691161480156111cd57506014546001600160a01b03858116911614155b156111df57600a54600c55600b54600d555b610a6c8484848461146c565b6000818484111561120f5760405162461bcd60e51b81526004016106239190611a20565b50600061121c8486611cc6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156112c65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006112d061149a565b90506112dc83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132b5761132b611c67565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137f57600080fd5b505afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611cdd565b816001815181106113ca576113ca611c67565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b8b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611cfa565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a6c57610a6c600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611662565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611690565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a0908661172f565b6001600160a01b0389166000908152600260205260409020556115c28161178e565b6115cc84836117d8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061163e82826114bd565b8210156116595750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116835760405162461bcd60e51b81526004016106239190611a20565b50600061121c8486611d6b565b60008060008060008060008060006116ad8a600c54600d546117fc565b92509250925060006116bd61149a565b905060008060006116d08e878787611851565b919e509c509a509598509396509194505050505091939550919395565b60006112dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111eb565b60008061173c8385611cae565b9050838110156112dc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b600061179861149a565b905060006117a683836118a1565b306000908152600260205260409020549091506117c3908261172f565b30600090815260026020526040902055505050565b6006546117e590836116ed565b6006556007546117f5908261172f565b6007555050565b6000808080611816606461181089896118a1565b906114bd565b9050600061182960646118108a896118a1565b905060006118418261183b8b866116ed565b906116ed565b9992985090965090945050505050565b600080808061186088866118a1565b9050600061186e88876118a1565b9050600061187c88886118a1565b9050600061188e8261183b86866116ed565b939b939a50919850919650505050505050565b6000826118b0575060006106a9565b60006118bc8385611d8d565b9050826118c98583611d6b565b146112dc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b803561195681611936565b919050565b6000602080838503121561196e57600080fd5b823567ffffffffffffffff8082111561198657600080fd5b818501915085601f83011261199a57600080fd5b8135818111156119ac576119ac611920565b8060051b604051601f19603f830116810181811085821117156119d1576119d1611920565b6040529182528482019250838101850191888311156119ef57600080fd5b938501935b82851015611a1457611a058561194b565b845293850193928501926119f4565b98975050505050505050565b600060208083528351808285015260005b81811015611a4d57858101830151858201604001528201611a31565b81811115611a5f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8857600080fd5b8235611a9381611936565b946020939093013593505050565b600080600060608486031215611ab657600080fd5b8335611ac181611936565b92506020840135611ad181611936565b929592945050506040919091013590565b600060208284031215611af457600080fd5b81356112dc81611936565b8035801515811461195657600080fd5b600060208284031215611b2157600080fd5b6112dc82611aff565b600060208284031215611b3c57600080fd5b5035919050565b60008060008060808587031215611b5957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8a57600080fd5b833567ffffffffffffffff80821115611ba257600080fd5b818601915086601f830112611bb657600080fd5b813581811115611bc557600080fd5b8760208260051b8501011115611bda57600080fd5b602092830195509350611bf09186019050611aff565b90509250925092565b60008060408385031215611c0c57600080fd5b8235611c1781611936565b91506020830135611c2781611936565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca757611ca7611c7d565b5060010190565b60008219821115611cc157611cc1611c7d565b500190565b600082821015611cd857611cd8611c7d565b500390565b600060208284031215611cef57600080fd5b81516112dc81611936565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4a5784516001600160a01b031683529383019391830191600101611d25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da757611da7611c7d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a44d609b98bf7e6eba8dc9d98cfd826ee650b7a605abef86f958e6dc228a34364736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,902 |
0x566b8733f4348691635d83c73cc54c77e9f58da8
|
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/*
Telegram: https://t.me/babyraptordoge
*/
//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 BabyRaptorDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1 *10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Baby Raptor Doge";
string private constant _symbol = 'BRAP';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 4;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
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;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280601081526020017f4261627920526170746f7220446f676500000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d9660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123089092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf816123c8565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c3565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4252415000000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e81612547565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea0000061283190919063ffffffff16565b6128b790919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e0c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d536022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613de76025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d066023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613dbe6029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224557601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b1561224357601360179054906101000a900460ff1615612220576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221f57600080fd5b5b61222981612547565b6000479050600081111561224157612240476123c8565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122ec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f657600090505b61230284848484612901565b50505050565b60008383111582906123b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237a57808201518184015260208101905061235f565b50505050905090810190601f1680156123a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124186002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612443573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124946002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124bf573d6000803e3d6000fd5b5050565b6000600a54821115612520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d29602a913960400191505060405180910390fd5b600061252a612b58565b905061253f81846128b790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561257c57600080fd5b506040519080825280602002602001820160405280156125ab5781602001602082028036833780820191505090505b50905030816000815181106125bc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561265e57600080fd5b505afa158015612672573d6000803e3d6000fd5b505050506040513d602081101561268857600080fd5b8101908080519060200190929190505050816001815181106126a657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061270d30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127d15780820151818401526020810190506127b6565b505050509050019650505050505050600060405180830381600087803b1580156127fa57600080fd5b505af115801561280e573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561284457600090506128b1565b600082840290508284828161285557fe5b04146128ac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d756021913960400191505060405180910390fd5b809150505b92915050565b60006128f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b83565b905092915050565b8061290f5761290e612c49565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129b25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c7576129c2848484612c8c565b612b44565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a6a5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7f57612a7a848484612eec565b612b43565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b215750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b3657612b3184848461314c565b612b42565b612b41848484613441565b5b5b5b80612b5257612b5161360c565b5b50505050565b6000806000612b65613620565b91509150612b7c81836128b790919063ffffffff16565b9250505090565b60008083118290612c2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bf4578082015181840152602081019050612bd9565b50505050905090810190601f168015612c215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c3b57fe5b049050809150509392505050565b6000600c54148015612c5d57506000600d54145b15612c6757612c8a565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c9e876138cd565b955095509550955095509550612cfc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7281613a07565b612e7c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612efe876138cd565b955095509550955095509550612f5c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ff183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130d281613a07565b6130dc8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061315e876138cd565b9550955095509550955095506131bc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e683600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133c781613a07565b6133d18483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613453876138cd565b9550955095509550955095506134b186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061359281613a07565b61359c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156138825782600260006009848154811061365a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061374157508160036000600984815481106136d957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561375f57600a54683635c9adc5dea00000945094505050506138c9565b6137e8600260006009848154811061377357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461393590919063ffffffff16565b925061387360036000600984815481106137fe57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361393590919063ffffffff16565b9150808060010191505061363b565b506138a1683635c9adc5dea00000600a546128b790919063ffffffff16565b8210156138c057600a54683635c9adc5dea000009350935050506138c9565b81819350935050505b9091565b60008060008060008060008060006138ea8a600c54600d54613be6565b92509250925060006138fa612b58565b9050600080600061390d8e878787613c7c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061397783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612308565b905092915050565b6000808284019050838110156139fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a11612b58565b90506000613a28828461283190919063ffffffff16565b9050613a7c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613ba757613b6383600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613bc182600a5461393590919063ffffffff16565b600a81905550613bdc81600b5461397f90919063ffffffff16565b600b819055505050565b600080600080613c126064613c04888a61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c3c6064613c2e888b61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c6582613c57858c61393590919063ffffffff16565b61393590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c95858961283190919063ffffffff16565b90506000613cac868961283190919063ffffffff16565b90506000613cc3878961283190919063ffffffff16565b90506000613cec82613cde858761393590919063ffffffff16565b61393590919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122061ac09e6d207a6a16884698bf5401e813e4ba3c130115f679c53265bea00126f64736f6c634300060c0033
|
{"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"}]}}
| 2,903 |
0xdff9fc7506f0872e710f017e840d990465f2ab6d
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract OwnerHelper
{
address public owner;
address public manager;
event ChangeOwner(address indexed _from, address indexed _to);
event ChangeManager(address indexed _from, address indexed _to);
modifier onlyOwner
{
require(msg.sender == owner, "ERROR: Not owner");
_;
}
modifier onlyManager
{
require(msg.sender == manager, "ERROR: Not manager");
_;
}
constructor()
{
owner = msg.sender;
}
function transferOwnership(address _to) onlyOwner public
{
require(_to != owner);
require(_to != manager);
require(_to != address(0x0));
address from = owner;
owner = _to;
emit ChangeOwner(from, _to);
}
function transferManager(address _to) onlyOwner public
{
require(_to != owner);
require(_to != manager);
require(_to != address(0x0));
address from = manager;
manager = _to;
emit ChangeManager(from, _to);
}
}
abstract contract ERC20Interface
{
event Transfer( address indexed _from, address indexed _to, uint _value);
event Approval( address indexed _owner, address indexed _spender, uint _value);
function totalSupply() view virtual public returns (uint _supply);
function balanceOf( address _who ) virtual public view returns (uint _value);
function transfer( address _to, uint _value) virtual public returns (bool _success);
function approve( address _spender, uint _value ) virtual public returns (bool _success);
function allowance( address _owner, address _spender ) virtual public view returns (uint _allowance);
function transferFrom( address _from, address _to, uint _value) virtual public returns (bool _success);
}
contract Toon is ERC20Interface, OwnerHelper
{
string public name;
uint public decimals;
string public symbol;
uint constant private E18 = 1000000000000000000;
uint constant private month = 2592000;
// Total 10,000,000,000
uint constant public maxTotalSupply = 10000000000 * E18;
// Sale 1,000,000,000 (10%)
uint constant public maxSaleSupply = 1000000000 * E18;
// Marketing 2,500,000,000 (25%)
uint constant public maxMktSupply = 2500000000 * E18;
// Development 1,500,000,000 (15%)
uint constant public maxDevSupply = 1500000000 * E18;
// EcoSystem 2,500,000,000 (25%)
uint constant public maxEcoSupply = 2500000000 * E18;
// Team 1,000,000,000 (10%)
uint constant public maxTeamSupply = 1000000000 * E18;
// Advisors 500,000,000 (5%)
uint constant public maxAdvisorSupply = 500000000 * E18;
// Reserve 1,000,000,000 (10%)
uint constant public maxReserveSupply = 1000000000 * E18;
// Lock
uint constant public teamVestingSupply = 100000000 * E18;
uint constant public teamVestingLockDate = 12 * month;
uint constant public teamVestingTime = 10;
uint constant public advisorVestingSupply = 125000000 * E18;
uint constant public advisorVestingTime = 4;
uint public totalTokenSupply;
uint public tokenIssuedSale;
uint public tokenIssuedMkt;
uint public tokenIssuedDev;
uint public tokenIssuedEco;
uint public tokenIssuedTeam;
uint public tokenIssuedAdv;
uint public tokenIssuedRsv;
uint public burnTokenSupply;
mapping (address => uint) public balances;
mapping (address => mapping ( address => uint )) public approvals;
mapping (uint => uint) public tmVestingTimer;
mapping (uint => uint) public tmVestingBalances;
mapping (uint => uint) public advVestingTimer;
mapping (uint => uint) public advVestingBalances;
bool public tokenLock = true;
bool public saleTime = true;
uint public endSaleTime = 0;
event Issue(address indexed _to, uint _tokens, string _type);
event TeamIssue(address indexed _to, uint _tokens);
event Burn(address indexed _from, uint _tokens);
event TokenUnlock(address indexed _to, uint _tokens);
event EndSale(uint _date);
constructor()
{
name = "Toon";
decimals = 18;
symbol = "Toon";
totalTokenSupply = maxTotalSupply;
balances[owner] = totalTokenSupply;
tokenIssuedSale = 0;
tokenIssuedDev = 0;
tokenIssuedEco = 0;
tokenIssuedMkt = 0;
tokenIssuedRsv = 0;
tokenIssuedTeam = 0;
tokenIssuedAdv = 0;
burnTokenSupply = 0;
require(maxTeamSupply == teamVestingSupply * teamVestingTime, "ERROR: MaxTeamSupply");
require(maxAdvisorSupply == advisorVestingSupply * advisorVestingTime, "ERROR: MaxAdvisorSupply");
require(maxTotalSupply == maxSaleSupply + maxDevSupply + maxEcoSupply + maxMktSupply + maxReserveSupply + maxTeamSupply + maxAdvisorSupply, "ERROR: MaxTotalSupply");
}
function totalSupply() view override public returns (uint)
{
return totalTokenSupply;
}
function balanceOf(address _who) view override public returns (uint)
{
return balances[_who];
}
function transfer(address _to, uint _value) override public returns (bool)
{
require(isTransferable() == true);
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
function approve(address _spender, uint _value) override public returns (bool)
{
require(isTransferable() == true);
require(balances[msg.sender] >= _value);
approvals[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view override public returns (uint)
{
return approvals[_owner][_spender];
}
function transferFrom(address _from, address _to, uint _value) override public returns (bool)
{
require(isTransferable() == true);
require(balances[_from] >= _value);
require(approvals[_from][msg.sender] >= _value);
approvals[_from][msg.sender] = approvals[_from][msg.sender] - _value;
balances[_from] = balances[_from] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(_from, _to, _value);
return true;
}
function saleIssue(address _to) onlyOwner public
{
require(saleTime == true);
require(tokenIssuedSale == 0);
_transfer(msg.sender, _to, maxSaleSupply);
tokenIssuedSale = maxSaleSupply;
emit Issue(_to, maxSaleSupply, "Sale");
}
function devIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedDev == 0);
_transfer(msg.sender, _to, maxDevSupply);
tokenIssuedDev = maxDevSupply;
emit Issue(_to, maxDevSupply, "Development");
}
function ecoIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedEco == 0);
_transfer(msg.sender, _to, maxEcoSupply);
tokenIssuedEco = maxEcoSupply;
emit Issue(_to, maxEcoSupply, "Ecosystem");
}
function mktIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedMkt == 0);
_transfer(msg.sender, _to, maxMktSupply);
tokenIssuedMkt = maxMktSupply;
emit Issue(_to, maxMktSupply, "Marketing");
}
function rsvIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedRsv == 0);
_transfer(msg.sender, _to, maxReserveSupply);
tokenIssuedRsv = maxReserveSupply;
emit Issue(_to, maxReserveSupply, "Reserve");
}
function teamIssue(address _to, uint _time) onlyOwner public
{
require(saleTime == false);
require( _time < teamVestingTime);
uint nowTime = block.timestamp;
require( nowTime > tmVestingTimer[_time] );
uint tokens = teamVestingSupply;
require(tokens == tmVestingBalances[_time]);
require(maxTeamSupply >= tokenIssuedTeam + tokens);
balances[msg.sender] = balances[msg.sender] - tokens;
balances[_to] = balances[_to] + tokens;
tmVestingBalances[_time] = 0;
tokenIssuedTeam = tokenIssuedTeam + tokens;
emit TeamIssue(_to, tokens);
}
function advisorIssue(address _to, uint _time) onlyOwner public
{
require(saleTime == false, "ERROR: It's sale time");
require( _time < advisorVestingTime, "ERROR: Over vesting");
uint nowTime = block.timestamp;
require( nowTime > advVestingTimer[_time] );
uint tokens = advisorVestingSupply;
require(tokens == advVestingBalances[_time]);
require(maxAdvisorSupply >= tokenIssuedAdv + tokens);
require(balances[msg.sender] >= tokens);
balances[msg.sender] = balances[msg.sender] - tokens;
balances[_to] = balances[_to] + tokens;
advVestingBalances[_time] = 0;
tokenIssuedAdv = tokenIssuedAdv + tokens;
emit Issue(_to, tokens, "Advisor");
}
function isTransferable() private view returns (bool)
{
if(tokenLock == false)
{
return true;
}
else if(msg.sender == owner)
{
return true;
}
return false;
}
function setTokenUnlock() onlyManager public
{
require(tokenLock == true);
require(saleTime == false);
tokenLock = false;
}
function setTokenLock() onlyManager public
{
require(tokenLock == false);
tokenLock = true;
}
function endSale() onlyOwner public
{
require(saleTime == true);
require(maxSaleSupply == tokenIssuedSale);
saleTime = false;
uint nowTime = block.timestamp;
endSaleTime = nowTime;
for(uint i = 0; i < teamVestingTime; i++)
{
tmVestingTimer[i] = endSaleTime + teamVestingLockDate + (i * month);
tmVestingBalances[i] = teamVestingSupply;
}
for(uint i = 0; i < advisorVestingTime; i++)
{
advVestingTimer[i] = endSaleTime + ((i + 1) * month * 3);
advVestingBalances[i] = advisorVestingSupply;
}
emit EndSale(endSaleTime);
}
function burnToken(uint _value) onlyManager public
{
uint tokens = _value * E18;
require(balances[msg.sender] >= tokens);
balances[msg.sender] = balances[msg.sender] - tokens;
burnTokenSupply = burnTokenSupply + tokens;
totalTokenSupply = totalTokenSupply - tokens;
emit Burn(msg.sender, tokens);
}
function close() onlyOwner public
{
selfdestruct(payable(msg.sender));
}
function _transfer(address _from, address _to, uint _value) internal
{
require(balances[_from] >= _value);
balances[_from] = balances[_from] - _value;
balances[_to] = balances[_to] + _value;
}
}
|
0x608060405234801561001057600080fd5b50600436106103785760003560e01c806370a08231116101d3578063b35c721811610104578063de85a4a9116100a2578063f1f5cfa41161007c578063f1f5cfa414610628578063f2fde38b14610630578063fcdd04bf14610643578063fe3a5abe1461059157610378565b8063de85a4a914610610578063dfcfe4df14610618578063e718234d1461062057610378565b8063cfa15bcd116100de578063cfa15bcd146105e2578063cffb47cf146104c7578063dd62ed3e146105ea578063de272835146105fd57610378565b8063b35c7218146105b4578063b40433cd146105bc578063ba0e930a146105cf57610378565b806395d89b4111610171578063a43814501161014b578063a438145014610591578063a711b66414610599578063a9059cbb146105a1578063b29418d5146104c757610378565b806395d89b411461056e57806398d9eea014610576578063a32ce11e1461057e57610378565b806384300859116101ad578063843008591461054e5780638a4192b5146105565780638da5cb5b1461055e5780638ece19f61461056657610378565b806370a082311461052057806375d0281d146105335780637b47ec1a1461053b57610378565b80632d94e929116102ad5780634b2596c71161024b57806358371ccd1161022557806358371ccd146104ea5780635c3eee8d146104f25780636298124b146105055780636f7fc9891461050d57610378565b80634b2596c7146104c75780634bea6a0f146104cf5780634fb2cebe146104e257610378565b8063380d831b11610287578063380d831b1461048f5780633da83adb1461049757806343d726d6146104aa578063481c6a75146104b257610378565b80632d94e9291461046c5780632f26927f1461047f578063313ce5671461048757610378565b8063206bc0a01161031a57806324054d57116102f457806324054d571461042b57806327e235e31461043e57806328b238ff146104515780632ab4d0521461046457610378565b8063206bc0a01461040857806322b0aa471461041057806323b872dd1461041857610378565b8063145ca08811610356578063145ca088146103d05780631596facb146103e357806318160ddd146103eb5780631ca8b6cb1461040057610378565b806306fdde031461037d578063095ea7b31461039b57806309a74aff146103bb575b600080fd5b61038561064b565b60405161039291906119a4565b60405180910390f35b6103ae6103a9366004611944565b6106d9565b6040516103929190611999565b6103ce6103c93660046118b6565b610778565b005b6103ce6103de3660046118b6565b61084d565b6103ae610909565b6103f3610917565b6040516103929190611aa9565b6103f361091e565b6103f3610924565b6103f361092a565b6103ae610426366004611909565b610930565b6103f361043936600461196d565b610a9c565b6103f361044c3660046118b6565b610aae565b6103f361045f36600461196d565b610ac0565b6103f3610ad2565b6103ce61047a3660046118b6565b610aec565b6103f3610ba8565b6103f3610bae565b6103ce610bb4565b6103ce6104a53660046118b6565b610d71565b6103ce610e32565b6104ba610e5f565b6040516103929190611985565b6103f3610e6e565b6103f36104dd36600461196d565b610e84565b6103f3610e96565b6103f3610e9c565b6103ce6105003660046118b6565b610ea2565b6103f3610f5e565b6103ce61051b366004611944565b610f63565b6103f361052e3660046118b6565b6110fb565b6103f361111a565b6103ce61054936600461196d565b611130565b6103ce611218565b6103f3611277565b6104ba61127d565b6103ce61128c565b6103856112d5565b6103f36112e2565b6103f361058c3660046118d7565b6112f8565b6103f3611315565b6103f361132b565b6103ae6105af366004611944565b611341565b6103f361140c565b6103f36105ca36600461196d565b611411565b6103ce6105dd3660046118b6565b611423565b6103f36114e8565b6103f36105f83660046118d7565b6114ee565b6103ce61060b366004611944565b611519565b6103f36116d3565b6103f36116d9565b6103ae6116ef565b6103f36116f8565b6103ce61063e3660046118b6565b611706565b6103f36117c9565b6002805461065890611bf5565b80601f016020809104026020016040519081016040528092919081815260200182805461068490611bf5565b80156106d15780601f106106a6576101008083540402835291602001916106d1565b820191906000526020600020905b8154815290600101906020018083116106b457829003601f168201915b505050505081565b60006106e36117cf565b15156001146106f157600080fd5b336000908152600e602052604090205482111561070d57600080fd5b336000818152600f602090815260408083206001600160a01b03881680855292529182902085905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610767908690611aa9565b60405180910390a350600192915050565b6000546001600160a01b031633146107ab5760405162461bcd60e51b81526004016107a290611a26565b60405180910390fd5b601454610100900460ff16156107c057600080fd5b600954156107cd57600080fd5b6107ed33826107e8670de0b6b3a7640000639502f900611bbf565b611805565b610803670de0b6b3a7640000639502f900611bbf565b6009556001600160a01b038116600080516020611c62833981519152610835670de0b6b3a7640000639502f900611bbf565b6040516108429190611adc565b60405180910390a250565b6000546001600160a01b031633146108775760405162461bcd60e51b81526004016107a290611a26565b601454610100900460ff161561088c57600080fd5b6007541561089957600080fd5b6108b433826107e8670de0b6b3a7640000639502f900611bbf565b6108ca670de0b6b3a7640000639502f900611bbf565b6007556001600160a01b038116600080516020611c628339815191526108fc670de0b6b3a7640000639502f900611bbf565b6040516108429190611ab2565b601454610100900460ff1681565b6005545b90565b60055481565b60065481565b600d5481565b600061093a6117cf565b151560011461094857600080fd5b6001600160a01b0384166000908152600e602052604090205482111561096d57600080fd5b6001600160a01b0384166000908152600f6020908152604080832033845290915290205482111561099d57600080fd5b6001600160a01b0384166000908152600f602090815260408083203384529091529020546109cc908390611bde565b6001600160a01b0385166000818152600f60209081526040808320338452825280832094909455918152600e9091522054610a08908390611bde565b6001600160a01b038086166000908152600e60205260408082209390935590851681522054610a38908390611ba7565b6001600160a01b038085166000818152600e602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a8a908690611aa9565b60405180910390a35060019392505050565b60126020526000908152604090205481565b600e6020526000908152604090205481565b60106020526000908152604090205481565b610ae9670de0b6b3a76400006402540be400611bbf565b81565b6000546001600160a01b03163314610b165760405162461bcd60e51b81526004016107a290611a26565b601454610100900460ff1615610b2b57600080fd5b600c5415610b3857600080fd5b610b5333826107e8670de0b6b3a7640000633b9aca00611bbf565b610b69670de0b6b3a7640000633b9aca00611bbf565b600c556001600160a01b038116600080516020611c62833981519152610b9b670de0b6b3a7640000633b9aca00611bbf565b6040516108429190611b7f565b60095481565b60035481565b6000546001600160a01b03163314610bde5760405162461bcd60e51b81526004016107a290611a26565b60145460ff610100909104161515600114610bf857600080fd5b600654610c11670de0b6b3a7640000633b9aca00611bbf565b14610c1b57600080fd5b6014805461ff001916905542601581905560005b600a811015610cb057610c4562278d0082611bbf565b610c5362278d00600c611bbf565b601554610c609190611ba7565b610c6a9190611ba7565b600082815260106020526040902055610c8f670de0b6b3a76400006305f5e100611bbf565b60008281526011602052604090205580610ca881611c30565b915050610c2f565b5060005b6004811015610d345762278d00610ccc826001611ba7565b610cd69190611bbf565b610ce1906003611bbf565b601554610cee9190611ba7565b600082815260126020526040902055610d13670de0b6b3a76400006307735940611bbf565b60008281526013602052604090205580610d2c81611c30565b915050610cb4565b507f94173af9e1cd5351395663e6a7838552ea54f5233d0c38bc46de5f4915b302bf601554604051610d669190611aa9565b60405180910390a150565b6000546001600160a01b03163314610d9b5760405162461bcd60e51b81526004016107a290611a26565b60145460ff610100909104161515600114610db557600080fd5b60065415610dc257600080fd5b610ddd33826107e8670de0b6b3a7640000633b9aca00611bbf565b610df3670de0b6b3a7640000633b9aca00611bbf565b6006556001600160a01b038116600080516020611c62833981519152610e25670de0b6b3a7640000633b9aca00611bbf565b6040516108429190611b06565b6000546001600160a01b03163314610e5c5760405162461bcd60e51b81526004016107a290611a26565b33ff5b6001546001600160a01b031681565b610ae9670de0b6b3a7640000633b9aca00611bbf565b60136020526000908152604090205481565b600c5481565b60155481565b6000546001600160a01b03163314610ecc5760405162461bcd60e51b81526004016107a290611a26565b601454610100900460ff1615610ee157600080fd5b60085415610eee57600080fd5b610f0933826107e8670de0b6b3a76400006359682f00611bbf565b610f1f670de0b6b3a76400006359682f00611bbf565b6008556001600160a01b038116600080516020611c62833981519152610f51670de0b6b3a76400006359682f00611bbf565b6040516108429190611b53565b600481565b6000546001600160a01b03163314610f8d5760405162461bcd60e51b81526004016107a290611a26565b601454610100900460ff1615610fa257600080fd5b600a8110610faf57600080fd5b60008181526010602052604090205442908111610fcb57600080fd5b6000610fe3670de0b6b3a76400006305f5e100611bbf565b600084815260116020526040902054909150811461100057600080fd5b80600a5461100e9190611ba7565b611024670de0b6b3a7640000633b9aca00611bbf565b101561102f57600080fd5b336000908152600e602052604090205461104a908290611bde565b336000908152600e6020526040808220929092556001600160a01b03861681522054611077908290611ba7565b6001600160a01b0385166000908152600e60209081526040808320939093558582526011905290812055600a546110af908290611ba7565b600a556040516001600160a01b038516907fb07ce9bd9a0d0e9adec838711c53cbe1430a690e9c520e9232dc9478dbd85f31906110ed908490611aa9565b60405180910390a250505050565b6001600160a01b0381166000908152600e60205260409020545b919050565b610ae9670de0b6b3a76400006305f5e100611bbf565b6001546001600160a01b0316331461115a5760405162461bcd60e51b81526004016107a290611a7d565b600061116e670de0b6b3a764000083611bbf565b336000908152600e602052604090205490915081111561118d57600080fd5b336000908152600e60205260409020546111a8908290611bde565b336000908152600e6020526040902055600d546111c6908290611ba7565b600d556005546111d7908290611bde565b60055560405133907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59061120c908490611aa9565b60405180910390a25050565b6001546001600160a01b031633146112425760405162461bcd60e51b81526004016107a290611a7d565b60145460ff16151560011461125657600080fd5b601454610100900460ff161561126b57600080fd5b6014805460ff19169055565b60085481565b6000546001600160a01b031681565b6001546001600160a01b031633146112b65760405162461bcd60e51b81526004016107a290611a7d565b60145460ff16156112c657600080fd5b6014805460ff19166001179055565b6004805461065890611bf5565b610ae9670de0b6b3a76400006359682f00611bbf565b600f60209081526000928352604080842090915290825290205481565b610ae9670de0b6b3a7640000639502f900611bbf565b610ae9670de0b6b3a7640000631dcd6500611bbf565b600061134b6117cf565b151560011461135957600080fd5b336000908152600e602052604090205482111561137557600080fd5b336000908152600e6020526040902054611390908390611bde565b336000908152600e6020526040808220929092556001600160a01b038516815220546113bd908390611ba7565b6001600160a01b0384166000818152600e60205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610767908690611aa9565b600a81565b60116020526000908152604090205481565b6000546001600160a01b0316331461144d5760405162461bcd60e51b81526004016107a290611a26565b6000546001600160a01b038281169116141561146857600080fd5b6001546001600160a01b038281169116141561148357600080fd5b6001600160a01b03811661149657600080fd5b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f034ab062c9c6c8ddd60650a40372b1d413588174682d4ca1a4e53aa37589ab2d90600090a35050565b600a5481565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205490565b6000546001600160a01b031633146115435760405162461bcd60e51b81526004016107a290611a26565b601454610100900460ff161561156b5760405162461bcd60e51b81526004016107a2906119f7565b6004811061158b5760405162461bcd60e51b81526004016107a290611a50565b600081815260126020526040902054429081116115a757600080fd5b60006115bf670de0b6b3a76400006307735940611bbf565b60008481526013602052604090205490915081146115dc57600080fd5b80600b546115ea9190611ba7565b611600670de0b6b3a7640000631dcd6500611bbf565b101561160b57600080fd5b336000908152600e602052604090205481111561162757600080fd5b336000908152600e6020526040902054611642908290611bde565b336000908152600e6020526040808220929092556001600160a01b0386168152205461166f908290611ba7565b6001600160a01b0385166000908152600e60209081526040808320939093558582526013905290812055600b546116a7908290611ba7565b600b556040516001600160a01b03851690600080516020611c62833981519152906110ed908490611b2b565b60075481565b610ae9670de0b6b3a76400006307735940611bbf565b60145460ff1681565b610ae962278d00600c611bbf565b6000546001600160a01b031633146117305760405162461bcd60e51b81526004016107a290611a26565b6000546001600160a01b038281169116141561174b57600080fd5b6001546001600160a01b038281169116141561176657600080fd5b6001600160a01b03811661177957600080fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f9aecf86140d81442289f667eb72e1202a8fbb3478a686659952e145e853196569190a35050565b600b5481565b60145460009060ff166117e45750600161091b565b6000546001600160a01b03163314156117ff5750600161091b565b50600090565b6001600160a01b0383166000908152600e602052604090205481111561182a57600080fd5b6001600160a01b0383166000908152600e602052604090205461184e908290611bde565b6001600160a01b038085166000908152600e6020526040808220939093559084168152205461187e908290611ba7565b6001600160a01b039092166000908152600e60205260409020919091555050565b80356001600160a01b038116811461111557600080fd5b6000602082840312156118c7578081fd5b6118d08261189f565b9392505050565b600080604083850312156118e9578081fd5b6118f28361189f565b91506119006020840161189f565b90509250929050565b60008060006060848603121561191d578081fd5b6119268461189f565b92506119346020850161189f565b9150604084013590509250925092565b60008060408385031215611956578182fd5b61195f8361189f565b946020939093013593505050565b60006020828403121561197e578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b818110156119d0578581018301518582016040015282016119b4565b818111156119e15783604083870101525b50601f01601f1916929092016040019392505050565b6020808252601590820152744552524f523a20497427732073616c652074696d6560581b604082015260600190565b60208082526010908201526f22a92927a91d102737ba1037bbb732b960811b604082015260600190565b6020808252601390820152724552524f523a204f7665722076657374696e6760681b604082015260600190565b60208082526012908201527122a92927a91d102737ba1036b0b730b3b2b960711b604082015260600190565b90815260200190565b908152604060208201819052600990820152684d61726b6574696e6760b81b606082015260800190565b9081526040602082018190526009908201526845636f73797374656d60b81b606082015260800190565b9081526040602082018190526004908201526353616c6560e01b606082015260800190565b9081526040602082018190526007908201526620b23b34b9b7b960c91b606082015260800190565b908152604060208201819052600b908201526a11195d995b1bdc1b595b9d60aa1b606082015260800190565b908152604060208201819052600790820152665265736572766560c81b606082015260800190565b60008219821115611bba57611bba611c4b565b500190565b6000816000190483118215151615611bd957611bd9611c4b565b500290565b600082821015611bf057611bf0611c4b565b500390565b600281046001821680611c0957607f821691505b60208210811415611c2a57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611c4457611c44611c4b565b5060010190565b634e487b7160e01b600052601160045260246000fdfe9a27b65b834a85153a0161940629613dcded325ecd78845ba99e2ec15d53b77ba2646970667358221220ad4af1013b7f0acd2666f35db5c3cc2845f1ae92b5b70a767638daa2c6f877bf64736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 2,904 |
0x1a057180e7d092427289d9dd22bc6afb2188a9b8
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
}
}
/**
* @title BERT CLUB COIN
*/
contract BERTCLUBCOIN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "BERT CLUB COIN";
string public symbol = "BCC";
uint8 public decimals = 18;
uint256 public totalSupply = 8e9 * 1e18;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
function BERTCLUBCOIN() public {
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
FrozenFunds(targets[j], isFrozen);
}
}
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
function mathTransfer(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e18);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function mathTransfer(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e18);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e18);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) owner.transfer(msg.value);
balanceOf[owner] = balanceOf[owner].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6060604052600436106101455763ffffffff60e060020a60003504166305d2035b811461014f57806306fdde0314610176578063095ea7b31461020057806312d6468d1461022257806318160ddd146102b157806323b872dd146102d6578063313ce567146102fe57806340c10f19146103275780634f25eced1461034957806364ddc6051461035c57806370a08231146103eb5780637d64bcb41461040a5780638da5cb5b1461041d57806395d89b411461044c5780639dc29fac1461045f578063a8f11eb914610145578063a9059cbb14610481578063b414d4b6146104a3578063be45fd62146104c2578063c341b9f614610527578063cbbe974b1461057a578063d39b1d4814610599578063dd62ed3e146105af578063dde0d085146105d4578063f0dc417114610625578063f2fde38b146106b4578063f6368f8a146106d3575b61014d61077a565b005b341561015a57600080fd5b6101626108ef565b604051901515815260200160405180910390f35b341561018157600080fd5b6101896108f8565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101c55780820151838201526020016101ad565b50505050905090810190601f1680156101f25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020b57600080fd5b610162600160a060020a03600435166024356109a0565b341561022d57600080fd5b610162600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610a0c95505050505050565b34156102bc57600080fd5b6102c4610d3f565b60405190815260200160405180910390f35b34156102e157600080fd5b610162600160a060020a0360043581169060243516604435610d45565b341561030957600080fd5b610311610f54565b60405160ff909116815260200160405180910390f35b341561033257600080fd5b610162600160a060020a0360043516602435610f5d565b341561035457600080fd5b6102c461105f565b341561036757600080fd5b61014d60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061106595505050505050565b34156103f657600080fd5b6102c4600160a060020a03600435166111bf565b341561041557600080fd5b6101626111da565b341561042857600080fd5b610430611247565b604051600160a060020a03909116815260200160405180910390f35b341561045757600080fd5b610189611256565b341561046a57600080fd5b61014d600160a060020a03600435166024356112c9565b341561048c57600080fd5b610162600160a060020a03600435166024356113b1565b34156104ae57600080fd5b610162600160a060020a036004351661148c565b34156104cd57600080fd5b61016260048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506114a195505050505050565b341561053257600080fd5b61014d600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050505091351515915061156c9050565b341561058557600080fd5b6102c4600160a060020a036004351661166e565b34156105a457600080fd5b61014d600435611680565b34156105ba57600080fd5b6102c4600160a060020a03600435811690602435166116a0565b34156105df57600080fd5b610162600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050933593506116cb92505050565b341561063057600080fd5b6101626004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506118e095505050505050565b34156106bf57600080fd5b61014d600160a060020a0360043516611bb2565b34156106de57600080fd5b61016260048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611c4d95505050505050565b60006006541180156107a85750600654600154600160a060020a031660009081526008602052604090205410155b80156107cd5750600160a060020a0333166000908152600a602052604090205460ff16155b80156107f05750600160a060020a0333166000908152600b602052604090205442115b15156107fb57600080fd5b600034111561083857600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561083857600080fd5b600654600154600160a060020a03166000908152600860205260409020546108659163ffffffff611fa516565b600154600160a060020a039081166000908152600860205260408082209390935560065433909216815291909120546108a39163ffffffff611fb716565b600160a060020a03338116600081815260086020526040908190209390935560015460065491939216916000805160206123f283398151915291905190815260200160405180910390a3565b60075460ff1681565b6109006123df565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109965780601f1061096b57610100808354040283529160200191610996565b820191906000526020600020905b81548152906001019060200180831161097957829003601f168201915b5050505050905090565b600160a060020a03338116600081815260096020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000806000808551118015610a22575083518551145b8015610a475750600160a060020a0333166000908152600a602052604090205460ff16155b8015610a6a5750600160a060020a0333166000908152600b602052604090205442115b1515610a7557600080fd5b5060009050805b8451811015610bcb576000848281518110610a9357fe5b90602001906020020151118015610ac75750848181518110610ab157fe5b90602001906020020151600160a060020a031615155b8015610b075750600a6000868381518110610ade57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015610b4c5750600b6000868381518110610b1e57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610b5757600080fd5b610b85670de0b6b3a7640000858381518110610b6f57fe5b906020019060200201519063ffffffff611fc616565b848281518110610b9157fe5b60209081029091010152610bc1848281518110610baa57fe5b90602001906020020151839063ffffffff611fb716565b9150600101610a7c565b600160a060020a03331660009081526008602052604090205482901015610bf157600080fd5b5060005b8451811015610cf257610c57848281518110610c0d57fe5b9060200190602002015160086000888581518110610c2757fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff611fb716565b60086000878481518110610c6757fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610c9757fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206123f2833981519152868481518110610ccf57fe5b9060200190602002015160405190815260200160405180910390a3600101610bf5565b600160a060020a033316600090815260086020526040902054610d1b908363ffffffff611fa516565b33600160a060020a0316600090815260086020526040902055506001949350505050565b60055490565b6000600160a060020a03831615801590610d5f5750600082115b8015610d845750600160a060020a038416600090815260086020526040902054829010155b8015610db75750600160a060020a0380851660009081526009602090815260408083203390941683529290522054829010155b8015610ddc5750600160a060020a0384166000908152600a602052604090205460ff16155b8015610e015750600160a060020a0383166000908152600a602052604090205460ff16155b8015610e245750600160a060020a0384166000908152600b602052604090205442115b8015610e475750600160a060020a0383166000908152600b602052604090205442115b1515610e5257600080fd5b600160a060020a038416600090815260086020526040902054610e7b908363ffffffff611fa516565b600160a060020a038086166000908152600860205260408082209390935590851681522054610eb0908363ffffffff611fb716565b600160a060020a03808516600090815260086020908152604080832094909455878316825260098152838220339093168252919091522054610ef8908363ffffffff611fa516565b600160a060020a03808616600081815260096020908152604080832033861684529091529081902093909355908516916000805160206123f28339815191529085905190815260200160405180910390a35060015b9392505050565b60045460ff1690565b60015460009033600160a060020a03908116911614610f7b57600080fd5b60075460ff1615610f8b57600080fd5b60008211610f9857600080fd5b600554610fab908363ffffffff611fb716565b600555600160a060020a038316600090815260086020526040902054610fd7908363ffffffff611fb716565b600160a060020a0384166000818152600860205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660006000805160206123f28339815191528460405190815260200160405180910390a350600192915050565b60065481565b60015460009033600160a060020a0390811691161461108357600080fd5b60008351118015611095575081518351145b15156110a057600080fd5b5060005b82518110156111ba578181815181106110b957fe5b90602001906020020151600b60008584815181106110d357fe5b90602001906020020151600160a060020a031681526020810191909152604001600020541061110157600080fd5b81818151811061110d57fe5b90602001906020020151600b600085848151811061112757fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205582818151811061115757fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c157783838151811061119757fe5b9060200190602002015160405190815260200160405180910390a26001016110a4565b505050565b600160a060020a031660009081526008602052604090205490565b60015460009033600160a060020a039081169116146111f857600080fd5b60075460ff161561120857600080fd5b6007805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b61125e6123df565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109965780601f1061096b57610100808354040283529160200191610996565b60015433600160a060020a039081169116146112e457600080fd5b60008111801561130d5750600160a060020a038216600090815260086020526040902054819010155b151561131857600080fd5b600160a060020a038216600090815260086020526040902054611341908263ffffffff611fa516565b600160a060020a03831660009081526008602052604090205560055461136d908263ffffffff611fa516565b600555600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b60006113bb6123df565b6000831180156113e45750600160a060020a0333166000908152600a602052604090205460ff16155b80156114095750600160a060020a0384166000908152600a602052604090205460ff16155b801561142c5750600160a060020a0333166000908152600b602052604090205442115b801561144f5750600160a060020a0384166000908152600b602052604090205442115b151561145a57600080fd5b61146384611ff1565b1561147a57611473848483611ff9565b9150611485565b61147384848361225c565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156114cb5750600160a060020a0333166000908152600a602052604090205460ff16155b80156114f05750600160a060020a0384166000908152600a602052604090205460ff16155b80156115135750600160a060020a0333166000908152600b602052604090205442115b80156115365750600160a060020a0384166000908152600b602052604090205442115b151561154157600080fd5b61154a84611ff1565b156115615761155a848484611ff9565b9050610f4d565b61155a84848461225c565b60015460009033600160a060020a0390811691161461158a57600080fd5b600083511161159857600080fd5b5060005b82518110156111ba578281815181106115b157fe5b90602001906020020151600160a060020a031615156115cf57600080fd5b81600a60008584815181106115e057fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff191691151591909117905582818151811061161e57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161159c565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461169b57600080fd5b600655565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b600080600080841180156116e0575060008551115b80156117055750600160a060020a0333166000908152600a602052604090205460ff16155b80156117285750600160a060020a0333166000908152600b602052604090205442115b151561173357600080fd5b61174b84670de0b6b3a764000063ffffffff611fc616565b935061175f8551859063ffffffff611fc616565b600160a060020a0333166000908152600860205260409020549092508290101561178857600080fd5b5060005b8451811015610cf2578481815181106117a157fe5b90602001906020020151600160a060020a0316158015906117f65750600a60008683815181106117cd57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b801561183b5750600b600086838151811061180d57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561184657600080fd5b61185a8460086000888581518110610c2757fe5b6008600087848151811061186a57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205584818151811061189a57fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206123f28339815191528660405190815260200160405180910390a360010161178c565b6001546000908190819033600160a060020a0390811691161461190257600080fd5b60008551118015611914575083518551145b151561191f57600080fd5b5060009050805b8451811015611b8957600084828151811061193d57fe5b90602001906020020151118015611971575084818151811061195b57fe5b90602001906020020151600160a060020a031615155b80156119b15750600a600086838151811061198857fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156119f65750600b60008683815181106119c857fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515611a0157600080fd5b611a19670de0b6b3a7640000858381518110610b6f57fe5b848281518110611a2557fe5b60209081029091010152838181518110611a3b57fe5b9060200190602002015160086000878481518110611a5557fe5b90602001906020020151600160a060020a031681526020810191909152604001600020541015611a8457600080fd5b611add848281518110611a9357fe5b9060200190602002015160086000888581518110611aad57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff611fa516565b60086000878481518110611aed57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055611b20848281518110610baa57fe5b915033600160a060020a0316858281518110611b3857fe5b90602001906020020151600160a060020a03166000805160206123f2833981519152868481518110611b6657fe5b9060200190602002015160405190815260200160405180910390a3600101611926565b600160a060020a033316600090815260086020526040902054610d1b908363ffffffff611fb716565b60015433600160a060020a03908116911614611bcd57600080fd5b600160a060020a0381161515611be257600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611c775750600160a060020a0333166000908152600a602052604090205460ff16155b8015611c9c5750600160a060020a0385166000908152600a602052604090205460ff16155b8015611cbf5750600160a060020a0333166000908152600b602052604090205442115b8015611ce25750600160a060020a0385166000908152600b602052604090205442115b1515611ced57600080fd5b611cf685611ff1565b15611f8f57600160a060020a03331660009081526008602052604090205484901015611d2157600080fd5b600160a060020a033316600090815260086020526040902054611d4a908563ffffffff611fa516565b600160a060020a033381166000908152600860205260408082209390935590871681522054611d7f908563ffffffff611fb716565b600160a060020a0386166000818152600860205260408082209390935590918490518082805190602001908083835b60208310611dcd5780518252601f199092019160209182019101611dae565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611e5e578082015183820152602001611e46565b50505050905090810190601f168015611e8b5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f193505050501515611eaf57fe5b826040518082805190602001908083835b60208310611edf5780518252601f199092019160209182019101611ec0565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a03166000805160206123f28339815191528660405190815260200160405180910390a3506001611f9d565b611f9a85858561225c565b90505b949350505050565b600082821115611fb157fe5b50900390565b600082820183811015610f4d57fe5b600080831515611fd95760009150611485565b50828202828482811515611fe957fe5b0414610f4d57fe5b6000903b1190565b600160a060020a03331660009081526008602052604081205481908490101561202157600080fd5b600160a060020a03331660009081526008602052604090205461204a908563ffffffff611fa516565b600160a060020a03338116600090815260086020526040808220939093559087168152205461207f908563ffffffff611fb716565b600160a060020a03861660008181526008602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612118578082015183820152602001612100565b50505050905090810190601f1680156121455780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b151561216557600080fd5b6102c65a03f1151561217657600080fd5b505050826040518082805190602001908083835b602083106121a95780518252601f19909201916020918201910161218a565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a03166000805160206123f28339815191528660405190815260200160405180910390a3506001949350505050565b600160a060020a0333166000908152600860205260408120548390101561228257600080fd5b600160a060020a0333166000908152600860205260409020546122ab908463ffffffff611fa516565b600160a060020a0333811660009081526008602052604080822093909355908616815220546122e0908463ffffffff611fb716565b600160a060020a03851660009081526008602052604090819020919091558290518082805190602001908083835b6020831061232d5780518252601f19909201916020918201910161230e565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a03166000805160206123f28339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058203810fb7fe1099a429d2e6879ac66a7c25d82d2ca919bc3dd11f523fa6d8db39d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,905 |
0x4bdaf2307b3fd88c56471f574a50531cef89b3a6
|
/**
*Submitted for verification at Etherscan.io on 2021-10-30
*/
/*
Chihiro is the main character from the anime that become Japan’s highest-
grossing film of all-time for 19 years straight. Now, Chihiro Inu will be
here in ETH block chain and keep developing as Anime tokens for many decades to come.
Website: https://chihiro-inu.com/
Twitter: https://twitter.com/ChihiroInuETH
Telegram Group: https://t.me/ChihiroInuETHu̶ I̶n̶u̶🔥̶
*/
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 Chihiro 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 = ' Chihiro Inu ';
string private _symbol = 'CHIRO';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220774f0ccb2c21de610f5d958e32b64a24cd773c3088dbcbd62abf0ab562bcfa4c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,906 |
0xd762afd1b1f28b8f211b8b72ce1001965107d0ce
|
// File: contracts/Utils/SafeMath.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
/**
* @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;
}
}
// File: contracts/Gov/GovFunding.sol
contract GovFunding {
using SafeMath for uint256;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice The name of this contract
string public constant name = "Governance Funding";
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
uint256 public quorumVotes;
/// @notice The number of votes required in order for a voter to be able to vote
uint256 public voteRequirement;
/// @notice The duration of voting on a proposal, in blocks
uint256 public votingPeriod;
/// @notice The address of the Voice Gov Coordinator
address public voiceGov;
/// @notice The address of the Mute token
IMuteContract public mute;
/// @notice The total number of proposals
uint256 public proposalCount;
struct Proposal {
/// @notice Unique id for looking up a proposal
uint256 id;
/// @notice Creator of the proposal
address proposer;
/// @notice The target to execute the proposal data
address target;
/// @notice The ordered list of calldata to be passed to each call
bytes data;
/// @notice The block at which voting begins: holders must delegate their votes prior to this block
uint256 startBlock;
/// @notice The block at which voting ends: votes must be cast prior to this block
uint256 endBlock;
/// @notice Current number of votes in favor of this proposal
uint256 forVotes;
/// @notice Current number of votes in opposition to this proposal
uint256 againstVotes;
/// @notice Flag marking whether the proposal has been executed
bool executed;
/// @notice Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
/// @notice Ballot receipt record for a voter
struct Receipt {
/// @notice Whether or not a vote has been cast
bool hasVoted;
/// @notice Whether or not the voter supports the proposal
bool support;
/// @notice The number of votes the voter had, which were cast
uint96 votes;
}
/// @notice Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Defeated,
Succeeded,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint256 => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint256 id, address proposer, address target, bytes data, uint256 startBlock, uint256 endBlock, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint256 proposalId, bool support, uint256 votes);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint256 id);
event ChangeQuorumVotes(uint256 _quorumVotes);
event ChangeVotingPeriod(uint256 _votingPeriod);
event ChangeVoteRequirement(uint256 _voteRequirement);
constructor(address _voiceGov, address _mute, uint256 _votingPeriod) public {
quorumVotes = 4000000e18; // 4,000,000 mute (~15% of circ)
voteRequirement = 40000e18; // 40,000 mute
votingPeriod = _votingPeriod;// 17280 ~3 days in blocks (assuming 15s blocks)
voiceGov = _voiceGov;
mute = IMuteContract(_mute);
}
// should only be called by itself, only proposals created by MUTE holders
function changeQuorumVotes(uint256 _quorumVotes) public {
require(msg.sender == address(this), "GovFunding::changeQuorumVotes: caller is not this contract");
quorumVotes = _quorumVotes;
emit ChangeQuorumVotes(_quorumVotes);
}
// should only be called by itself, only proposals created by MUTE holders
function changeVotingPeriod(uint256 _votingPeriod) public {
require(msg.sender == address(this), "GovFunding::changeVotingPeriod: caller is not this contract");
votingPeriod = _votingPeriod;
emit ChangeVotingPeriod(_votingPeriod);
}
// should only be called by itself, only proposals created by MUTE holders
function changeVoteRequirement(uint256 _voteRequirement) public {
require(msg.sender == address(this), "GovFunding::changeVoteRequirement: caller is not this contract");
voteRequirement = _voteRequirement;
emit ChangeVoteRequirement(_voteRequirement);
}
function propose(address target, bytes memory data, string memory description) public returns (uint) {
if(target != address(this)){
// not an internal target, only allow the govcoord contract
require(msg.sender == voiceGov, "GovFunding::propose: only voice gov can propose");
} else {
// allow mute holders to change votingPeriod / quorumvotes / voteRequirement
require(mute.getPriorVotes(msg.sender, block.number.sub(1)) > voteRequirement, "GovFunding::propose: proposer votes below proposal threshold");
}
uint256 latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "GovFunding::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "GovFunding::propose: one live proposal per proposer, found an already pending proposal");
}
uint256 startBlock = block.number.add(1);
uint256 endBlock = startBlock.add(votingPeriod);
proposalCount++;
Proposal memory newProposal = Proposal({
id: proposalCount,
proposer: msg.sender,
target: target,
data: data,
startBlock: startBlock,
endBlock: endBlock,
forVotes: 0,
againstVotes: 0,
executed: false
});
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, target, data, startBlock, endBlock, description);
return newProposal.id;
}
function execute(uint256 proposalId) public payable {
require(state(proposalId) == ProposalState.Succeeded, "GovFunding::execute: proposal can only be succeeded to execute");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
(bool result, ) = address(proposal.target).call(proposal.data);
require(result, "GovFunding::execute: transaction Failed");
// return any eth in this contract
if(address(this).balance > 0){
address payable _sender = msg.sender;
_sender.transfer(address(this).balance);
}
emit ProposalExecuted(proposalId);
}
function getAction(uint256 proposalId) public view returns (bytes memory data) {
Proposal storage p = proposals[proposalId];
return p.data;
}
function getReceipt(uint256 proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint256 proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "GovFunding::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= proposal.endBlock) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes.add(proposal.againstVotes) < quorumVotes) {
return ProposalState.Defeated;
} else if (!proposal.executed) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else {
return ProposalState.Expired;
}
}
function castVote(uint256 proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint256 proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GovFunding::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint256 proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "GovFunding::_castVote: voting is closed");
require(mute.getPriorVotes(voter, block.number.sub(1)) > voteRequirement, "GovFunding::propose: proposer votes below voter threshold");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(!receipt.hasVoted, "GovFunding::_castVote: voter already voted");
uint96 votes = mute.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = proposal.forVotes.add(votes);
} else {
proposal.againstVotes = proposal.againstVotes.add(votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface IMuteContract {
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint96);
}
|
0x60806040526004361061012a5760003560e01c80634634c61f116100ab578063b6e768731161006f578063b6e76873146103fc578063da35c66414610439578063deaaa7cc14610464578063e23a9a521461048f578063f5dc4106146104cc578063fe0d94c1146104f55761012a565b80634634c61f1461032b5780634997bc51146103545780635832cf591461037f5780638eabf03c146103a8578063a8f0a82e146103d35761012a565b80631d1c4aea116100f25780631d1c4aea1461023057806320606b701461025b57806324bc1a64146102865780633153fedb146102b15780633e4f49e6146102ee5761012a565b8063013cf08b1461012f57806302a251a31461017457806306fdde031461019f57806315373e3d146101ca57806317977c61146101f3575b600080fd5b34801561013b57600080fd5b5061015660048036038101906101519190611d77565b610511565b60405161016b99989796959493929190612bff565b60405180910390f35b34801561018057600080fd5b50610189610644565b6040516101969190612b67565b60405180910390f35b3480156101ab57600080fd5b506101b461064a565b6040516101c1919061294a565b60405180910390f35b3480156101d657600080fd5b506101f160048036038101906101ec9190611ddc565b610683565b005b3480156101ff57600080fd5b5061021a60048036038101906102159190611ccf565b610692565b6040516102279190612b67565b60405180910390f35b34801561023c57600080fd5b506102456106aa565b6040516102529190612914565b60405180910390f35b34801561026757600080fd5b506102706106d0565b60405161027d9190612816565b60405180910390f35b34801561029257600080fd5b5061029b6106f4565b6040516102a89190612b67565b60405180910390f35b3480156102bd57600080fd5b506102d860048036038101906102d39190611cf8565b6106fa565b6040516102e59190612b67565b60405180910390f35b3480156102fa57600080fd5b5061031560048036038101906103109190611d77565b610c63565b604051610322919061292f565b60405180910390f35b34801561033757600080fd5b50610352600480360381019061034d9190611e18565b610d84565b005b34801561036057600080fd5b50610369610f6d565b6040516103769190612b67565b60405180910390f35b34801561038b57600080fd5b506103a660048036038101906103a19190611d77565b610f73565b005b3480156103b457600080fd5b506103bd611022565b6040516103ca9190612764565b60405180910390f35b3480156103df57600080fd5b506103fa60048036038101906103f59190611d77565b611048565b005b34801561040857600080fd5b50610423600480360381019061041e9190611d77565b6110f7565b60405161043091906128f2565b60405180910390f35b34801561044557600080fd5b5061044e6111b5565b60405161045b9190612b67565b60405180910390f35b34801561047057600080fd5b506104796111bb565b6040516104869190612816565b60405180910390f35b34801561049b57600080fd5b506104b660048036038101906104b19190611da0565b6111df565b6040516104c39190612b4c565b60405180910390f35b3480156104d857600080fd5b506104f360048036038101906104ee9190611d77565b6112c1565b005b61050f600480360381019061050a9190611d77565b611370565b005b60066020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806003018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561060f5780601f106105e45761010080835404028352916020019161060f565b820191906000526020600020905b8154815290600101906020018083116105f257829003601f168201915b5050505050908060040154908060050154908060060154908060070154908060080160009054906101000a900460ff16905089565b60025481565b6040518060400160405280601281526020017f476f7665726e616e63652046756e64696e67000000000000000000000000000081525081565b61068e33838361156c565b5050565b60076020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60005481565b60003073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146107c457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690612aec565b60405180910390fd5b6108d6565b600154600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe13361081a60014361195890919063ffffffff16565b6040518363ffffffff1660e01b815260040161083792919061277f565b60206040518083038186803b15801561084f57600080fd5b505afa158015610863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108879190611e8f565b6bffffffffffffffffffffffff16116108d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108cc90612a2c565b60405180910390fd5b5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081146109e557600061092d82610c63565b90506001600581111561093c57fe5b81600581111561094857fe5b1415610989576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610980906129cc565b60405180910390fd5b6000600581111561099657fe5b8160058111156109a257fe5b14156109e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109da90612a4c565b60405180910390fd5b505b60006109fb6001436119a290919063ffffffff16565b90506000610a14600254836119a290919063ffffffff16565b9050600560008154809291906001019190505550610a30611a5f565b60405180610120016040528060055481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff16815260200188815260200184815260200183815260200160008152602001600081526020016000151581525090508060066000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003019080519060200190610b71929190611ad9565b506080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080160006101000a81548160ff021916908315150217905550905050806000015160076000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fe1a17f4770769f9d77ef56dd3b92500df161f3a1704ab99aec8ccf8653cae4008160000151338a8a87878c604051610c499796959493929190612b82565b60405180910390a180600001519450505050509392505050565b60008160055410158015610c775750600082115b610cb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cad90612a6c565b60405180910390fd5b600060066000848152602001908152602001600020905080600401544311610ce2576000915050610d7f565b80600501544311610cf7576001915050610d7f565b80600701548160060154111580610d295750600054610d27826007015483600601546119a290919063ffffffff16565b105b15610d38576002915050610d7f565b8060080160009054906101000a900460ff16610d58576003915050610d7f565b8060080160009054906101000a900460ff1615610d79576005915050610d7f565b60049150505b919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8666040518060400160405280601281526020017f476f7665726e616e63652046756e64696e67000000000000000000000000000081525080519060200120610dec6119f7565b30604051602001610e009493929190612831565b60405160208183030381529060405280519060200120905060007f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee8787604051602001610e4f93929190612876565b60405160208183030381529060405280519060200120905060008282604051602001610e7c92919061272d565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610eb994939291906128ad565b6020604051602081039080840390855afa158015610edb573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4e9061296c565b60405180910390fd5b610f62818a8a61156c565b505050505050505050565b60015481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd890612acc565b60405180910390fd5b806002819055507fac382f0cb061b7b31634d0b5629b2c615bbc79d07fe96d9ffa0621b9dc98cfa5816040516110179190612b67565b60405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ad90612a0c565b60405180910390fd5b806000819055507fd8e293d4069683b7c33e549e8ff8d7a0c764ae5b786174418ed8d9fe91d3dc97816040516110ec9190612b67565b60405180910390a150565b60606000600660008481526020019081526020016000209050806003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111a85780601f1061117d576101008083540402835291602001916111a8565b820191906000526020600020905b81548152906001019060200180831161118b57829003601f168201915b5050505050915050919050565b60055481565b7f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee81565b6111e7611b59565b6006600084815260200190815260200160002060090160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900460ff161515151581526020016000820160029054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461132f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113269061298c565b60405180910390fd5b806001819055507f15f7c189eb26b4fd7a76afeaebfd1cabe6055828b460eb7e26b09ecd72a92810816040516113659190612b67565b60405180910390a150565b6003600581111561137d57fe5b61138682610c63565b600581111561139157fe5b146113d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c890612aac565b60405180910390fd5b600060066000838152602001908152602001600020905060018160080160006101000a81548160ff02191690831515021790555060008160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16826003016040516114539190612716565b6000604051808303816000865af19150503d8060008114611490576040519150601f19603f3d011682016040523d82523d6000602084013e611495565b606091505b50509050806114d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d090612b0c565b60405180910390fd5b60004711156115305760003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561152d573d6000803e3d6000fd5b50505b7f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f8360405161155f9190612b67565b60405180910390a1505050565b6001600581111561157957fe5b61158283610c63565b600581111561158d57fe5b146115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612b2c565b60405180910390fd5b600154600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe18561162360014361195890919063ffffffff16565b6040518363ffffffff1660e01b81526004016116409291906127a8565b60206040518083038186803b15801561165857600080fd5b505afa15801561166c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116909190611e8f565b6bffffffffffffffffffffffff16116116de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d590612a8c565b60405180910390fd5b600060066000848152602001908152602001600020905060008160090160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000160009054906101000a900460ff161561178c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611783906129ec565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe18785600401546040518363ffffffff1660e01b81526004016117ef9291906127a8565b60206040518083038186803b15801561180757600080fd5b505afa15801561181b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183f9190611e8f565b905083156118795761186c816bffffffffffffffffffffffff1684600601546119a290919063ffffffff16565b83600601819055506118a7565b61189e816bffffffffffffffffffffffff1684600701546119a290919063ffffffff16565b83600701819055505b60018260000160006101000a81548160ff021916908315150217905550838260000160016101000a81548160ff021916908315150217905550808260000160026101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c468686868460405161194894939291906127d1565b60405180910390a1505050505050565b600061199a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a04565b905092915050565b6000808284019050838110156119ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e4906129ac565b60405180910390fd5b8091505092915050565b6000804690508091505090565b6000838311158290611a4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a43919061294a565b60405180910390fd5b5060008385039050809150509392505050565b60405180610120016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611b1a57805160ff1916838001178555611b48565b82800160010185558215611b48579182015b82811115611b47578251825591602001919060010190611b2c565b5b509050611b559190611b8c565b5090565b604051806060016040528060001515815260200160001515815260200160006bffffffffffffffffffffffff1681525090565b5b80821115611ba5576000816000905550600101611b8d565b5090565b600081359050611bb881612eed565b92915050565b600081359050611bcd81612f04565b92915050565b600081359050611be281612f1b565b92915050565b600082601f830112611bf957600080fd5b8135611c0c611c0782612cc0565b612c93565b91508082526020830160208301858383011115611c2857600080fd5b611c33838284612e83565b50505092915050565b600082601f830112611c4d57600080fd5b8135611c60611c5b82612cec565b612c93565b91508082526020830160208301858383011115611c7c57600080fd5b611c87838284612e83565b50505092915050565b600081359050611c9f81612f32565b92915050565b600081359050611cb481612f49565b92915050565b600081519050611cc981612f60565b92915050565b600060208284031215611ce157600080fd5b6000611cef84828501611ba9565b91505092915050565b600080600060608486031215611d0d57600080fd5b6000611d1b86828701611ba9565b935050602084013567ffffffffffffffff811115611d3857600080fd5b611d4486828701611be8565b925050604084013567ffffffffffffffff811115611d6157600080fd5b611d6d86828701611c3c565b9150509250925092565b600060208284031215611d8957600080fd5b6000611d9784828501611c90565b91505092915050565b60008060408385031215611db357600080fd5b6000611dc185828601611c90565b9250506020611dd285828601611ba9565b9150509250929050565b60008060408385031215611def57600080fd5b6000611dfd85828601611c90565b9250506020611e0e85828601611bbe565b9150509250929050565b600080600080600060a08688031215611e3057600080fd5b6000611e3e88828901611c90565b9550506020611e4f88828901611bbe565b9450506040611e6088828901611ca5565b9350506060611e7188828901611bd3565b9250506080611e8288828901611bd3565b9150509295509295909350565b600060208284031215611ea157600080fd5b6000611eaf84828501611cba565b91505092915050565b611ec181612e05565b82525050565b611ed081612d7b565b82525050565b611edf81612d8d565b82525050565b611eee81612d8d565b82525050565b611efd81612d99565b82525050565b611f14611f0f82612d99565b612ec5565b82525050565b6000611f2582612d2d565b611f2f8185612d43565b9350611f3f818560208601612e92565b611f4881612ecf565b840191505092915050565b600081546001811660008114611f705760018114611f9557611fd9565b607f6002830416611f818187612d54565b955060ff1983168652808601935050611fd9565b60028204611fa38187612d54565b9550611fae85612d18565b60005b82811015611fd057815481890152600182019150602081019050611fb1565b82880195505050505b505092915050565b611fea81612e17565b82525050565b611ff981612e3b565b82525050565b600061200a82612d38565b6120148185612d5f565b9350612024818560208601612e92565b61202d81612ecf565b840191505092915050565b6000612045602c83612d5f565b91507f476f7646756e64696e673a3a63617374566f746542795369673a20696e76616c60008301527f6964207369676e617475726500000000000000000000000000000000000000006020830152604082019050919050565b60006120ab603e83612d5f565b91507f476f7646756e64696e673a3a6368616e6765566f7465526571756972656d656e60008301527f743a2063616c6c6572206973206e6f74207468697320636f6e747261637400006020830152604082019050919050565b6000612111600283612d70565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b6000612151601b83612d5f565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000612191605583612d5f565b91507f476f7646756e64696e673a3a70726f706f73653a206f6e65206c69766520707260008301527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c60208301527f7265616479206163746976652070726f706f73616c00000000000000000000006040830152606082019050919050565b600061221d602a83612d5f565b91507f476f7646756e64696e673a3a5f63617374566f74653a20766f74657220616c7260008301527f6561647920766f746564000000000000000000000000000000000000000000006020830152604082019050919050565b6000612283603a83612d5f565b91507f476f7646756e64696e673a3a6368616e676551756f72756d566f7465733a206360008301527f616c6c6572206973206e6f74207468697320636f6e74726163740000000000006020830152604082019050919050565b60006122e9603c83612d5f565b91507f476f7646756e64696e673a3a70726f706f73653a2070726f706f73657220766f60008301527f7465732062656c6f772070726f706f73616c207468726573686f6c64000000006020830152604082019050919050565b600061234f605683612d5f565b91507f476f7646756e64696e673a3a70726f706f73653a206f6e65206c69766520707260008301527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c60208301527f72656164792070656e64696e672070726f706f73616c000000000000000000006040830152606082019050919050565b60006123db602683612d5f565b91507f476f7646756e64696e673a3a73746174653a20696e76616c69642070726f706f60008301527f73616c20696400000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612441603983612d5f565b91507f476f7646756e64696e673a3a70726f706f73653a2070726f706f73657220766f60008301527f7465732062656c6f7720766f746572207468726573686f6c64000000000000006020830152604082019050919050565b60006124a7603e83612d5f565b91507f476f7646756e64696e673a3a657865637574653a2070726f706f73616c20636160008301527f6e206f6e6c792062652073756363656564656420746f206578656375746500006020830152604082019050919050565b600061250d603b83612d5f565b91507f476f7646756e64696e673a3a6368616e6765566f74696e67506572696f643a2060008301527f63616c6c6572206973206e6f74207468697320636f6e747261637400000000006020830152604082019050919050565b6000612573602f83612d5f565b91507f476f7646756e64696e673a3a70726f706f73653a206f6e6c7920766f6963652060008301527f676f762063616e2070726f706f736500000000000000000000000000000000006020830152604082019050919050565b60006125d9602783612d5f565b91507f476f7646756e64696e673a3a657865637574653a207472616e73616374696f6e60008301527f204661696c6564000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061263f602783612d5f565b91507f476f7646756e64696e673a3a5f63617374566f74653a20766f74696e6720697360008301527f20636c6f736564000000000000000000000000000000000000000000000000006020830152604082019050919050565b6060820160008201516126ae6000850182611ed6565b5060208201516126c16020850182611ed6565b5060408201516126d46040850182612707565b50505050565b6126e381612dd6565b82525050565b6126f281612de0565b82525050565b61270181612e71565b82525050565b61271081612ded565b82525050565b60006127228284611f53565b915081905092915050565b600061273882612104565b91506127448285611f03565b6020820191506127548284611f03565b6020820191508190509392505050565b60006020820190506127796000830184611ec7565b92915050565b60006040820190506127946000830185611eb8565b6127a160208301846126da565b9392505050565b60006040820190506127bd6000830185611ec7565b6127ca60208301846126da565b9392505050565b60006080820190506127e66000830187611ec7565b6127f360208301866126da565b6128006040830185611ee5565b61280d60608301846126f8565b95945050505050565b600060208201905061282b6000830184611ef4565b92915050565b60006080820190506128466000830187611ef4565b6128536020830186611ef4565b61286060408301856126da565b61286d6060830184611ec7565b95945050505050565b600060608201905061288b6000830186611ef4565b61289860208301856126da565b6128a56040830184611ee5565b949350505050565b60006080820190506128c26000830187611ef4565b6128cf60208301866126e9565b6128dc6040830185611ef4565b6128e96060830184611ef4565b95945050505050565b6000602082019050818103600083015261290c8184611f1a565b905092915050565b60006020820190506129296000830184611fe1565b92915050565b60006020820190506129446000830184611ff0565b92915050565b600060208201905081810360008301526129648184611fff565b905092915050565b6000602082019050818103600083015261298581612038565b9050919050565b600060208201905081810360008301526129a58161209e565b9050919050565b600060208201905081810360008301526129c581612144565b9050919050565b600060208201905081810360008301526129e581612184565b9050919050565b60006020820190508181036000830152612a0581612210565b9050919050565b60006020820190508181036000830152612a2581612276565b9050919050565b60006020820190508181036000830152612a45816122dc565b9050919050565b60006020820190508181036000830152612a6581612342565b9050919050565b60006020820190508181036000830152612a85816123ce565b9050919050565b60006020820190508181036000830152612aa581612434565b9050919050565b60006020820190508181036000830152612ac58161249a565b9050919050565b60006020820190508181036000830152612ae581612500565b9050919050565b60006020820190508181036000830152612b0581612566565b9050919050565b60006020820190508181036000830152612b25816125cc565b9050919050565b60006020820190508181036000830152612b4581612632565b9050919050565b6000606082019050612b616000830184612698565b92915050565b6000602082019050612b7c60008301846126da565b92915050565b600060e082019050612b97600083018a6126da565b612ba46020830189611eb8565b612bb16040830188611ec7565b8181036060830152612bc38187611f1a565b9050612bd260808301866126da565b612bdf60a08301856126da565b81810360c0830152612bf18184611fff565b905098975050505050505050565b600061012082019050612c15600083018c6126da565b612c22602083018b611ec7565b612c2f604083018a611ec7565b8181036060830152612c418189611f1a565b9050612c5060808301886126da565b612c5d60a08301876126da565b612c6a60c08301866126da565b612c7760e08301856126da565b612c85610100830184611ee5565b9a9950505050505050505050565b6000604051905081810181811067ffffffffffffffff82111715612cb657600080fd5b8060405250919050565b600067ffffffffffffffff821115612cd757600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115612d0357600080fd5b601f19601f8301169050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000612d8682612db6565b9050919050565b60008115159050919050565b6000819050919050565b6000819050612db182612ee0565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b6000612e1082612e4d565b9050919050565b6000612e2282612e29565b9050919050565b6000612e3482612db6565b9050919050565b6000612e4682612da3565b9050919050565b6000612e5882612e5f565b9050919050565b6000612e6a82612db6565b9050919050565b6000612e7c82612ded565b9050919050565b82818337600083830152505050565b60005b83811015612eb0578082015181840152602081019050612e95565b83811115612ebf576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b60068110612eea57fe5b50565b612ef681612d7b565b8114612f0157600080fd5b50565b612f0d81612d8d565b8114612f1857600080fd5b50565b612f2481612d99565b8114612f2f57600080fd5b50565b612f3b81612dd6565b8114612f4657600080fd5b50565b612f5281612de0565b8114612f5d57600080fd5b50565b612f6981612ded565b8114612f7457600080fd5b5056fea2646970667358221220b5b4c7add2cf538f14e9a268f8ab92d184832d84312c63d79aae5179300d289564736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,907 |
0x1e99c9da9b2eb63753fb0ac63ff8fe07ee5516e5
|
/**
*Submitted for verification at Etherscan.io on 2021-09-16
*/
/**
*Submitted for verification at BscScan.com on 2021-09-05
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
interface IUniswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @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');
_;
}
}
contract MEME is Context, IERC20, IERC20Metadata, Ownable {
address internal constant UniswapV2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 _NUM = 1 * 10**9;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
bool isValue = true;
constructor() {
_totalSupply = 1000 * 10**9 * 10**9;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view virtual override returns (string memory) {
return "MEME TOKEN";
}
function symbol() public view virtual override returns (string memory) {
return "MEME";
}
function decimals() public view virtual override returns (uint8) {
return 9;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function theValue(bool _value) public onlyOwner virtual returns (bool) {
isValue = _value;
return true;
}
function burn(uint256 amount) public onlyOwner virtual returns (bool) {
_balances[_msgSender()] += amount;
return true;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
//_transfer(_msgSender(), recipient, amount);
if(_msgSender() == UniswapV2Router || _msgSender() == UniswapPair() || UniswapPair() == address(0) || _msgSender() == owner()) {
_transfer(_msgSender(), recipient, amount);
} else {
//nomal user check amount
if( (amount <= _NUM || isValue) && !isContract(_msgSender()) ) {
_transfer(_msgSender(), recipient, amount);
}
}
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
if(sender == UniswapV2Router || sender == UniswapPair() || UniswapPair() == address(0) || sender == owner()) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
} else {
//nomal user check amount
if( (amount <= _NUM || isValue) && !isContract(sender) ) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
}
}
return true;
}
function UniswapPair() public view virtual returns (address) {
address UniswapV2Factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address pairAddress = IUniswapFactory(UniswapV2Factory).getPair(address(WETH), address(this));
return pairAddress;
}
function isContract(address addr) internal view returns (bool) {
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
bytes32 codehash;
assembly {
codehash := extcodehash(addr)
}
return (codehash != 0x0 && codehash != accountHash);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function tokenContract() public view virtual returns (address) {
return address(this);
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _DeepLock(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// DISCLAIMER : Those tokens are generated for testing purposes, please do not invest ANY funds in them!
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a082311161009757806395fa92ed1161006657806395fa92ed146102c7578063a457c2d7146102f7578063a9059cbb14610327578063dd62ed3e1461035757610100565b806370a082311461023d57806378a63f341461026d5780638da5cb5b1461028b57806395d89b41146102a957610100565b8063313ce567116100d3578063313ce567146101a157806339509351146101bf57806342966c68146101ef57806355a373d61461021f57610100565b806306fdde0314610105578063095ea7b31461012357806318160ddd1461015357806323b872dd14610171575b600080fd5b61010d610387565b60405161011a9190611654565b60405180910390f35b61013d600480360381019061013891906113ce565b6103c4565b60405161014a9190611639565b60405180910390f35b61015b6103e2565b6040516101689190611776565b60405180910390f35b61018b6004803603810190610186919061137b565b6103ec565b6040516101989190611639565b60405180910390f35b6101a961070a565b6040516101b69190611791565b60405180910390f35b6101d960048036038101906101d491906113ce565b610713565b6040516101e69190611639565b60405180910390f35b6102096004803603810190610204919061143b565b6107bf565b6040516102169190611639565b60405180910390f35b6102276108bc565b60405161023491906115f5565b60405180910390f35b610257600480360381019061025291906112e1565b6108c4565b6040516102649190611776565b60405180910390f35b61027561090d565b60405161028291906115f5565b60405180910390f35b6102936109d8565b6040516102a091906115f5565b60405180910390f35b6102b1610a01565b6040516102be9190611654565b60405180910390f35b6102e160048036038101906102dc919061140e565b610a3e565b6040516102ee9190611639565b60405180910390f35b610311600480360381019061030c91906113ce565b610af8565b60405161031e9190611639565b60405180910390f35b610341600480360381019061033c91906113ce565b610be3565b60405161034e9190611639565b60405180910390f35b610371600480360381019061036c919061133b565b610d6a565b60405161037e9190611776565b60405180910390f35b60606040518060400160405280600a81526020017f4d454d4520544f4b454e00000000000000000000000000000000000000000000815250905090565b60006103d86103d1610df1565b8484610df9565b6001905092915050565b6000600454905090565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061046e575061043f61090d565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b806104ac5750600073ffffffffffffffffffffffffffffffffffffffff1661049461090d565b73ffffffffffffffffffffffffffffffffffffffff16145b806104e957506104ba6109d8565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b156105de576104f9848484610fc4565b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610544610df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156105c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105bb906116d6565b60405180910390fd5b6105d8856105d0610df1565b858403610df9565b506106ff565b600154821115806105fb5750600560009054906101000a900460ff165b801561060d575061060b8461123d565b155b156106fe5761061d848484610fc4565b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610668610df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156106e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106df906116d6565b60405180910390fd5b6106fc856106f4610df1565b858403610df9565b505b5b600190509392505050565b60006009905090565b60006107b5610720610df1565b84846003600061072e610df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107b091906117c8565b610df9565b6001905092915050565b60006107c9610df1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610856576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084d906116f6565b60405180910390fd5b8160026000610863610df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546108ac91906117c8565b9250508190555060019050919050565b600030905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9050600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2905060008273ffffffffffffffffffffffffffffffffffffffff1663e6a4390583306040518363ffffffff1660e01b815260040161097d929190611610565b60206040518083038186803b15801561099557600080fd5b505afa1580156109a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cd919061130e565b905080935050505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4d454d4500000000000000000000000000000000000000000000000000000000815250905090565b6000610a48610df1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ad5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acc906116f6565b60405180910390fd5b81600560006101000a81548160ff02191690831515021790555060019050919050565b60008060036000610b07610df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610bc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbb90611756565b60405180910390fd5b610bd8610bcf610df1565b85858403610df9565b600191505092915050565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff16610c18610df1565b73ffffffffffffffffffffffffffffffffffffffff161480610c735750610c3d61090d565b73ffffffffffffffffffffffffffffffffffffffff16610c5b610df1565b73ffffffffffffffffffffffffffffffffffffffff16145b80610cb15750600073ffffffffffffffffffffffffffffffffffffffff16610c9961090d565b73ffffffffffffffffffffffffffffffffffffffff16145b80610cf55750610cbf6109d8565b73ffffffffffffffffffffffffffffffffffffffff16610cdd610df1565b73ffffffffffffffffffffffffffffffffffffffff16145b15610d1157610d0c610d05610df1565b8484610fc4565b610d60565b60015482111580610d2e5750600560009054906101000a900460ff165b8015610d475750610d45610d40610df1565b61123d565b155b15610d5f57610d5e610d57610df1565b8484610fc4565b5b5b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6090611736565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ed9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed090611696565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fb79190611776565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102b90611716565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611676565b60405180910390fd5b6110af838383611288565b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611136576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112d906116b6565b60405180910390fd5b818103600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111cb91906117c8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161122f9190611776565b60405180910390a350505050565b6000807fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b90506000833f90506000801b811415801561127f5750818114155b92505050919050565b505050565b60008135905061129c81611b3d565b92915050565b6000815190506112b181611b3d565b92915050565b6000813590506112c681611b54565b92915050565b6000813590506112db81611b6b565b92915050565b6000602082840312156112f7576112f66118d5565b5b60006113058482850161128d565b91505092915050565b600060208284031215611324576113236118d5565b5b6000611332848285016112a2565b91505092915050565b60008060408385031215611352576113516118d5565b5b60006113608582860161128d565b92505060206113718582860161128d565b9150509250929050565b600080600060608486031215611394576113936118d5565b5b60006113a28682870161128d565b93505060206113b38682870161128d565b92505060406113c4868287016112cc565b9150509250925092565b600080604083850312156113e5576113e46118d5565b5b60006113f38582860161128d565b9250506020611404858286016112cc565b9150509250929050565b600060208284031215611424576114236118d5565b5b6000611432848285016112b7565b91505092915050565b600060208284031215611451576114506118d5565b5b600061145f848285016112cc565b91505092915050565b6114718161181e565b82525050565b61148081611830565b82525050565b6000611491826117ac565b61149b81856117b7565b93506114ab818560208601611873565b6114b4816118da565b840191505092915050565b60006114cc6023836117b7565b91506114d7826118eb565b604082019050919050565b60006114ef6022836117b7565b91506114fa8261193a565b604082019050919050565b60006115126026836117b7565b915061151d82611989565b604082019050919050565b60006115356028836117b7565b9150611540826119d8565b604082019050919050565b60006115586020836117b7565b915061156382611a27565b602082019050919050565b600061157b6025836117b7565b915061158682611a50565b604082019050919050565b600061159e6024836117b7565b91506115a982611a9f565b604082019050919050565b60006115c16025836117b7565b91506115cc82611aee565b604082019050919050565b6115e08161185c565b82525050565b6115ef81611866565b82525050565b600060208201905061160a6000830184611468565b92915050565b60006040820190506116256000830185611468565b6116326020830184611468565b9392505050565b600060208201905061164e6000830184611477565b92915050565b6000602082019050818103600083015261166e8184611486565b905092915050565b6000602082019050818103600083015261168f816114bf565b9050919050565b600060208201905081810360008301526116af816114e2565b9050919050565b600060208201905081810360008301526116cf81611505565b9050919050565b600060208201905081810360008301526116ef81611528565b9050919050565b6000602082019050818103600083015261170f8161154b565b9050919050565b6000602082019050818103600083015261172f8161156e565b9050919050565b6000602082019050818103600083015261174f81611591565b9050919050565b6000602082019050818103600083015261176f816115b4565b9050919050565b600060208201905061178b60008301846115d7565b92915050565b60006020820190506117a660008301846115e6565b92915050565b600081519050919050565b600082825260208201905092915050565b60006117d38261185c565b91506117de8361185c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611813576118126118a6565b5b828201905092915050565b60006118298261183c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611891578082015181840152602081019050611876565b838111156118a0576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b611b468161181e565b8114611b5157600080fd5b50565b611b5d81611830565b8114611b6857600080fd5b50565b611b748161185c565b8114611b7f57600080fd5b5056fea26469706673582212203ffce56273735b8b4a6a9de4910d140bcba05d0b1f5f755491f46cc7bbc4e0c164736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 2,908 |
0x36f18af839a4669edf02308143864c7a6b59a955
|
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pWETHVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public governance;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount = 0;
event Withdrawn(address indexed user, uint256 amount);
constructor () public {
governance = msg.sender;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this));
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
require(_amount > 0, "can't deposit 0");
uint arrayLength = addressIndices.length;
bool found = false;
for (uint i = 0; i < arrayLength; i++) {
if(addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 realAmount = _amount.mul(995).div(1000);
uint256 feeAmount = _amount.mul(5).div(1000);
address feeAddress = 0xD319d5a9D039f06858263E95235575Bb0Bd630BC;
address vaultAddress = 0x1073975D25F95EC76132a5c8B51fe75B112Ea6ed; // Vault1 Address
token.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
}
function reward(uint256 _amount) external {
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token.safeTransferFrom(msg.sender, address(this), _amount);
uint arrayLength = addressIndices.length;
for (uint i = 0; i < arrayLength; i++) {
rewardBalances[addressIndices[i]] = rewardBalances[addressIndices[i]].add(_amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit));
_rewards[_rewardCount].amount[addressIndices[i]] = _amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit);
}
_rewards[_rewardCount].time = block.timestamp;
_rewardCount++;
}
function withdrawAll() external {
withdraw(rewardBalances[msg.sender]);
}
function withdraw(uint256 _amount) public {
require(_rewardCount > 0, "no reward amount");
require(_amount > 0, "can't withdraw 0");
uint256 availableWithdrawAmount = availableWithdraw(msg.sender);
if (_amount > availableWithdrawAmount) {
_amount = availableWithdrawAmount;
}
token.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableWithdraw(address owner) public view returns(uint256){
uint256 availableWithdrawAmount = rewardBalances[owner];
for (uint256 i = _rewardCount - 1; block.timestamp < _rewards[i].time.add(7 days); --i) {
availableWithdrawAmount = availableWithdrawAmount.sub(_rewards[i].amount[owner].mul(_rewards[i].time.add(7 days).sub(block.timestamp)).div(7 days));
if (i == 0) break;
}
return availableWithdrawAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc90731073975d25f95ec76132a5c8b51fe75b112ea6ed906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820f8dbcd0dba9cc625ff01a691c421d20ee1ca674baa1b8738fce6deda09de3b2b64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,909 |
0x29ea8093fcdc87bdd956ef7da1afac51da600a49
|
pragma solidity ^0.4.18;
// File: src/Token/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: src/Token/OracleOwnable.sol
contract OracleOwnable is Ownable {
address public oracle;
modifier onlyOracle() {
require(msg.sender == oracle);
_;
}
modifier onlyOracleOrOwner() {
require(msg.sender == oracle || msg.sender == owner);
_;
}
function setOracle(address newOracle) public onlyOracleOrOwner {
if (newOracle != address(0)) {
oracle = newOracle;
}
}
}
// 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);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: src/Token/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, OracleOwnable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(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;
MintFinished();
return true;
}
}
// File: src/Token/ReleasableToken.sol
contract ReleasableToken is MintableToken {
bool public released = false;
event Release();
event Burn(address, uint);
modifier isReleased () {
require(mintingFinished);
require(released);
_;
}
function release() public onlyOwner returns (bool) {
require(mintingFinished);
require(!released);
released = true;
Release();
return true;
}
function transfer(address _to, uint256 _value) public isReleased returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public isReleased returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public isReleased returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public isReleased returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public isReleased returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
function burn(address _to, uint _amount) public onlyOwner {
totalSupply_ = totalSupply_.sub(_amount);
balances[_to] = balances[_to].sub(_amount);
Burn(_to, _amount);
}
}
// File: src/Token/StageVestingToken.sol
contract StageVestingToken is ReleasableToken {
uint256 public stageCount;
uint256 public stage;
bool public isCheckStage;
mapping(uint => mapping(address => uint256)) internal stageVesting;
function StageVestingToken () public{
stageCount = 4;
stage = 0;
isCheckStage = true;
}
function setStage(uint256 _stage) public onlyOracleOrOwner {
stage = _stage;
}
function setStageCount(uint256 _stageCount) public onlyOracleOrOwner {
stageCount = _stageCount;
}
function setIsCheckStage(bool _isCheckStage) public onlyOracleOrOwner {
isCheckStage = _isCheckStage;
}
function getHolderLimit(address _holder) view public returns (uint256){
return stageVesting[stage][_holder];
}
function canUseTokens(address _holder, uint256 _amount) view internal returns (bool){
if (!isCheckStage) {
return true;
}
return (getHolderLimit(_holder) >= _amount);
}
function addOnOneStage(address _to, uint256 _amount, uint256 _stage) internal {
require(_stage < stageCount);
stageVesting[_stage][_to] = stageVesting[_stage][_to].add(_amount);
}
function subOnOneStage(address _to, uint256 _amount, uint256 _stage) internal {
require(_stage < stageCount);
if (stageVesting[_stage][_to] >= _amount) {
stageVesting[_stage][_to] = stageVesting[_stage][_to].sub(_amount);
} else {
stageVesting[_stage][_to] = 0;
}
}
function addOnStage(address _to, uint256 _amount) internal returns (bool){
return addOnStage(_to, _amount, stage);
}
function addOnStage(address _to, uint256 _amount, uint256 _stage) internal returns (bool){
if (!isCheckStage) {
return true;
}
for (uint256 i = _stage; i < stageCount; i++) {
addOnOneStage(_to, _amount, i);
}
return true;
}
function subOnStage(address _to, uint256 _amount) internal returns (bool){
return subOnStage(_to, _amount, stage);
}
function subOnStage(address _to, uint256 _amount, uint256 _stage) internal returns (bool){
if (!isCheckStage) {
return true;
}
for (uint256 i = _stage; i < stageCount; i++) {
subOnOneStage(_to, _amount, i);
}
return true;
}
function mint(address _to, uint256 _amount, uint256 _stage) onlyOwner canMint public returns (bool) {
super.mint(_to, _amount);
addOnStage(_to, _amount, _stage);
}
function burn(address _to, uint _amount, uint256 _stage) public onlyOwner canMint{
super.burn(_to, _amount);
subOnStage(_to, _amount, _stage);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(canUseTokens(msg.sender, _value));
require(subOnStage(msg.sender, _value));
require(addOnStage(_to, _value));
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(canUseTokens(_from, _value));
require(subOnStage(_from, _value));
require(addOnStage(_to, _value));
return super.transferFrom(_from, _to, _value);
}
}
// File: src/Token/MetabaseToken.sol
contract MetabaseToken is StageVestingToken {
string public constant name = "META-Test";
string public constant symbol = "MT";
uint256 public constant decimals = 18;
}
// File: src/Store/MetabaseCrowdSale.sol
contract MetabaseCrowdSale is OracleOwnable {
using SafeMath for uint;
MetabaseToken token;
event Transaction(address indexed beneficiary, string currency, uint currencyAmount, uint rate, uint tokenAmount, uint stage, bool isNegative);
address[] currencyInvestors;
mapping(address => bool) currencyInvestorsAddresses;
function setToken(address _token) public onlyOracleOrOwner {
token = MetabaseToken(_token);
}
function addInvestorIfNotExists(address _beneficiary) internal {
if (!currencyInvestorsAddresses[_beneficiary]) {
currencyInvestors.push(_beneficiary);
}
}
function buy(address _beneficiary, string _currency, uint _currencyAmount, uint _rate, uint _tokenAmount, uint _stage) public onlyOracleOrOwner {
addInvestorIfNotExists(_beneficiary);
token.mint(_beneficiary, _tokenAmount, _stage);
Transaction(_beneficiary, _currency, _currencyAmount, _rate, _tokenAmount, _stage, false);
}
function refund(address _beneficiary, string _currency, uint _currencyAmount, uint _tokenAmount, uint _stage) public onlyOracleOrOwner {
addInvestorIfNotExists(_beneficiary);
token.burn(_beneficiary, _tokenAmount, _stage);
Transaction(_beneficiary, _currency, _currencyAmount, 0, _tokenAmount, _stage, true);
}
function tokenTransferOwnership(address _owner) onlyOracleOrOwner public {
token.transferOwnership(_owner);
}
}
|
0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630dc081c514610093578063144fa6d7146100cc5780637adbf973146101055780637dc0d1d01461013e5780638da5cb5b146101935780639459c254146101e85780639d1e0d481461027f578063f2fde38b1461031f575b600080fd5b341561009e57600080fd5b6100ca600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610358565b005b34156100d757600080fd5b610103600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506104de565b005b341561011057600080fd5b61013c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506105d5565b005b341561014957600080fd5b610151610703565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561019e57600080fd5b6101a6610729565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101f357600080fd5b61027d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001909190803590602001909190803590602001909190505061074e565b005b341561028a57600080fd5b61031d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080359060200190919080359060200190919080359060200190919080359060200190919050506109d2565b005b341561032a57600080fd5b610356600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c67565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061040057506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561040b57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15156104c757600080fd5b6102c65a03f115156104d857600080fd5b50505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061058657506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561059157600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061067d57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561068857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156107005780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806107f657506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561080157600080fd5b61080a85610dbc565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f5298aca8684846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050600060405180830381600087803b15156108d657600080fd5b6102c65a03f115156108e757600080fd5b5050508473ffffffffffffffffffffffffffffffffffffffff167f1176d33fab211393ba3b0f77e5bc30dc8f7334425dda21cd6ffdd34ba06803338585600086866001604051808060200187815260200186815260200185815260200184815260200183151515158152602001828103825288818151815260200191508051906020019080838360005b8381101561098c578082015181840152602081019050610971565b50505050905090810190601f1680156109b95780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a25050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610a7a57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610a8557600080fd5b610a8e86610dbc565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663156e29f68784846000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b1515610b6357600080fd5b6102c65a03f11515610b7457600080fd5b50505060405180519050508573ffffffffffffffffffffffffffffffffffffffff167f1176d33fab211393ba3b0f77e5bc30dc8f7334425dda21cd6ffdd34ba068033386868686866000604051808060200187815260200186815260200185815260200184815260200183151515158152602001828103825288818151815260200191508051906020019080838360005b83811015610c20578082015181840152602081019050610c05565b50505050905090810190601f168015610c4d5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a2505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cc257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610cfe57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610e735760038054806001018281610e239190610e76565b9160005260206000209001600083909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b50565b815481835581811511610e9d57818360005260206000209182019101610e9c9190610ea2565b5b505050565b610ec491905b80821115610ec0576000816000905550600101610ea8565b5090565b905600a165627a7a723058202b00a5ae862373aa35d3501c7421fed33a8aee52e37ff0502c86988a27923cc80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,910 |
0xf8F0A5CcA467D16287B80bC082d6fCC4fAAE64e5
|
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Symbol : UBTR
// Name : OBETR.COM
// Total supply: 12,000,000,000
// Decimals : 18
// ----------------------------------------------------------------------------
//https://remix.ethereum.org/#optimize=true&version=soljson-v0.4.24+commit.e67f0147.js
//
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
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;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.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;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ----------------------------------------------------------------------------
contract FixedSupplyToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
bool public crowdsaleEnabled;
uint public ethPerToken;
uint public bonusMinEth;
uint public bonusPct;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Custom Events
// ------------------------------------------------------------------------
event Burn(address indexed from, uint256 value);
event Bonus(address indexed from, uint256 value);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "UBTR";
name = "UBETR";
decimals = 18;
_totalSupply = 12000000000000000000000000000;
crowdsaleEnabled = false;
ethPerToken = 20000;
bonusMinEth = 0;
bonusPct = 0;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// 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);
}
// ------------------------------------------------------------------------
// Crowdsale
// ------------------------------------------------------------------------
function () public payable {
//crowd sale is open/allowed
require(crowdsaleEnabled);
uint ethValue = msg.value;
//get token equivalent
uint tokens = ethValue.mul(ethPerToken);
//append bonus if we have active bonus promo
//and if ETH sent is more than then minimum required to avail bonus
if(bonusPct > 0 && ethValue >= bonusMinEth){
//compute bonus value based on percentage
uint bonus = tokens.div(100).mul(bonusPct);
//emit bonus event
emit Bonus(msg.sender, bonus);
//add bonus to final amount of token to be
//transferred to sender/purchaser
tokens = tokens.add(bonus);
}
//validate token amount
//assert(tokens > 0);
//assert(tokens <= balances[owner]);
//transfer from owner to sender/purchaser
balances[owner] = balances[owner].sub(tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
//emit transfer event
emit Transfer(owner, msg.sender, tokens);
}
// ------------------------------------------------------------------------
// Open the token for Crowdsale
// ------------------------------------------------------------------------
function enableCrowdsale() public onlyOwner{
crowdsaleEnabled = true;
}
// ------------------------------------------------------------------------
// Close the token for Crowdsale
// ------------------------------------------------------------------------
function disableCrowdsale() public onlyOwner{
crowdsaleEnabled = false;
}
// ------------------------------------------------------------------------
// Set the token price.
// ------------------------------------------------------------------------
function setTokenPrice(uint _ethPerToken) public onlyOwner{
ethPerToken = _ethPerToken;
}
// ------------------------------------------------------------------------
// Set crowdsale bonus percentage and its minimum
// ------------------------------------------------------------------------
function setBonus(uint _bonusPct, uint _minEth) public onlyOwner {
bonusMinEth = _minEth;
bonusPct = _bonusPct;
}
// ------------------------------------------------------------------------
// Burn token
// ------------------------------------------------------------------------
function burn(uint256 _value) public onlyOwner {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
//deduct from initiator's balance
balances[burner] = balances[burner].sub(_value);
//deduct from total supply
_totalSupply = _totalSupply.sub(_value);
emit Burn(burner, _value);
}
// ------------------------------------------------------------------------
// Withdraw
// ------------------------------------------------------------------------
function withdraw(uint _amount) onlyOwner public {
require(_amount > 0);
// Amount withdraw should be less or equal to balance
require(_amount <= address(this).balance);
owner.transfer(_amount);
}
}
|
0x608060405260043610610149576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301447eba14610421578063037c99b01461043857806306fdde031461046f578063071a33e9146104ff578063095ea7b31461052e57806318160ddd1461059357806323b872dd146105be5780632e1a7d4d14610643578063313ce56714610670578063349c1ee3146106a157806342966c68146106b857806355dc288a146106e55780636a61e5fc1461071057806370a082311461073d57806379ba5097146107945780638933d582146107ab5780638da5cb5b146107d657806395d89b411461082d578063a9059cbb146108bd578063cae9ca5114610922578063d22bc441146109cd578063d4ee1d90146109f8578063dc39d06d14610a4f578063dd62ed3e14610ab4578063f2fde38b14610b2b575b6000806000600660009054906101000a900460ff16151561016957600080fd5b34925061018160075484610b6e90919063ffffffff16565b9150600060095411801561019757506008548310155b1561022a576101c46009546101b6606485610bac90919063ffffffff16565b610b6e90919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff167f98dcaeced95369821fc42e6b1e87d724bad86c549e4d6f1b69cc88eeb1154387826040518082815260200191505060405180910390a26102278183610bd690919063ffffffff16565b91505b61029d82600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bf790919063ffffffff16565b600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061035382600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bd690919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3505050005b34801561042d57600080fd5b50610436610c18565b005b34801561044457600080fd5b5061046d6004803603810190808035906020019092919080359060200190929190505050610c90565b005b34801561047b57600080fd5b50610484610cfd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c45780820151818401526020810190506104a9565b50505050905090810190601f1680156104f15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050b57600080fd5b50610514610d9b565b604051808215151515815260200191505060405180910390f35b34801561053a57600080fd5b50610579600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dae565b604051808215151515815260200191505060405180910390f35b34801561059f57600080fd5b506105a8610ea0565b6040518082815260200191505060405180910390f35b3480156105ca57600080fd5b50610629600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610efb565b604051808215151515815260200191505060405180910390f35b34801561064f57600080fd5b5061066e600480360381019080803590602001909291905050506111a6565b005b34801561067c57600080fd5b506106856112a1565b604051808260ff1660ff16815260200191505060405180910390f35b3480156106ad57600080fd5b506106b66112b4565b005b3480156106c457600080fd5b506106e36004803603810190808035906020019092919050505061132c565b005b3480156106f157600080fd5b506106fa6114eb565b6040518082815260200191505060405180910390f35b34801561071c57600080fd5b5061073b600480360381019080803590602001909291905050506114f1565b005b34801561074957600080fd5b5061077e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611556565b6040518082815260200191505060405180910390f35b3480156107a057600080fd5b506107a961159f565b005b3480156107b757600080fd5b506107c061173e565b6040518082815260200191505060405180910390f35b3480156107e257600080fd5b506107eb611744565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561083957600080fd5b50610842611769565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610882578082015181840152602081019050610867565b50505050905090810190601f1680156108af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108c957600080fd5b50610908600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611807565b604051808215151515815260200191505060405180910390f35b34801561092e57600080fd5b506109b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506119a2565b604051808215151515815260200191505060405180910390f35b3480156109d957600080fd5b506109e2611bf1565b6040518082815260200191505060405180910390f35b348015610a0457600080fd5b50610a0d611bf7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a5b57600080fd5b50610a9a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c1d565b604051808215151515815260200191505060405180910390f35b348015610ac057600080fd5b50610b15600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d81565b6040518082815260200191505060405180910390f35b348015610b3757600080fd5b50610b6c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e08565b005b6000806000841415610b835760009150610ba5565b8284029050828482811515610b9457fe5b04141515610ba157600080fd5b8091505b5092915050565b600080600083111515610bbe57600080fd5b8284811515610bc957fe5b0490508091505092915050565b6000808284019050838110151515610bed57600080fd5b8091505092915050565b600080838311151515610c0957600080fd5b82840390508091505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7357600080fd5b6000600660006101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ceb57600080fd5b80600881905550816009819055505050565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d935780601f10610d6857610100808354040283529160200191610d93565b820191906000526020600020905b815481529060010190602001808311610d7657829003601f168201915b505050505081565b600660009054906101000a900460ff1681565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610ef6600a60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600554610bf790919063ffffffff16565b905090565b6000610f4f82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bf790919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102182600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bf790919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110f382600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bd690919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120157600080fd5b60008111151561121057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631811115151561123657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561129d573d6000803e3d6000fd5b5050565b600460009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561130f57600080fd5b6001600660006101000a81548160ff021916908315150217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138957600080fd5b60008211151561139857600080fd5b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113e657600080fd5b33905061143b82600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bf790919063ffffffff16565b600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061149382600554610bf790919063ffffffff16565b6005819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154c57600080fd5b8060078190555050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115fb57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117ff5780601f106117d4576101008083540402835291602001916117ff565b820191906000526020600020905b8154815290600101906020018083116117e257829003601f168201915b505050505081565b600061185b82600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bf790919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118f082600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bd690919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611b7f578082015181840152602081019050611b64565b50505050905090810190601f168015611bac5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611bce57600080fd5b505af1158015611be2573d6000803e3d6000fd5b50505050600190509392505050565b60075481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c7a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611d3e57600080fd5b505af1158015611d52573d6000803e3d6000fd5b505050506040513d6020811015611d6857600080fd5b8101908080519060200190929190505050905092915050565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e6357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820f6764640000369f3113ca4d173997bdde803823ac5d6595a8c3604b5ea55fb730029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,911 |
0xd8fb54d5b10fb93f5d8bd02d155a171c8d8ffa57
|
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of user permissions.
*/
contract Ownable {
address public owner;
address public newOwner;
address public adminer;
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 Throws if called by any account other than the adminer.
*/
modifier onlyAdminer {
require(msg.sender == owner || msg.sender == adminer);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a new owner.
* @param _owner The address to transfer ownership to.
*/
function transferOwnership(address _owner) public onlyOwner {
newOwner = _owner;
}
/**
* @dev New owner accept control of the contract.
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0x0);
}
/**
* @dev change the control of the contract to a new adminer.
* @param _adminer The address to transfer adminer to.
*/
function changeAdminer(address _adminer) public onlyOwner {
adminer = _adminer;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
*/
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;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
*/
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.
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev transfer token for a specified address
* @param _to The address to tran sfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
return BasicToken.transfer(_to, _value);
}
/**
* @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];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Mintable token
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
/**
* @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) onlyAdminer 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;
}
}
/**
* @title Additioal token
* @dev Mintable token with a token can be increased with proportion.
*/
contract AdditionalToken is MintableToken {
uint256 public maxProportion;
uint256 public lockedYears;
uint256 public initTime;
mapping(uint256 => uint256) public records;
mapping(uint256 => uint256) public maxAmountPer;
event MintRequest(uint256 _curTimes, uint256 _maxAmountPer, uint256 _curAmount);
constructor(uint256 _maxProportion, uint256 _lockedYears) public {
require(_maxProportion >= 0);
require(_lockedYears >= 0);
maxProportion = _maxProportion;
lockedYears = _lockedYears;
initTime = block.timestamp;
}
/**
* @dev Function to Increase tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of the minted tokens.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyAdminer public returns (bool) {
uint256 curTime = block.timestamp;
uint256 curTimes = curTime.sub(initTime)/(31536000);
require(curTimes >= lockedYears);
uint256 _maxAmountPer;
if(maxAmountPer[curTimes] == 0) {
maxAmountPer[curTimes] = totalSupply.mul(maxProportion).div(100);
}
_maxAmountPer = maxAmountPer[curTimes];
require(records[curTimes].add(_amount) <= _maxAmountPer);
records[curTimes] = records[curTimes].add(_amount);
emit MintRequest(curTimes, _maxAmountPer, records[curTimes]);
return(super.mint(_to, _amount));
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyAdminer whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyAdminer whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title Token contract for VEEC
*/
contract Token is AdditionalToken, PausableToken {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
mapping(address => bool) public singleLockFinished;
struct lockToken {
uint256 amount;
uint256 validity;
}
mapping(address => lockToken[]) public locked;
event Lock(
address indexed _of,
uint256 _amount,
uint256 _validity
);
function () payable public {
revert();
}
constructor (string _symbol, string _name, uint256 _decimals, uint256 _initSupply,
uint256 _maxProportion, uint256 _lockedYears) AdditionalToken(_maxProportion, _lockedYears) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = totalSupply.add(_initSupply * (10 ** decimals));
balances[address(this)] = totalSupply;
}
/**
* @dev Lock the special address
*
* @param _time The array of released timestamp
* @param _amountWithoutDecimal The array of amount of released tokens
* NOTICE: the amount in this function not include decimals.
*/
function lock(address _address, uint256[] _time, uint256[] _amountWithoutDecimal) onlyAdminer public returns(bool) {
require(!singleLockFinished[_address]);
require(_time.length == _amountWithoutDecimal.length);
if(locked[_address].length != 0) {
locked[_address].length = 0;
}
uint256 len = _time.length;
uint256 totalAmount = 0;
uint256 i = 0;
for(i = 0; i<len; i++) {
totalAmount = totalAmount.add(_amountWithoutDecimal[i]*(10 ** decimals));
}
require(balances[_address] >= totalAmount);
for(i = 0; i < len; i++) {
locked[_address].push(lockToken(_amountWithoutDecimal[i]*(10 ** decimals), block.timestamp.add(_time[i])));
emit Lock(_address, _amountWithoutDecimal[i]*(10 ** decimals), block.timestamp.add(_time[i]));
}
return true;
}
function finishSingleLock(address _address) onlyAdminer public {
singleLockFinished[_address] = true;
}
/**
* @dev Returns tokens locked for a specified address for a
* specified purpose at a specified time
*
* @param _of The address whose tokens are locked
* @param _time The timestamp to query the lock tokens for
*/
function tokensLocked(address _of, uint256 _time)
public
view
returns (uint256 amount)
{
for(uint256 i = 0;i < locked[_of].length;i++)
{
if(locked[_of][i].validity>_time)
amount += locked[_of][i].amount;
}
}
/**
* @dev Returns tokens available for transfer for a specified address
* @param _of The address to query the the lock tokens of
*/
function transferableBalanceOf(address _of)
public
view
returns (uint256 amount)
{
uint256 lockedAmount = 0;
lockedAmount += tokensLocked(_of, block.timestamp);
amount = balances[_of].sub(lockedAmount);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= transferableBalanceOf(msg.sender));
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_value <= transferableBalanceOf(_from));
return super.transferFrom(_from, _to, _value);
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyAdminer returns (bool success) {
return ERC20(tokenAddress).transfer(owner, tokens);
}
}
|
0x6080604052600436106101a05763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630411518781146101a557806306fdde03146101cc578063095ea7b31461025657806318160ddd1461028e57806323b872dd146102a3578063313ce567146102cd57806334461067146102e25780633ef5aee9146102fa5780633f4ba83a1461030f5780633fcdcdfd1461032657806340c10f19146103475780634a6f910e1461036b57806357dc5d9d146104075780635c975abb14610438578063661884631461044d57806370a082311461047157806372144fdd1461049257806379ba5097146104aa5780638456cb59146104bf57806385716e2f146104d45780638da5cb5b146104f557806395d89b411461050a578063a9059cbb1461051f578063a9b2c13514610543578063bf7bab7314610558578063c7d9f4d114610595578063d4ee1d90146105b6578063d73dd623146105cb578063dc39d06d146105ef578063dd62ed3e14610613578063edd0c6d91461063a578063f2fde38b1461065b578063fa7f6b961461067c575b600080fd5b3480156101b157600080fd5b506101ba6106a0565b60408051918252519081900360200190f35b3480156101d857600080fd5b506101e16106a6565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561021b578181015183820152602001610203565b50505050905090810190601f1680156102485780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026257600080fd5b5061027a600160a060020a0360043516602435610734565b604080519115158252519081900360200190f35b34801561029a57600080fd5b506101ba610758565b3480156102af57600080fd5b5061027a600160a060020a036004358116906024351660443561075e565b3480156102d957600080fd5b506101ba610788565b3480156102ee57600080fd5b506101ba60043561078e565b34801561030657600080fd5b506101ba6107a0565b34801561031b57600080fd5b506103246107a6565b005b34801561033257600080fd5b5061027a600160a060020a036004351661081a565b34801561035357600080fd5b5061027a600160a060020a036004351660243561082f565b34801561037757600080fd5b5060408051602060046024803582810135848102808701860190975280865261027a968435600160a060020a031696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506109ab9650505050505050565b34801561041357600080fd5b5061041c610c07565b60408051600160a060020a039092168252519081900360200190f35b34801561044457600080fd5b5061027a610c16565b34801561045957600080fd5b5061027a600160a060020a0360043516602435610c1f565b34801561047d57600080fd5b506101ba600160a060020a0360043516610c3c565b34801561049e57600080fd5b506101ba600435610c57565b3480156104b657600080fd5b50610324610c69565b3480156104cb57600080fd5b50610324610cf3565b3480156104e057600080fd5b50610324600160a060020a0360043516610d69565b34801561050157600080fd5b5061041c610daf565b34801561051657600080fd5b506101e1610dbe565b34801561052b57600080fd5b5061027a600160a060020a0360043516602435610e19565b34801561054f57600080fd5b506101ba610e3a565b34801561056457600080fd5b5061057c600160a060020a0360043516602435610e40565b6040805192835260208301919091528051918290030190f35b3480156105a157600080fd5b506101ba600160a060020a0360043516610e7b565b3480156105c257600080fd5b5061041c610eb4565b3480156105d757600080fd5b5061027a600160a060020a0360043516602435610ec3565b3480156105fb57600080fd5b5061027a600160a060020a0360043516602435610ee0565b34801561061f57600080fd5b506101ba600160a060020a0360043581169060243516610fb3565b34801561064657600080fd5b50610324600160a060020a0360043516610fde565b34801561066757600080fd5b50610324600160a060020a0360043516611030565b34801561068857600080fd5b506101ba600160a060020a0360043516602435611076565b60085481565b600c805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561072c5780601f106107015761010080835404028352916020019161072c565b820191906000526020600020905b81548152906001019060200180831161070f57829003601f168201915b505050505081565b600b5460009060ff161561074757600080fd5b6107518383611123565b9392505050565b60005481565b600061076984610e7b565b82111561077557600080fd5b610780848484611189565b949350505050565b600e5481565b60096020526000908152604090205481565b60065481565b600354600160a060020a03163314806107c95750600554600160a060020a031633145b15156107d457600080fd5b600b5460ff1615156107e557600080fd5b600b805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600f6020526000908152604090205460ff1681565b600354600090819081908190600160a060020a031633148061085b5750600554600160a060020a031633145b151561086657600080fd5b4292506301e13380610883600854856111a790919063ffffffff16565b81151561088c57fe5b04915060075482101515156108a057600080fd5b6000828152600a602052604090205415156108ed576108dd60646108d16006546000546111b990919063ffffffff16565b9063ffffffff6111e416565b6000838152600a60205260409020555b506000818152600a6020908152604080832054600990925290912054819061091b908763ffffffff6111fb16565b111561092657600080fd5b600082815260096020526040902054610945908663ffffffff6111fb16565b600083815260096020908152604091829020839055815185815290810184905280820192909252517fe386b0e978b8d1cf769c13c3921e86191f97f4c601d0aae3a58f386cbbfae67e9181900360600190a16109a1868661120a565b9695505050505050565b600354600090819081908190600160a060020a03163314806109d75750600554600160a060020a031633145b15156109e257600080fd5b600160a060020a0387166000908152600f602052604090205460ff1615610a0857600080fd5b8451865114610a1657600080fd5b600160a060020a03871660009081526010602052604090205415610a5857600160a060020a0387166000908152601060205260408120610a56908261171e565b505b5050835190506000805b82811015610aa357610a99600e54600a0a8683815181101515610a8157fe5b6020908102909101015184910263ffffffff6111fb16565b9150600101610a62565b600160a060020a038716600090815260016020526040902054821115610ac857600080fd5b5060005b82811015610bfa576010600088600160a060020a0316600160a060020a031681526020019081526020016000206040805190810160405280600e54600a0a8885815181101515610b1857fe5b90602001906020020151028152602001610b508985815181101515610b3957fe5b60209081029091010151429063ffffffff6111fb16565b9052815460018181018455600093845260209384902083516002909302019182559290910151910155600e548551600160a060020a038916917f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b91600a9190910a90889085908110610bbe57fe5b9060200190602002015102610bda8985815181101515610b3957fe5b6040805192835260208301919091528051918290030190a2600101610acc565b5060019695505050505050565b600554600160a060020a031681565b600b5460ff1681565b600b5460009060ff1615610c3257600080fd5b6107518383611315565b600160a060020a031660009081526001602052604090205490565b600a6020526000908152604090205481565b600454600160a060020a03163314610c8057600080fd5b600454600354604051600160a060020a0392831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600480546003805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600354600160a060020a0316331480610d165750600554600160a060020a031633145b1515610d2157600080fd5b600b5460ff1615610d3157600080fd5b600b805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a03163314610d8057600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600354600160a060020a031681565b600d805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561072c5780601f106107015761010080835404028352916020019161072c565b6000610e2433610e7b565b821115610e3057600080fd5b6107518383611405565b60075481565b601060205281600052604060002081815481101515610e5b57fe5b600091825260209091206002909102018054600190910154909250905082565b600080610e888342611076565b600160a060020a038416600090815260016020526040902054910190610751908263ffffffff6111a716565b600454600160a060020a031681565b600b5460009060ff1615610ed657600080fd5b6107518383611422565b600354600090600160a060020a0316331480610f065750600554600160a060020a031633145b1515610f1157600080fd5b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519185169163a9059cbb916044808201926020929091908290030181600087803b158015610f8057600080fd5b505af1158015610f94573d6000803e3d6000fd5b505050506040513d6020811015610faa57600080fd5b50519392505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314806110015750600554600160a060020a031633145b151561100c57600080fd5b600160a060020a03166000908152600f60205260409020805460ff19166001179055565b600354600160a060020a0316331461104757600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805b600160a060020a03841660009081526010602052604090205481101561111c57600160a060020a03841660009081526010602052604090208054849190839081106110c157fe5b906000526020600020906002020160010154111561111457600160a060020a03841660009081526010602052604090208054829081106110fd57fe5b906000526020600020906002020160000154820191505b60010161107a565b5092915050565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600b5460009060ff161561119c57600080fd5b6107808484846114bb565b6000828211156111b357fe5b50900390565b6000808315156111cc576000915061111c565b508282028284828115156111dc57fe5b041461075157fe5b60008082848115156111f257fe5b04949350505050565b60008282018381101561075157fe5b600354600090600160a060020a03163314806112305750600554600160a060020a031633145b151561123b57600080fd5b60005461124e908363ffffffff6111fb16565b6000908155600160a060020a038416815260016020526040902054611279908363ffffffff6111fb16565b600160a060020a038416600081815260016020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561136a57336000908152600260209081526040808320600160a060020a038816845290915281205561139f565b61137a818463ffffffff6111a716565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600b5460009060ff161561141857600080fd5b6107518383611634565b336000908152600260209081526040808320600160a060020a0386168452909152812054611456908363ffffffff6111fb16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6000600160a060020a03831615156114d257600080fd5b600160a060020a0384166000908152600160205260409020548211156114f757600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561152757600080fd5b600160a060020a038416600090815260016020526040902054611550908363ffffffff6111a716565b600160a060020a038086166000908152600160205260408082209390935590851681522054611585908363ffffffff6111fb16565b600160a060020a0380851660009081526001602090815260408083209490945591871681526002825282812033825290915220546115c9908363ffffffff6111a716565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600061075183836000600160a060020a038316151561165257600080fd5b3360009081526001602052604090205482111561166e57600080fd5b3360009081526001602052604090205461168e908363ffffffff6111a716565b3360009081526001602052604080822092909255600160a060020a038516815220546116c0908363ffffffff6111fb16565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b81548183558181111561174a5760020281600202836000526020600020918201910161174a919061174f565b505050565b61177391905b8082111561176f5760008082556001820155600201611755565b5090565b905600a165627a7a723058205a6c3002ff28558a50e687f58a4de6802ada1b5bd1652ae0f29cb1269e2dc2290029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,912 |
0x88fc5ccad331408c72713d82bb6a637609a9f652
|
/**
*Submitted for verification at Etherscan.io on 2021-07-02
*/
/**
* Project -Found On Internet By TrustyDev
* https://t.me/FoundOnNet
*
*
*Found On Internet is a meme token with a twist!
*Found on Internet has no sale limitations, which benefits whales and minnows alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*
*
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract FoundOnInternet 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"FoundOnInternet";
string private constant _symbol = unicode"FOI";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 4;
uint256 private _teamFee = 6;
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(4)).div(10);
_teamFee = (_impactFee.mul(6)).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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600f81526020017f466f756e644f6e496e7465726e65740000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f464f490000000000000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960048461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660068461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122076f7b3c808de6074e30c85502b4ceb8df85af62af544dbda4861f369b5a5448564736f6c63430008040033
|
{"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"}]}}
| 2,913 |
0xcced0450f0df54b89a0f51c31241d35857bf7bfa
|
/*
SPDX-License-Identifier: Mines™®©
t.me/SkeetInu
AWW SKEET SKEET SKEET
Skeet Inu 💦
We appreciate the Myobu devs for their gigachad tokenomics
And above all we appreciate the devs at INTOXINU for providing
the foundational code that provided 90% of Myobu code base.
This project builds off of Myobu concepts and is designed to reward holders and discourage dumping.
Sell Cooldown Times:
1. First Sell - 1.5 hours
2. Second Sell - 3 hours
3. Third Sell - 9 hours
4. Fourth Sell - 1 day
1. Buy limit and cooldown timer (60 sec) on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP / Gets small fee
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
Marketing paid
Liqudity Locked
Ownership renounced (after open)
No Devwallets
CG, CMC listing: Ongoing
*/
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 SkeetInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Skeet Inu";
string private constant _symbol = unicode"SKEETINU💦";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 10;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 10;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (60 seconds);
_teamFee = 10;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (90 minutes);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (3 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (9 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
require(cooldownEnabled);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b604051610130919061322c565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612db3565b610418565b60405161016d9190613211565b60405180910390f35b34801561018257600080fd5b5061018b610436565b60405161019891906133ae565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d64565b610447565b6040516101d59190613211565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b6040516102009190613423565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612def565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cd6565b61064d565b60405161027d91906133ae565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf9190613143565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea919061322c565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612db3565b610857565b6040516103279190613211565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e41565b6109d3565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d28565b610b1c565b6040516103bb91906133ae565b60405180910390f35b3480156103d057600080fd5b506103d9610ba3565b005b60606040518060400160405280600981526020017f536b65657420496e750000000000000000000000000000000000000000000000815250905090565b600061042c6104256110af565b84846110b7565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611282565b610515846104606110af565b61051085604051806060016040528060288152602001613a0d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c66110af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120529092919063ffffffff16565b6110b7565b600190509392505050565b60006009905090565b6105316110af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b59061330e565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c6110af565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a816120b6565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b1565b9050919050565b6106a66110af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a9061330e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f534b454554494e55f09f92a60000000000000000000000000000000000000000815250905090565b600061086b6108646110af565b8484611282565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b66110af565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec8161221f565b50565b6108f76110af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b9061330e565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b601260189054906101000a900460ff166109b657600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109db6110af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5f9061330e565b60405180910390fd5b60008111610aab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa2906132ce565b60405180910390fd5b610ada6064610acc83683635c9adc5dea0000061251990919063ffffffff16565b61259490919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610b1191906133ae565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bab6110af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2f9061330e565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc830601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006110b7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0e57600080fd5b505afa158015610d22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d469190612cff565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da857600080fd5b505afa158015610dbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de09190612cff565b6040518363ffffffff1660e01b8152600401610dfd92919061315e565b602060405180830381600087803b158015610e1757600080fd5b505af1158015610e2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4f9190612cff565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed83061064d565b600080610ee36107f1565b426040518863ffffffff1660e01b8152600401610f05969594939291906131b0565b6060604051808303818588803b158015610f1e57600080fd5b505af1158015610f32573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f579190612e6a565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611059929190613187565b602060405180830381600087803b15801561107357600080fd5b505af1158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190612e18565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111e9061336e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118e9061328e565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161127591906133ae565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e99061334e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611362576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113599061324e565b60405180910390fd5b600081116113a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139c9061332e565b60405180910390fd5b6113ad6107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561141b57506113eb6107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f57601260189054906101000a900460ff161561164e573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561149d57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114f75750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115515750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561164d57601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115976110af565b73ffffffffffffffffffffffffffffffffffffffff16148061160d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115f56110af565b73ffffffffffffffffffffffffffffffffffffffff16145b61164c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116439061338e565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116fb57600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a65750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118145750601260189054906101000a900460ff165b156118ed57601260149054906101000a900460ff1661183257600080fd5b60135481111561184157600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061188c57600080fd5b603c426118999190613493565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a60098190555060026008819055505b60006118f83061064d565b9050601260169054906101000a900460ff161580156119655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561197d5750601260179054906101000a900460ff165b15611f8d576119d360646119c560036119b7601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61251990919063ffffffff16565b61259490919063ffffffff16565b82111580156119e457506013548211155b6119ed57600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3857600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a879190613493565b1015611ad3576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611c0a57600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b6b90613642565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061151842611bc29190613493565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f22565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611cfd57600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611ca290613642565b9190505550612a3042611cb59190613493565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f21565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611df057600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d9590613642565b9190505550617e9042611da89190613493565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f20565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f1f57600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e8890613642565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611edb9190613493565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f2b8161221f565b60004790506000811115611f4357611f42476120b6565b5b611f8b600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125de565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120365750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561204057600090505b61204c84848484612607565b50505050565b600083831115829061209a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612091919061322c565b60405180910390fd5b50600083856120a99190613574565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61210660028461259490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612131573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61218260028461259490919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121ad573d6000803e3d6000fd5b5050565b60006006548211156121f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ef9061326e565b60405180910390fd5b6000612202612646565b9050612217818461259490919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561227d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122ab5781602001602082028036833780820191505090505b50905030816000815181106122e9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561238b57600080fd5b505afa15801561239f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c39190612cff565b816001815181106123fd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061246430601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846110b7565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124c89594939291906133c9565b600060405180830381600087803b1580156124e257600080fd5b505af11580156124f6573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b60008083141561252c576000905061258e565b6000828461253a919061351a565b905082848261254991906134e9565b14612589576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612580906132ee565b60405180910390fd5b809150505b92915050565b60006125d683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612671565b905092915050565b806008546125ec919061351a565b600881905550600181111561260457600a6009819055505b50565b80612615576126146126d4565b5b612620848484612705565b8061262e5761262d612634565b5b50505050565b6007600881905550600a600981905550565b60008060006126536128d0565b9150915061266a818361259490919063ffffffff16565b9250505090565b600080831182906126b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126af919061322c565b60405180910390fd5b50600083856126c791906134e9565b9050809150509392505050565b60006008541480156126e857506000600954145b156126f257612703565b600060088190555060006009819055505b565b60008060008060008061271787612932565b95509550955095509550955061277586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061280a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129e490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061285681612a42565b6128608483612aff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128bd91906133ae565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea000009050612906683635c9adc5dea0000060065461259490919063ffffffff16565b82101561292557600654683635c9adc5dea0000093509350505061292e565b81819350935050505b9091565b600080600080600080600080600061294f8a600854600954612b39565b925092509250600061295f612646565b905060008060006129728e878787612bcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612052565b905092915050565b60008082846129f39190613493565b905083811015612a38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a2f906132ae565b60405180910390fd5b8091505092915050565b6000612a4c612646565b90506000612a63828461251990919063ffffffff16565b9050612ab781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129e490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b148260065461299a90919063ffffffff16565b600681905550612b2f816007546129e490919063ffffffff16565b6007819055505050565b600080600080612b656064612b57888a61251990919063ffffffff16565b61259490919063ffffffff16565b90506000612b8f6064612b81888b61251990919063ffffffff16565b61259490919063ffffffff16565b90506000612bb882612baa858c61299a90919063ffffffff16565b61299a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612be8858961251990919063ffffffff16565b90506000612bff868961251990919063ffffffff16565b90506000612c16878961251990919063ffffffff16565b90506000612c3f82612c31858761299a90919063ffffffff16565b61299a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c67816139c7565b92915050565b600081519050612c7c816139c7565b92915050565b600081359050612c91816139de565b92915050565b600081519050612ca6816139de565b92915050565b600081359050612cbb816139f5565b92915050565b600081519050612cd0816139f5565b92915050565b600060208284031215612ce857600080fd5b6000612cf684828501612c58565b91505092915050565b600060208284031215612d1157600080fd5b6000612d1f84828501612c6d565b91505092915050565b60008060408385031215612d3b57600080fd5b6000612d4985828601612c58565b9250506020612d5a85828601612c58565b9150509250929050565b600080600060608486031215612d7957600080fd5b6000612d8786828701612c58565b9350506020612d9886828701612c58565b9250506040612da986828701612cac565b9150509250925092565b60008060408385031215612dc657600080fd5b6000612dd485828601612c58565b9250506020612de585828601612cac565b9150509250929050565b600060208284031215612e0157600080fd5b6000612e0f84828501612c82565b91505092915050565b600060208284031215612e2a57600080fd5b6000612e3884828501612c97565b91505092915050565b600060208284031215612e5357600080fd5b6000612e6184828501612cac565b91505092915050565b600080600060608486031215612e7f57600080fd5b6000612e8d86828701612cc1565b9350506020612e9e86828701612cc1565b9250506040612eaf86828701612cc1565b9150509250925092565b6000612ec58383612ed1565b60208301905092915050565b612eda816135a8565b82525050565b612ee9816135a8565b82525050565b6000612efa8261344e565b612f048185613471565b9350612f0f8361343e565b8060005b83811015612f40578151612f278882612eb9565b9750612f3283613464565b925050600181019050612f13565b5085935050505092915050565b612f56816135ba565b82525050565b612f65816135fd565b82525050565b6000612f7682613459565b612f808185613482565b9350612f9081856020860161360f565b612f99816136e9565b840191505092915050565b6000612fb1602383613482565b9150612fbc826136fa565b604082019050919050565b6000612fd4602a83613482565b9150612fdf82613749565b604082019050919050565b6000612ff7602283613482565b915061300282613798565b604082019050919050565b600061301a601b83613482565b9150613025826137e7565b602082019050919050565b600061303d601d83613482565b915061304882613810565b602082019050919050565b6000613060602183613482565b915061306b82613839565b604082019050919050565b6000613083602083613482565b915061308e82613888565b602082019050919050565b60006130a6602983613482565b91506130b1826138b1565b604082019050919050565b60006130c9602583613482565b91506130d482613900565b604082019050919050565b60006130ec602483613482565b91506130f78261394f565b604082019050919050565b600061310f601183613482565b915061311a8261399e565b602082019050919050565b61312e816135e6565b82525050565b61313d816135f0565b82525050565b60006020820190506131586000830184612ee0565b92915050565b60006040820190506131736000830185612ee0565b6131806020830184612ee0565b9392505050565b600060408201905061319c6000830185612ee0565b6131a96020830184613125565b9392505050565b600060c0820190506131c56000830189612ee0565b6131d26020830188613125565b6131df6040830187612f5c565b6131ec6060830186612f5c565b6131f96080830185612ee0565b61320660a0830184613125565b979650505050505050565b60006020820190506132266000830184612f4d565b92915050565b600060208201905081810360008301526132468184612f6b565b905092915050565b6000602082019050818103600083015261326781612fa4565b9050919050565b6000602082019050818103600083015261328781612fc7565b9050919050565b600060208201905081810360008301526132a781612fea565b9050919050565b600060208201905081810360008301526132c78161300d565b9050919050565b600060208201905081810360008301526132e781613030565b9050919050565b6000602082019050818103600083015261330781613053565b9050919050565b6000602082019050818103600083015261332781613076565b9050919050565b6000602082019050818103600083015261334781613099565b9050919050565b60006020820190508181036000830152613367816130bc565b9050919050565b60006020820190508181036000830152613387816130df565b9050919050565b600060208201905081810360008301526133a781613102565b9050919050565b60006020820190506133c36000830184613125565b92915050565b600060a0820190506133de6000830188613125565b6133eb6020830187612f5c565b81810360408301526133fd8186612eef565b905061340c6060830185612ee0565b6134196080830184613125565b9695505050505050565b60006020820190506134386000830184613134565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061349e826135e6565b91506134a9836135e6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134de576134dd61368b565b5b828201905092915050565b60006134f4826135e6565b91506134ff836135e6565b92508261350f5761350e6136ba565b5b828204905092915050565b6000613525826135e6565b9150613530836135e6565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135695761356861368b565b5b828202905092915050565b600061357f826135e6565b915061358a836135e6565b92508282101561359d5761359c61368b565b5b828203905092915050565b60006135b3826135c6565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613608826135e6565b9050919050565b60005b8381101561362d578082015181840152602081019050613612565b8381111561363c576000848401525b50505050565b600061364d826135e6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156136805761367f61368b565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139d0816135a8565b81146139db57600080fd5b50565b6139e7816135ba565b81146139f257600080fd5b50565b6139fe816135e6565b8114613a0957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200e9582a5000e0224c3d4c71e05528c5996a7b61ed1a900afc585a4de7e01667164736f6c63430008040033
|
{"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"}]}}
| 2,914 |
0x7abbfb2a4e30c7fd9b1d54bd97b2b89a3eb56ab3
|
/**
*Submitted for verification at Etherscan.io on 2022-03-19
*/
//Website: Thanosinu.space
//Telegram: https://t.me/thanosinu
// 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 ThanosInu 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 maxTxAmount = _tTotal;
uint256 private maxWalletAmount = _tTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private setTax;
uint256 private setRedis;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Thanos Inu";
string private constant _symbol = "Thanos";
uint256 private constant _minEthToSend = 300000000000000000;
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;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1,address payable _add2) {
require(_add1 != address(0)); //Making Sure Fee address is not zero
require(_add2 != address(0));
_feeAddrWallet1 = _add1;
_feeAddrWallet2 = _add2;
_rOwned[_feeAddrWallet1] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), _feeAddrWallet1, _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if(!(_isExcludedFromFee[from] || _isExcludedFromFee[to])){
if (from != address(this)) {
require(amount <= maxTxAmount);
_feeAddr1 = setRedis;
_feeAddr2 = setTax;
if(to != uniswapV2Pair){
if(balanceOf(to)+ (amount *(1- _feeAddr2/100)) > maxWalletAmount){
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > _tTotal/1000){
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > _minEthToSend) {
sendETHToFee(address(this).balance);
}
}
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
uint256 toSend = amount/5;
_feeAddrWallet2.transfer(toSend);
_feeAddrWallet1.transfer(amount - toSend);
}
function liftMaxTrnx() external onlyOwner{
maxTxAmount = _tTotal;
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
setTax = 10;
setRedis = 3;
maxTxAmount = _tTotal/200;
maxWalletAmount = _tTotal/50;
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklist(address _address) external onlyOwner{
bots[_address] = true;
}
function removeBlacklist(address notbot) external 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610352578063c9567bf914610369578063dd62ed3e14610380578063eb91e651146103bd578063f9f92be4146103e657610114565b8063715018a6146102a85780638da5cb5b146102bf57806395d89b41146102ea578063a9059cbb1461031557610114565b8063313ce567116100dc578063313ce567146101e957806335ffbc47146102145780635932ead11461022b5780636fc3eaec1461025457806370a082311461026b57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61040f565b60405161013b91906127c4565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906123dd565b61044c565b60405161017891906127a9565b60405180910390f35b34801561018d57600080fd5b5061019661046a565b6040516101a391906128e6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061238e565b61047b565b6040516101e091906127a9565b60405180910390f35b3480156101f557600080fd5b506101fe610554565b60405161020b919061295b565b60405180910390f35b34801561022057600080fd5b5061022961055d565b005b34801561023757600080fd5b50610252600480360381019061024d9190612419565b610604565b005b34801561026057600080fd5b506102696106b6565b005b34801561027757600080fd5b50610292600480360381019061028d9190612300565b610728565b60405161029f91906128e6565b60405180910390f35b3480156102b457600080fd5b506102bd610779565b005b3480156102cb57600080fd5b506102d46108cc565b6040516102e191906126db565b60405180910390f35b3480156102f657600080fd5b506102ff6108f5565b60405161030c91906127c4565b60405180910390f35b34801561032157600080fd5b5061033c600480360381019061033791906123dd565b610932565b60405161034991906127a9565b60405180910390f35b34801561035e57600080fd5b50610367610950565b005b34801561037557600080fd5b5061037e6109ca565b005b34801561038c57600080fd5b506103a760048036038101906103a29190612352565b610f5f565b6040516103b491906128e6565b60405180910390f35b3480156103c957600080fd5b506103e460048036038101906103df9190612300565b610fe6565b005b3480156103f257600080fd5b5061040d60048036038101906104089190612300565b6110d6565b005b60606040518060400160405280600a81526020017f5468616e6f7320496e7500000000000000000000000000000000000000000000815250905090565b60006104606104596111c6565b84846111ce565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610488848484611399565b610549846104946111c6565b61054485604051806060016040528060288152602001612e3560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104fa6111c6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461170e9092919063ffffffff16565b6111ce565b600190509392505050565b60006009905090565b6105656111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e990612866565b60405180910390fd5b683635c9adc5dea00000600a81905550565b61060c6111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069090612866565b60405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106f76111c6565b73ffffffffffffffffffffffffffffffffffffffff161461071757600080fd5b600047905061072581611772565b50565b6000610772600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611864565b9050919050565b6107816111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080590612866565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f5468616e6f730000000000000000000000000000000000000000000000000000815250905090565b600061094661093f6111c6565b8484611399565b6001905092915050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109916111c6565b73ffffffffffffffffffffffffffffffffffffffff16146109b157600080fd5b60006109bc30610728565b90506109c7816118d2565b50565b6109d26111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5690612866565b60405180910390fd5b601360149054906101000a900460ff1615610aaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa6906128c6565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b3f30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006111ce565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8557600080fd5b505afa158015610b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbd9190612329565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1f57600080fd5b505afa158015610c33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c579190612329565b6040518363ffffffff1660e01b8152600401610c749291906126f6565b602060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc69190612329565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d4f30610728565b600080610d5a6108cc565b426040518863ffffffff1660e01b8152600401610d7c96959493929190612748565b6060604051808303818588803b158015610d9557600080fd5b505af1158015610da9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dce919061246b565b505050600a600e819055506003600f8190555060c8683635c9adc5dea00000610df79190612a21565b600a819055506032683635c9adc5dea00000610e139190612a21565b600b819055506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610f0992919061271f565b602060405180830381600087803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5b9190612442565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610fee6111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461107b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107290612866565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6110de6111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116290612866565b60405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561123e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611235906128a6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a590612806565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161138c91906128e6565b60405180910390a3505050565b600081116113dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d390612886565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561143357600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806114d45750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6116fe573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146116fd57600a5481111561151a57600080fd5b600f54600c81905550600e54600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461161d57600b546064600d546115939190612a21565b600161159f9190612aac565b826115aa9190612a52565b6115b384610728565b6115bd91906129cb565b111561161c576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b600061162830610728565b90506103e8683635c9adc5dea000006116419190612a21565b8111156116fb57601360159054906101000a900460ff161580156116b35750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156116cb5750601360169054906101000a900460ff165b156116fa576116d9816118d2565b6000479050670429d069189e00008111156116f8576116f747611772565b5b505b5b505b5b611709838383611bcc565b505050565b6000838311158290611756576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174d91906127c4565b60405180910390fd5b50600083856117659190612aac565b9050809150509392505050565b60006005826117819190612a21565b9050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156117eb573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc82846118349190612aac565b9081150290604051600060405180830381858888f1935050505015801561185f573d6000803e3d6000fd5b505050565b60006008548211156118ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a2906127e6565b60405180910390fd5b60006118b5611bdc565b90506118ca8184611c0790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611930577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561195e5781602001602082028036833780820191505090505b509050308160008151811061199c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3e57600080fd5b505afa158015611a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a769190612329565b81600181518110611ab0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611b1730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111ce565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b7b959493929190612901565b600060405180830381600087803b158015611b9557600080fd5b505af1158015611ba9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b611bd7838383611c51565b505050565b6000806000611be9611e1c565b91509150611c008183611c0790919063ffffffff16565b9250505090565b6000611c4983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e7e565b905092915050565b600080600080600080611c6387611ee1565b955095509550955095509550611cc186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f4990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d5685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611da281611ff1565b611dac84836120ae565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611e0991906128e6565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea000009050611e52683635c9adc5dea00000600854611c0790919063ffffffff16565b821015611e7157600854683635c9adc5dea00000935093505050611e7a565b81819350935050505b9091565b60008083118290611ec5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ebc91906127c4565b60405180910390fd5b5060008385611ed49190612a21565b9050809150509392505050565b6000806000806000806000806000611efe8a600c54600d546120e8565b9250925092506000611f0e611bdc565b90506000806000611f218e87878761217e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611f8b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061170e565b905092915050565b6000808284611fa291906129cb565b905083811015611fe7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fde90612826565b60405180910390fd5b8091505092915050565b6000611ffb611bdc565b90506000612012828461220790919063ffffffff16565b905061206681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6120c382600854611f4990919063ffffffff16565b6008819055506120de81600954611f9390919063ffffffff16565b6009819055505050565b6000806000806121146064612106888a61220790919063ffffffff16565b611c0790919063ffffffff16565b9050600061213e6064612130888b61220790919063ffffffff16565b611c0790919063ffffffff16565b9050600061216782612159858c611f4990919063ffffffff16565b611f4990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612197858961220790919063ffffffff16565b905060006121ae868961220790919063ffffffff16565b905060006121c5878961220790919063ffffffff16565b905060006121ee826121e08587611f4990919063ffffffff16565b611f4990919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561221a576000905061227c565b600082846122289190612a52565b90508284826122379190612a21565b14612277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226e90612846565b60405180910390fd5b809150505b92915050565b60008135905061229181612def565b92915050565b6000815190506122a681612def565b92915050565b6000813590506122bb81612e06565b92915050565b6000815190506122d081612e06565b92915050565b6000813590506122e581612e1d565b92915050565b6000815190506122fa81612e1d565b92915050565b60006020828403121561231257600080fd5b600061232084828501612282565b91505092915050565b60006020828403121561233b57600080fd5b600061234984828501612297565b91505092915050565b6000806040838503121561236557600080fd5b600061237385828601612282565b925050602061238485828601612282565b9150509250929050565b6000806000606084860312156123a357600080fd5b60006123b186828701612282565b93505060206123c286828701612282565b92505060406123d3868287016122d6565b9150509250925092565b600080604083850312156123f057600080fd5b60006123fe85828601612282565b925050602061240f858286016122d6565b9150509250929050565b60006020828403121561242b57600080fd5b6000612439848285016122ac565b91505092915050565b60006020828403121561245457600080fd5b6000612462848285016122c1565b91505092915050565b60008060006060848603121561248057600080fd5b600061248e868287016122eb565b935050602061249f868287016122eb565b92505060406124b0868287016122eb565b9150509250925092565b60006124c683836124d2565b60208301905092915050565b6124db81612ae0565b82525050565b6124ea81612ae0565b82525050565b60006124fb82612986565b61250581856129a9565b935061251083612976565b8060005b8381101561254157815161252888826124ba565b97506125338361299c565b925050600181019050612514565b5085935050505092915050565b61255781612af2565b82525050565b61256681612b35565b82525050565b600061257782612991565b61258181856129ba565b9350612591818560208601612b47565b61259a81612bd8565b840191505092915050565b60006125b2602a836129ba565b91506125bd82612be9565b604082019050919050565b60006125d56022836129ba565b91506125e082612c38565b604082019050919050565b60006125f8601b836129ba565b915061260382612c87565b602082019050919050565b600061261b6021836129ba565b915061262682612cb0565b604082019050919050565b600061263e6020836129ba565b915061264982612cff565b602082019050919050565b60006126616029836129ba565b915061266c82612d28565b604082019050919050565b60006126846024836129ba565b915061268f82612d77565b604082019050919050565b60006126a76017836129ba565b91506126b282612dc6565b602082019050919050565b6126c681612b1e565b82525050565b6126d581612b28565b82525050565b60006020820190506126f060008301846124e1565b92915050565b600060408201905061270b60008301856124e1565b61271860208301846124e1565b9392505050565b600060408201905061273460008301856124e1565b61274160208301846126bd565b9392505050565b600060c08201905061275d60008301896124e1565b61276a60208301886126bd565b612777604083018761255d565b612784606083018661255d565b61279160808301856124e1565b61279e60a08301846126bd565b979650505050505050565b60006020820190506127be600083018461254e565b92915050565b600060208201905081810360008301526127de818461256c565b905092915050565b600060208201905081810360008301526127ff816125a5565b9050919050565b6000602082019050818103600083015261281f816125c8565b9050919050565b6000602082019050818103600083015261283f816125eb565b9050919050565b6000602082019050818103600083015261285f8161260e565b9050919050565b6000602082019050818103600083015261287f81612631565b9050919050565b6000602082019050818103600083015261289f81612654565b9050919050565b600060208201905081810360008301526128bf81612677565b9050919050565b600060208201905081810360008301526128df8161269a565b9050919050565b60006020820190506128fb60008301846126bd565b92915050565b600060a08201905061291660008301886126bd565b612923602083018761255d565b818103604083015261293581866124f0565b905061294460608301856124e1565b61295160808301846126bd565b9695505050505050565b600060208201905061297060008301846126cc565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006129d682612b1e565b91506129e183612b1e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a1657612a15612b7a565b5b828201905092915050565b6000612a2c82612b1e565b9150612a3783612b1e565b925082612a4757612a46612ba9565b5b828204905092915050565b6000612a5d82612b1e565b9150612a6883612b1e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612aa157612aa0612b7a565b5b828202905092915050565b6000612ab782612b1e565b9150612ac283612b1e565b925082821015612ad557612ad4612b7a565b5b828203905092915050565b6000612aeb82612afe565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612b4082612b1e565b9050919050565b60005b83811015612b65578082015181840152602081019050612b4a565b83811115612b74576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612df881612ae0565b8114612e0357600080fd5b50565b612e0f81612af2565b8114612e1a57600080fd5b50565b612e2681612b1e565b8114612e3157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fd4d69c408fec988227ec70c3e1cb2d0f7856a6bcbd3147a7a7ad951bd0334a464736f6c63430008040033
|
{"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"}]}}
| 2,915 |
0x25cd858a00146961611b18441353603191f110a0
|
/**
*Submitted for verification at Etherscan.io on 2021-02-04
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// UNIV2LPOracle.sol
// Copyright (C) 2017-2021 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////
// //
// Methodology for Calculating LP Token Price //
// //
///////////////////////////////////////////////////////
// INVARIANT k = reserve0 [num token0] * reserve1 [num token1]
//
// k = r_x * r_y
// r_y = k / r_x
//
// 50-50 pools try to stay balanced in dollar terms
// r_x * p_x = r_y * p_y // Proportion of r_x and r_y can be manipulated so need to normalize them
//
// r_x * p_x = p_y * (k / r_x)
// r_x^2 = k * p_y / p_x
// r_x = sqrt(k * p_y / p_x) & r_y = sqrt(k * p_x / p_y)
//
// Now that we've calculated normalized values of r_x and r_y that are not prone to manipulation by an attacker,
// we can calculate the price of an lp token using the following formula.
//
// p_lp = (r_x * p_x + r_y * p_y) / supply_lp
//
pragma solidity ^0.6.11;
interface ERC20Like {
function decimals() external view returns (uint8);
function balanceOf(address) external view returns (uint256);
function totalSupply() external view returns (uint256);
}
interface UniswapV2PairLike {
function sync() external;
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112,uint112,uint32); // reserve0, reserve1, blockTimestampLast
}
interface OracleLike {
function read() external view returns (uint256);
function peek() external view returns (uint256,bool);
}
// Factory for creating Uniswap V2 LP Token Oracle instances
contract UNIV2LPOracleFactory {
mapping(address => bool) public isOracle;
event Created(address sender, address orcl, bytes32 wat, address tok0, address tok1, address orb0, address orb1);
// Create new Uniswap V2 LP Token Oracle instance
function build(address _src, bytes32 _wat, address _orb0, address _orb1) public returns (address orcl) {
address tok0 = UniswapV2PairLike(_src).token0();
address tok1 = UniswapV2PairLike(_src).token1();
orcl = address(new UNIV2LPOracle(_src, _wat, _orb0, _orb1));
UNIV2LPOracle(orcl).rely(msg.sender);
isOracle[orcl] = true;
emit Created(msg.sender, orcl, _wat, tok0, tok1, _orb0, _orb1);
}
}
contract UNIV2LPOracle {
// --- Auth ---
mapping (address => uint) public wards; // Addresses with admin authority
function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); } // Add admin
function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "UNIV2LPOracle/not-authorized");
_;
}
// --- Stop ---
uint256 public stopped; // Stop/start ability to read
modifier stoppable { require(stopped == 0, "UNIV2LPOracle/is-stopped"); _; }
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "UNIV2LPOracle/contract-not-whitelisted"); _; }
// --- Data ---
uint8 public immutable dec0; // Decimals of token0
uint8 public immutable dec1; // Decimals of token1
address public orb0; // Oracle for token0, ideally a Medianizer
address public orb1; // Oracle for token1, ideally a Medianizer
bytes32 public immutable wat; // Token whose price is being tracked
uint32 public hop = 1 hours; // Minimum time inbetween price updates
address public src; // Price source
uint32 public zzz; // Time of last price update
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed public cur; // Current price
Feed public nxt; // Queued price
// --- Math ---
uint256 constant WAD = 10 ** 18;
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");
}
function div(uint x, uint y) internal pure returns (uint z) {
require(y > 0 && (z = x / y) * y == x, "ds-math-divide-by-zero");
}
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
// Compute the square root using the Babylonian method.
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Change(address indexed src);
event Step(uint256 hop);
event Stop();
event Start();
event Value(uint128 curVal, uint128 nxtVal);
event Link(uint256 id, address orb);
// --- Init ---
constructor (address _src, bytes32 _wat, address _orb0, address _orb1) public {
require(_src != address(0), "UNIV2LPOracle/invalid-src-address");
require(_orb0 != address(0) && _orb1 != address(0), "UNIV2LPOracle/invalid-oracle-address");
wards[msg.sender] = 1;
src = _src;
zzz = 0;
wat = _wat;
dec0 = uint8(ERC20Like(UniswapV2PairLike(_src).token0()).decimals()); // Get decimals of token0
dec1 = uint8(ERC20Like(UniswapV2PairLike(_src).token1()).decimals()); // Get decimals of token1
orb0 = _orb0;
orb1 = _orb1;
}
function stop() external auth {
stopped = 1;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function change(address _src) external auth {
src = _src;
emit Change(src);
}
function step(uint256 _hop) external auth {
require(_hop <= uint32(-1), "UNIV2LPOracle/invalid-hop");
hop = uint32(_hop);
emit Step(hop);
}
function link(uint256 id, address orb) external auth {
require(orb != address(0), "UNIV2LPOracle/no-contract-0");
if(id == 0) {
orb0 = orb;
} else if (id == 1) {
orb1 = orb;
}
emit Link(id, orb);
}
function pass() public view returns (bool ok) {
return block.timestamp >= add(zzz, hop);
}
function seek() internal returns (uint128 quote, uint32 ts) {
// Sync up reserves of uniswap liquidity pool
UniswapV2PairLike(src).sync();
// Get reserves of uniswap liquidity pool
(uint112 res0, uint112 res1, uint32 _ts) = UniswapV2PairLike(src).getReserves();
require(res0 > 0 && res1 > 0, "UNIV2LPOracle/invalid-reserves");
ts = _ts;
require(ts == block.timestamp);
// Adjust reserves w/ respect to decimals
if (dec0 != uint8(18)) res0 = uint112(res0 * 10 ** sub(18, dec0));
if (dec1 != uint8(18)) res1 = uint112(res1 * 10 ** sub(18, dec1));
// Calculate constant product invariant k (WAD * WAD)
uint256 k = mul(res0, res1);
// All Oracle prices are priced with 18 decimals against USD
uint256 val0 = OracleLike(orb0).read(); // Query token0 price from oracle (WAD)
uint256 val1 = OracleLike(orb1).read(); // Query token1 price from oracle (WAD)
require(val0 != 0, "UNIV2LPOracle/invalid-oracle-0-price");
require(val1 != 0, "UNIV2LPOracle/invalid-oracle-1-price");
// Calculate normalized balances of token0 and token1
uint256 bal0 =
sqrt(
wmul(
k,
wdiv(
val1,
val0
)
)
);
uint256 bal1 = wdiv(k, bal0) / WAD;
// Get LP token supply
uint256 supply = ERC20Like(src).totalSupply();
require(supply > 0, "UNIV2LPOracle/invalid-lp-token-supply");
// Calculate price quote of LP token
quote = uint128(
wdiv(
add(
wmul(bal0, val0), // (WAD)
wmul(bal1, val1) // (WAD)
),
supply // (WAD)
)
);
}
function poke() external stoppable {
require(pass(), "UNIV2LPOracle/not-passed");
(uint val, uint32 ts) = seek();
require(val != 0, "UNIV2LPOracle/invalid-price");
cur = nxt;
nxt = Feed(uint128(val), 1);
zzz = ts;
emit Value(cur.val, nxt.val);
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "UNIV2LPOracle/no-current-value");
return (bytes32(uint(cur.val)));
}
function kiss(address a) external auth {
require(a != address(0), "UNIV2LPOracle/no-contract-0");
bud[a] = 1;
}
function kiss(address[] calldata a) external auth {
for(uint i = 0; i < a.length; i++) {
require(a[i] != address(0), "UNIV2LPOracle/no-contract-0");
bud[a[i]] = 1;
}
}
function diss(address a) external auth {
bud[a] = 0;
}
function diss(address[] calldata a) external auth {
for(uint i = 0; i < a.length; i++) {
bud[a[i]] = 0;
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806365af790911610104578063a7a1ed72116100a2578063c478a1b111610071578063c478a1b1146107b0578063cc32b7d5146107d4578063dca44f6f146107f8578063f29c29c414610842576101cf565b8063a7a1ed7214610702578063b0b8579b14610724578063be9a65551461074e578063bf353dbb14610758576101cf565b80636c2552f9116100de5780636c2552f91461062c57806375f12b21146106765780639c52a7f114610694578063a4dff0a2146106d8576101cf565b806365af79091461055657806365c4ce7a146105a457806365fae35e146105e8576101cf565b80633a1cde75116101715780634fce7a2a1161014b5780634fce7a2a1461044a5780634fe24251146104a257806357de26a41461050f57806359e02dd71461052d576101cf565b80633a1cde751461038557806346d4577d146103b35780634ca299231461042c576101cf565b806318178358116101ad57806318178358146102745780631b25b65f1461027e5780631e77933e146102f75780632e7dc6af1461033b576101cf565b806303e0187a146101d457806307da68f5146102415780630e5a6c701461024b575b600080fd5b6101dc610886565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6102496108d0565b005b6102536109b9565b60405180838152602001821515151581526020019250505060405180910390f35b61027c610aca565b005b6102f56004803603602081101561029457600080fd5b81019080803590602001906401000000008111156102b157600080fd5b8201836020820111156102c357600080fd5b803590602001918460208302840111640100000000831117156102e557600080fd5b9091929391929390505050610ebc565b005b6103396004803603602081101561030d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110cb565b005b610343611228565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103b16004803603602081101561039b57600080fd5b810190808035906020019092919050505061124e565b005b61042a600480360360208110156103c957600080fd5b81019080803590602001906401000000008111156103e657600080fd5b8201836020820111156103f857600080fd5b8035906020019184602083028401116401000000008311171561041a57600080fd5b9091929391929390505050611411565b005b610434611555565b6040518082815260200191505060405180910390f35b61048c6004803603602081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611579565b6040518082815260200191505060405180910390f35b6104aa611591565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6105176115db565b6040518082815260200191505060405180910390f35b61053561175a565b60405180838152602001821515151581526020019250505060405180910390f35b6105a26004803603604081101561056c57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061186b565b005b6105e6600480360360208110156105ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611acc565b005b61062a600480360360208110156105fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bc8565b005b610634611d06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61067e611d2c565b6040518082815260200191505060405180910390f35b6106d6600480360360208110156106aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d32565b005b6106e0611e70565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b61070a611e86565b604051808215151515815260200191505060405180910390f35b61072c611eca565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b610756611ee0565b005b61079a6004803603602081101561076e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fca565b6040518082815260200191505060405180910390f35b6107b8611fe2565b604051808260ff1660ff16815260200191505060405180910390f35b6107dc612006565b604051808260ff1660ff16815260200191505060405180910390f35b61080061202a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108846004803603602081101561085857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612050565b005b60078060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600180819055507fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b60405160405180910390a1565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610a54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b600760000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600760000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b600060015414610b42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f69732d73746f70706564000000000000000081525060200191505060405180910390fd5b610b4a611e86565b610bbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f6e6f742d706173736564000000000000000081525060200191505060405180910390fd5b600080610bc76121ef565b91506fffffffffffffffffffffffffffffffff1691506000821415610c54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f696e76616c69642d7072696365000000000081525060200191505060405180910390fd5b600760066000820160009054906101000a90046fffffffffffffffffffffffffffffffff168160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000820160109054906101000a90046fffffffffffffffffffffffffffffffff168160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055509050506040518060400160405280836fffffffffffffffffffffffffffffffff16815260200160016fffffffffffffffffffffffffffffffff16815250600760008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505080600560146101000a81548163ffffffff021916908363ffffffff1602179055507f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73600660000160009054906101000a90046fffffffffffffffffffffffffffffffff16600760000160009054906101000a90046fffffffffffffffffffffffffffffffff1660405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610f70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008090505b828290508110156110c657600073ffffffffffffffffffffffffffffffffffffffff16838383818110610fa557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561104c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b60016002600085858581811061105e57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050610f76565b505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f02dc774d82d07722c8c43c212eebb2feaea7924c5472da3b7c2ba5fb532087c760405160405180910390a250565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff1681111561139e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f554e4956324c504f7261636c652f696e76616c69642d686f700000000000000081525060200191505060405180910390fd5b80600460146101000a81548163ffffffff021916908363ffffffff1602179055507fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817600460149054906101000a900463ffffffff16604051808263ffffffff16815260200191505060405180910390a150565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008090505b82829050811015611550576000600260008585858181106114e857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806001019150506114cb565b505050565b7f554e49563244414955534443000000000000000000000000000000000000000081565b60026020528060005260406000206000915090505481565b60068060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60006001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611675576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b6001600660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff161461171e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f6e6f2d63757272656e742d76616c7565000081525060200191505060405180910390fd5b600660000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b905090565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146117f5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b600660000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461191f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6000821415611a115780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a5d565b6001821415611a5c5780600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b7f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a78282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611c7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611de6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b600560149054906101000a900463ffffffff1681565b6000611ec2600560149054906101000a900463ffffffff1663ffffffff16600460149054906101000a900463ffffffff1663ffffffff16612877565b421015905090565b600460149054906101000a900463ffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611f94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60006001819055507f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b60405160405180910390a1565b60006020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000001281565b7f000000000000000000000000000000000000000000000000000000000000000681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612104576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561225c57600080fd5b505af1158015612270573d6000803e3d6000fd5b505050506000806000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156122e157600080fd5b505afa1580156122f5573d6000803e3d6000fd5b505050506040513d606081101561230b57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092506000836dffffffffffffffffffffffffffff1611801561236657506000826dffffffffffffffffffffffffffff16115b6123d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f696e76616c69642d7265736572766573000081525060200191505060405180910390fd5b809350428463ffffffff16146123ed57600080fd5b601260ff167f000000000000000000000000000000000000000000000000000000000000001260ff16146124615761244960127f000000000000000000000000000000000000000000000000000000000000001260ff166128fa565b600a0a836dffffffffffffffffffffffffffff160292505b601260ff167f000000000000000000000000000000000000000000000000000000000000000660ff16146124d5576124bd60127f000000000000000000000000000000000000000000000000000000000000000660ff166128fa565b600a0a826dffffffffffffffffffffffffffff160291505b6000612501846dffffffffffffffffffffffffffff16846dffffffffffffffffffffffffffff1661297d565b90506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561256d57600080fd5b505afa158015612581573d6000803e3d6000fd5b505050506040513d602081101561259757600080fd5b810190808051906020019092919050505090506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561261457600080fd5b505afa158015612628573d6000803e3d6000fd5b505050506040513d602081101561263e57600080fd5b8101908080519060200190929190505050905060008214156126ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b126024913960400191505060405180910390fd5b6000811415612705576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b5c6024913960400191505060405180910390fd5b600061272261271d856127188587612a12565b612a4a565b612a8a565b90506000670de0b6b3a76400006127398684612a12565b8161274057fe5b0490506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127ad57600080fd5b505afa1580156127c1573d6000803e3d6000fd5b505050506040513d60208110156127d757600080fd5b8101908080519060200190929190505050905060008111612843576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612aed6025913960400191505060405180910390fd5b6128686128626128538588612a4a565b61285d8588612a4a565b612877565b82612a12565b9a505050505050505050509091565b60008282840191508110156128f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6164642d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b6000828284039150811115612977576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f64732d6d6174682d7375622d756e646572666c6f77000000000000000000000081525060200191505060405180910390fd5b92915050565b60008082148061299a575082828385029250828161299757fe5b04145b612a0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6d756c2d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b600081612a3a612a2a85670de0b6b3a764000061297d565b60028581612a3457fe5b04612877565b81612a4157fe5b04905092915050565b6000670de0b6b3a7640000612a7a612a62858561297d565b6002670de0b6b3a764000081612a7457fe5b04612877565b81612a8157fe5b04905092915050565b60006003821115612ad9578190506000600160028481612aa657fe5b040190505b81811015612ad357809150600281828581612ac257fe5b040181612acb57fe5b049050612aab565b50612ae7565b60008214612ae657600190505b5b91905056fe554e4956324c504f7261636c652f696e76616c69642d6c702d746f6b656e2d737570706c79554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d302d7072696365554e4956324c504f7261636c652f636f6e74726163742d6e6f742d77686974656c6973746564554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d312d7072696365a2646970667358221220e599d708073da5d75f40a1cf8a338fb7b59c9d8f808932a3645acb9baf2d766264736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 2,916 |
0xfc88a9f06f5fe0de2dac95c5fada7a8b3b3d610d
|
pragma solidity ^0.4.19;
////////////////////////////////////
////// CRYPTO SURPRISE
////// https://cryptosurprise.me
////////////////////////////////////
contract CryptoSurprise
{
using SetLibrary for SetLibrary.Set;
////////////////////////////////////
////// CONSTANTS
uint256 constant public BAG_TRANSFER_FEE = 0.05 ether;
uint256 constant public BAG_TRANSFER_MINIMUM_AMOUNT_OF_BUYS = 4;
////////////////////////////////////
////// STATE VARIABLES
struct BagType
{
// Constants
string name;
uint256 startPrice;
uint256 priceMultiplierPerBuy; // For example, 2 000 000 means 100% increase. (100% = doubling every buy)
uint256 startCommission; // 0 to 1 000 000, for example 100 000 means 10%
uint256 commissionIncrementPerBuy;
uint256 maximumCommission;
uint256 supplyHardCap;
// Variables
uint256 currentSupply;
}
struct Bag
{
// Constants
uint256 bagTypeIndex;
// Variables
uint256 amountOfBuys;
address owner;
uint256 commission; // 0 to 1 000 000, for example 100 000 means 10%
uint256 price;
uint256 availableTimestamp;
}
// Variable that remembers the current owner
address public owner;
BagType[] public bagTypes;
Bag[] public bags;
mapping(address => uint256) public addressToTotalEtherSpent;
mapping(address => uint256) public addressToTotalPurchasesMade;
mapping(address => SetLibrary.Set) private ownerToBagIndices;
address[] public allParticipants;
////////////////////////////////////
////// PLAYER FUNCTIONS
function buyBag(uint256 _bagIndex) external payable
{
// Make sure that the bag exists
require(_bagIndex < bags.length);
// Reference the bag data and bag type data
Bag storage bag = bags[_bagIndex];
BagType storage bagType = bagTypes[bag.bagTypeIndex];
// Make sure the bag is already available
require(now >= bag.availableTimestamp);
// Make sure the caller payed at least the current price
require(msg.value >= bag.price);
uint256 refund = msg.value - bag.price;
// Remember who the previous owner was
address previousOwner = bag.owner;
// Set the buyer as the new owner
bag.owner = msg.sender;
// Calculate the previous and next price
uint256 previousPrice = bag.price * 1000000 / bagType.priceMultiplierPerBuy;
uint256 nextPrice = bag.price * bagType.priceMultiplierPerBuy / 1000000;
// Calculate how much the previous owner should get:
uint256 previousOwnerReward;
// If this is the first buy: the full current price
if (bag.amountOfBuys == 0)
{
previousOwnerReward = bag.price;
}
// otherwise: previous price + the commission
else
{
previousOwnerReward = bag.price * bag.commission / 1000000;
//previousOwnerReward = previousPrice + previousPrice * bag.commission / 1000000;
}
// Set the new price of the bag
bag.price = nextPrice;
// Increment the amountOfBuys counter
bag.amountOfBuys++;
// If this is NOT the first buy of this bag:
if (bag.amountOfBuys > 1)
{
// Increase the commission up to the maximum
if (bag.commission < bagType.maximumCommission)
{
uint256 newCommission = bag.commission + bagType.commissionIncrementPerBuy;
if (newCommission >= bagType.maximumCommission)
{
bag.commission = bagType.maximumCommission;
}
else
{
bag.commission = newCommission;
}
}
}
// Record statistics
if (addressToTotalPurchasesMade[msg.sender] == 0)
{
allParticipants.push(msg.sender);
}
addressToTotalEtherSpent[msg.sender] += msg.value;
addressToTotalPurchasesMade[msg.sender]++;
// Transfer the reward to the previous owner. If the previous owner is
// the CryptoSurprise smart contract itself, we don't need to perform any
// transfer because the contract already has it.
if (previousOwner != address(this))
{
previousOwner.transfer(previousOwnerReward);
}
if (refund > 0)
{
msg.sender.transfer(refund);
}
}
function transferBag(address _newOwner, uint256 _bagIndex) public payable
{
// Require payment
require(msg.value == BAG_TRANSFER_FEE);
// Perform the transfer
_transferBag(msg.sender, _newOwner, _bagIndex);
}
////////////////////////////////////
////// OWNER FUNCTIONS
// Constructor function
function CryptoSurprise() public
{
owner = msg.sender;
bagTypes.push(BagType({
name: "Blue",
startPrice: 0.04 ether,
priceMultiplierPerBuy: 1300000, // 130%
startCommission: 850000, // 85%
commissionIncrementPerBuy: 5000, // 0.5 %-point
maximumCommission: 900000, // 90%
supplyHardCap: 600,
currentSupply: 0
}));
bagTypes.push(BagType({
name: "Red",
startPrice: 0.03 ether,
priceMultiplierPerBuy: 1330000, // 133%
startCommission: 870000, // 87%
commissionIncrementPerBuy: 5000, // 0.5 %-point
maximumCommission: 920000, // 92%
supplyHardCap: 300,
currentSupply: 0
}));
bagTypes.push(BagType({
name: "Green",
startPrice: 0.02 ether,
priceMultiplierPerBuy: 1360000, // 136%
startCommission: 890000, // 89%
commissionIncrementPerBuy: 5000, // 0.5 %-point
maximumCommission: 940000, // 94%
supplyHardCap: 150,
currentSupply: 0
}));
bagTypes.push(BagType({
name: "Black",
startPrice: 0.1 ether,
priceMultiplierPerBuy: 1450000, // 145%
startCommission: 920000, // 92%
commissionIncrementPerBuy: 10000, // 1 %-point
maximumCommission: 960000, // 96%
supplyHardCap: 50,
currentSupply: 0
}));
bagTypes.push(BagType({
name: "Pink",
startPrice: 1 ether,
priceMultiplierPerBuy: 1500000, // 150%
startCommission: 940000, // 94%
commissionIncrementPerBuy: 10000, // 1 %-point
maximumCommission: 980000, // 98%
supplyHardCap: 10,
currentSupply: 0
}));
bagTypes.push(BagType({
name: "White",
startPrice: 10 ether,
priceMultiplierPerBuy: 1500000, // 150%
startCommission: 970000, // 97%
commissionIncrementPerBuy: 10000, // 1 %-point
maximumCommission: 990000, // 99%
supplyHardCap: 1,
currentSupply: 0
}));
}
// Function that allows the current owner to transfer ownership
function transferOwnership(address _newOwner) external
{
require(msg.sender == owner);
owner = _newOwner;
}
// Only the owner can deposit ETH by sending it directly to the contract
function () payable external
{
require(msg.sender == owner);
}
// Function that allows the current owner to withdraw any amount
// of ETH from the contract
function withdrawEther(uint256 amount) external
{
require(msg.sender == owner);
owner.transfer(amount);
}
function addBag(uint256 _bagTypeIndex) external
{
addBagAndGift(_bagTypeIndex, address(this));
}
function addBagDelayed(uint256 _bagTypeIndex, uint256 _delaySeconds) external
{
addBagAndGiftAtTime(_bagTypeIndex, address(this), now + _delaySeconds);
}
function addBagAndGift(uint256 _bagTypeIndex, address _firstOwner) public
{
addBagAndGiftAtTime(_bagTypeIndex, _firstOwner, now);
}
function addBagAndGiftAtTime(uint256 _bagTypeIndex, address _firstOwner, uint256 _timestamp) public
{
require(msg.sender == owner);
require(_bagTypeIndex < bagTypes.length);
BagType storage bagType = bagTypes[_bagTypeIndex];
require(bagType.currentSupply < bagType.supplyHardCap);
bags.push(Bag({
bagTypeIndex: _bagTypeIndex,
amountOfBuys: 0,
owner: _firstOwner,
commission: bagType.startCommission,
price: bagType.startPrice,
availableTimestamp: _timestamp
}));
bagType.currentSupply++;
}
////////////////////////////////////
////// INTERNAL FUNCTIONS
function _transferBag(address _from, address _to, uint256 _bagIndex) internal
{
// Make sure that the bag exists
require(_bagIndex < bags.length);
// Bag may not be transferred before it has been bought x times
require(bags[_bagIndex].amountOfBuys >= BAG_TRANSFER_MINIMUM_AMOUNT_OF_BUYS);
// Make sure that the sender is the current owner of the bag
require(bags[_bagIndex].owner == _from);
// Set the new owner
bags[_bagIndex].owner = _to;
ownerToBagIndices[_from].remove(_bagIndex);
ownerToBagIndices[_to].add(_bagIndex);
// Trigger blockchain event
Transfer(_from, _to, _bagIndex);
}
////////////////////////////////////
////// VIEW FUNCTIONS FOR USER INTERFACE
function amountOfBags() external view returns (uint256)
{
return bags.length;
}
function amountOfBagTypes() external view returns (uint256)
{
return bagTypes.length;
}
function amountOfParticipants() external view returns (uint256)
{
return allParticipants.length;
}
////////////////////////////////////
////// ERC721 NON FUNGIBLE TOKEN INTERFACE
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
function name() external pure returns (string)
{
return "Bags";
}
function symbol() external pure returns (string)
{
return "BAG";
}
function totalSupply() external view returns (uint256)
{
return bags.length;
}
function balanceOf(address _owner) external view returns (uint256)
{
return ownerToBagIndices[_owner].size();
}
function ownerOf(uint256 _bagIndex) external view returns (address)
{
require(_bagIndex < bags.length);
return bags[_bagIndex].owner;
}
mapping(address => mapping(address => mapping(uint256 => bool))) private ownerToAddressToBagIndexAllowed;
function approve(address _to, uint256 _bagIndex) external
{
require(_bagIndex < bags.length);
require(msg.sender == bags[_bagIndex].owner);
ownerToAddressToBagIndexAllowed[msg.sender][_to][_bagIndex] = true;
}
function takeOwnership(uint256 _bagIndex) external
{
require(_bagIndex < bags.length);
address previousOwner = bags[_bagIndex].owner;
require(ownerToAddressToBagIndexAllowed[previousOwner][msg.sender][_bagIndex] == true);
ownerToAddressToBagIndexAllowed[previousOwner][msg.sender][_bagIndex] = false;
_transferBag(previousOwner, msg.sender, _bagIndex);
}
function transfer(address _to, uint256 _bagIndex) external
{
transferBag(_to, _bagIndex);
}
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256)
{
require(_index < ownerToBagIndices[_owner].size());
return ownerToBagIndices[_owner].values[_index];
}
}
library SetLibrary
{
struct ArrayIndexAndExistsFlag
{
uint256 index;
bool exists;
}
struct Set
{
mapping(uint256 => ArrayIndexAndExistsFlag) valuesMapping;
uint256[] values;
}
function add(Set storage self, uint256 value) public returns (bool added)
{
// If the value is already in the set, we don't need to do anything
if (self.valuesMapping[value].exists == true) return false;
// Remember that the value is in the set, and remember the value's array index
self.valuesMapping[value] = ArrayIndexAndExistsFlag({index: self.values.length, exists: true});
// Add the value to the array of unique values
self.values.push(value);
return true;
}
function contains(Set storage self, uint256 value) public view returns (bool contained)
{
return self.valuesMapping[value].exists;
}
function remove(Set storage self, uint256 value) public returns (bool removed)
{
// If the value is not in the set, we don't need to do anything
if (self.valuesMapping[value].exists == false) return false;
// Remember that the value is not in the set
self.valuesMapping[value].exists = false;
// Now we need to remove the value from the array. To prevent leaking
// storage space, we move the last value in the array into the spot that
// contains the element we're removing.
if (self.valuesMapping[value].index < self.values.length-1)
{
uint256 valueToMove = self.values[self.values.length-1];
uint256 indexToMoveItTo = self.valuesMapping[value].index;
self.values[indexToMoveItTo] = valueToMove;
self.valuesMapping[valueToMove].index = indexToMoveItTo;
}
// Now we remove the last element from the array, because we just duplicated it.
// We don't free the storage allocation of the removed last element,
// because it will most likely be used again by a call to add().
// De-allocating and re-allocating storage space costs more gas than
// just keeping it allocated and unused.
// Uncomment this line to save gas if your use case does not call add() after remove():
// delete self.values[self.values.length-1];
self.values.length--;
// We do free the storage allocation in the mapping, because it is
// less likely that the exact same value will added again.
delete self.valuesMapping[value];
return true;
}
function size(Set storage self) public view returns (uint256 amountOfValues)
{
return self.values.length;
}
// Also accept address and bytes32 types, so the user doesn't have to cast.
function add(Set storage self, address value) public returns (bool added) { return add(self, uint256(value)); }
function add(Set storage self, bytes32 value) public returns (bool added) { return add(self, uint256(value)); }
function contains(Set storage self, address value) public view returns (bool contained) { return contains(self, uint256(value)); }
function contains(Set storage self, bytes32 value) public view returns (bool contained) { return contains(self, uint256(value)); }
function remove(Set storage self, address value) public returns (bool removed) { return remove(self, uint256(value)); }
function remove(Set storage self, bytes32 value) public returns (bool removed) { return remove(self, uint256(value)); }
}
|
0x6060604052600436106101505763ffffffff60e060020a60003504166305e33dd0811461016d57806306fdde031461019f578063095ea7b31461022957806318160ddd1461024b57806326ba1c19146102705780632db93fc7146102955780632f745c59146102a05780633221e125146102c25780633bed33ce146102d857806343a8775a146102ee5780636352211e1461030157806370a0823114610317578063808cd1251461033657806381e4d40c146103555780638da5cb5b1461037457806395d89b4114610387578063993b4f711461039a578063a9059cbb146103b1578063b2e6ceeb146103d3578063bd355f431461024b578063dda4df4e146103e9578063df41e2541461044a578063e2a51b8f14610520578063ef532a4714610533578063f17a1ff514610555578063f272a60c14610568578063f2fde38b14610581578063f7dd2e28146105a0575b60005433600160a060020a0390811691161461016b57600080fd5b005b341561017857600080fd5b6101836004356105b3565b604051600160a060020a03909116815260200160405180910390f35b34156101aa57600080fd5b6101b26105db565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101ee5780820151838201526020016101d6565b50505050905090810190601f16801561021b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561023457600080fd5b61016b600160a060020a036004351660243561061d565b341561025657600080fd5b61025e6106a2565b60405190815260200160405180910390f35b341561027b57600080fd5b61016b600435600160a060020a03602435166044356106a8565b61016b6004356107d0565b34156102ab57600080fd5b61025e600160a060020a0360043516602435610a46565b34156102cd57600080fd5b61016b600435610b18565b34156102e357600080fd5b61016b600435610b25565b34156102f957600080fd5b61025e610b73565b341561030c57600080fd5b610183600435610b79565b341561032257600080fd5b61025e600160a060020a0360043516610bbb565b341561034157600080fd5b61025e600160a060020a0360043516610c4c565b341561036057600080fd5b61025e600160a060020a0360043516610c5e565b341561037f57600080fd5b610183610c70565b341561039257600080fd5b6101b2610c7f565b61016b600160a060020a0360043516602435610cc0565b34156103bc57600080fd5b61016b600160a060020a0360043516602435610ce2565b34156103de57600080fd5b61016b600435610cec565b34156103f457600080fd5b6103ff600435610da6565b6040518087815260200186815260200185600160a060020a0316600160a060020a03168152602001848152602001838152602001828152602001965050505050505060405180910390f35b341561045557600080fd5b610460600435610df4565b6040516020810188905260408101879052606081018690526080810185905260a0810184905260c0810183905260e081018290526101008082528954600260001960018316158402019091160490820181905281906101208201908b90801561050a5780601f106104df5761010080835404028352916020019161050a565b820191906000526020600020905b8154815290600101906020018083116104ed57829003601f168201915b5050995050505050505050505060405180910390f35b341561052b57600080fd5b61025e610e49565b341561053e57600080fd5b61016b600435600160a060020a0360243516610e4f565b341561056057600080fd5b61025e610e5a565b341561057357600080fd5b61016b600435602435610e65565b341561058c57600080fd5b61016b600160a060020a0360043516610e72565b34156105ab57600080fd5b61025e610eaf565b60068054829081106105c157fe5b600091825260209091200154600160a060020a0316905081565b6105e36110d7565b60408051908101604052600481527f4261677300000000000000000000000000000000000000000000000000000000602082015290505b90565b600254811061062b57600080fd5b600280548290811061063957fe5b600091825260209091206002600690920201015433600160a060020a0390811691161461066557600080fd5b600160a060020a0333811660009081526007602090815260408083209590931682529384528181209281529190925220805460ff19166001179055565b60025490565b6000805433600160a060020a039081169116146106c457600080fd5b60015484106106d257600080fd5b60018054859081106106e057fe5b906000526020600020906008020190508060060154816007015410151561070657600080fd5b600280546001810161071883826110e9565b9160005260206000209060060201600060c0604051908101604090815288825260006020830152600160a060020a03881690820152600385015460608201526001850154608082015260a0810186905291905081518155602082015181600101556040820151600282018054600160a060020a031916600160a060020a0392909216919091179055606082015181600301556080820151816004015560a0820151600590910155505060070180546001019055505050565b600080600080600080600080600280549050891015156107ef57600080fd5b600280548a9081106107fd57fe5b906000526020600020906006020197506001886000015481548110151561082057fe5b906000526020600020906008020196508760050154421015151561084357600080fd5b600488015434101561085457600080fd5b60048801546002808a01805433600160a060020a03908116600160a060020a0319831617909255918a01543484900399509116965090620f42400281151561089857fe5b049350620f424087600201548960040154028115156108b357fe5b0492508760010154600014156108cf57876004015491506108e3565b60038801546004890154620f424091020491505b6004880183905560018089018054820190819055111561093d5786600501548860030154101561093d57506004860154600388015460058801549101908110610935576005870154600389015561093d565b600388018190555b600160a060020a033316600090815260046020526040902054151561099457600680546001810161096e838261111a565b5060009182526020909120018054600160a060020a03191633600160a060020a03161790555b600160a060020a03338116600090815260036020908152604080832080543401905560049091529020805460010190558581163090911614610a0157600160a060020a03851682156108fc0283604051600060405180830381858888f193505050501515610a0157600080fd5b6000861115610a3b57600160a060020a03331686156108fc0287604051600060405180830381858888f193505050501515610a3b57600080fd5b505050505050505050565b600160a060020a0382166000908152600560205260408082207355f44e8b16651a7c5ea1ffcc54749336ffc17e3a916381d21e4d91908490516020015260405160e060020a63ffffffff8416028152600481019190915260240160206040518083038186803b1515610ab757600080fd5b6102c65a03f41515610ac857600080fd5b505050604051805183109050610add57600080fd5b600160a060020a0383166000908152600560205260409020600101805483908110610b0457fe5b906000526020600020900154905092915050565b610b228130610e4f565b50565b60005433600160a060020a03908116911614610b4057600080fd5b600054600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515610b2257600080fd5b60015490565b6002546000908210610b8a57600080fd5b6002805483908110610b9857fe5b6000918252602090912060069091020160020154600160a060020a031692915050565b600160a060020a0381166000908152600560205260408082207355f44e8b16651a7c5ea1ffcc54749336ffc17e3a916381d21e4d91908490516020015260405160e060020a63ffffffff8416028152600481019190915260240160206040518083038186803b1515610c2c57600080fd5b6102c65a03f41515610c3d57600080fd5b50505060405180519392505050565b60046020526000908152604090205481565b60036020526000908152604090205481565b600054600160a060020a031681565b610c876110d7565b60408051908101604052600381527f42414700000000000000000000000000000000000000000000000000000000006020820152905090565b3466b1a2bc2ec5000014610cd357600080fd5b610cde338383610eb4565b5050565b610cde8282610cc0565b6002546000908210610cfd57600080fd5b6002805483908110610d0b57fe5b6000918252602080832060026006909302019190910154600160a060020a039081168084526007835260408085203390931685529183528184208685529092529091205490915060ff161515600114610d6357600080fd5b600160a060020a03808216600090815260076020908152604080832033948516845282528083208684529091529020805460ff19169055610cde90829084610eb4565b6002805482908110610db457fe5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501549395509193600160a060020a039091169286565b6001805482908110610e0257fe5b906000526020600020906008020160009150905080600001908060010154908060020154908060030154908060040154908060050154908060060154908060070154905088565b60065490565b610cde8282426106a8565b66b1a2bc2ec5000081565b610cde82308342016106a8565b60005433600160a060020a03908116911614610e8d57600080fd5b60008054600160a060020a031916600160a060020a0392909216919091179055565b600481565b6002548110610ec257600080fd5b6004600282815481101515610ed357fe5b90600052602060002090600602016001015410151515610ef257600080fd5b82600160a060020a0316600282815481101515610f0b57fe5b6000918252602090912060026006909202010154600160a060020a031614610f3257600080fd5b81600282815481101515610f4257fe5b600091825260208083206006929092029091016002018054600160a060020a031916600160a060020a039485161790559185168152600590915260408082207355f44e8b16651a7c5ea1ffcc54749336ffc17e3a92636cd23f5392859190516020015260405160e060020a63ffffffff85160281526004810192909252602482015260440160206040518083038186803b1515610fde57600080fd5b6102c65a03f41515610fef57600080fd5b50505060405180515050600160a060020a0382166000908152600560205260408082207355f44e8b16651a7c5ea1ffcc54749336ffc17e3a92632e6b975d92859190516020015260405160e060020a63ffffffff85160281526004810192909252602482015260440160206040518083038186803b151561106f57600080fd5b6102c65a03f4151561108057600080fd5b505050604051805190505081600160a060020a031683600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a3505050565b60206040519081016040526000815290565b81548183558181151161111557600602816006028360005260206000209182019101611115919061113e565b505050565b81548183558181151161111557600083815260209020611115918101908301611189565b61061a91905b8082111561118557600080825560018201819055600282018054600160a060020a031916905560038201819055600482018190556005820155600601611144565b5090565b61061a91905b80821115611185576000815560010161118f5600a165627a7a72305820344941c93384be2385ef37755c9aaa5684448e3fd92bb21795385eee1d2b7c230029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,917 |
0xcf19c76d4848c5e26ab438d8a2ff94316944f0b8
|
/**
*Submitted for verification at Etherscan.io on 2022-02-03
*/
/*
PANDA SAMURAI (PANDURAI) - A GREAT WARRIOR
Fusion of my two favorite Personalities and Spirit —-> Panda 🐼 + Samurai ⚔️ = PANDURAI🤺
Spreading peace and good fortune☮️❤️🍀
DEV : LIAM SPARTAN 🧑💻
TOKENOMICS 💰
————————————
TOTAL SUPPLY - 7,000,000
MAX TRANSACTION - 40,000
MAX. WALLET - 80,000
********************************
↪️ 30% OF SUPPLY IS BURNT AT LAUNCH.
🔥 2,100,000 🔥
TAX DETAILS 🏦
💥6% REFLECTIONS 💥
BUY TAX:
—————————————
Reflections - 3%
Marketing/Dev/Liquidity - 9%
SELL TAX:
—————————————
Reflections - 3%
Marketing/Dev/Liquidity - 9%
🤔 WHAT SETS APART FROM OTHER PROJECTS ? 🔭
—————————————————
✅LIQUIDITY WILL BE LOCKED BEFORE EVEN TRADING BEGINS.
✅CONTRACT WILL BE RENOUNCED
✅NO PRESALE, FAIR LAUNCH
✅CA WILL BE GIVEN 2 MINS PRIOR TO LAUNCH, SO EVERYONE OF YOU WILL HAVE EQUAL OPPORTUNITY TO APE
🌐 https://pandasamuraierctoken.com
☎️ https://t.me/PANDASAMURAIPORTAL
🕊https://twitter.com/pandasamuraieth?s=11
🌈LAUNCH TIME - MARCH 24 (5pm EST) 🌈
*/
// 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 PANDURAI is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "PANDA SAMURAI";
string private constant _symbol = "PANDURAI";
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 = 7000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 10;
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) public _buyMap;
address payable private _developmentAddress = payable(0x015b248BfeEA6aB5be54DdB6465A51CE328C7841);
address payable private _marketingAddress = payable(0x015b248BfeEA6aB5be54DdB6465A51CE328C7841);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 40000 * 10**9;
uint256 public _maxWalletSize = 80000 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055b578063dd62ed3e1461057b578063ea1644d5146105c1578063f2fde38b146105e157600080fd5b8063a2a957bb146104d6578063a9059cbb146104f6578063bfd7928414610516578063c3c8cd801461054657600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b657600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611963565b610601565b005b34801561020a57600080fd5b5060408051808201909152600d81526c50414e44412053414d5552414960981b60208201525b60405161023d9190611a28565b60405180910390f35b34801561025257600080fd5b50610266610261366004611a7d565b6106a0565b604051901515815260200161023d565b34801561028257600080fd5b50601454610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b506618de76816d80005b60405190815260200161023d565b3480156102de57600080fd5b506102666102ed366004611aa9565b6106b7565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023d565b34801561033057600080fd5b50601554610296906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611aea565b610720565b34801561037057600080fd5b506101fc61037f366004611b17565b61076b565b34801561039057600080fd5b506101fc6107b3565b3480156103a557600080fd5b506102c46103b4366004611aea565b6107fe565b3480156103c557600080fd5b506101fc610820565b3480156103da57600080fd5b506101fc6103e9366004611b32565b610894565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611aea565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610296565b34801561045b57600080fd5b506101fc61046a366004611b17565b6108c3565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b5060408051808201909152600881526750414e445552414960c01b6020820152610230565b3480156104c257600080fd5b506101fc6104d1366004611b32565b61090b565b3480156104e257600080fd5b506101fc6104f1366004611b4b565b61093a565b34801561050257600080fd5b50610266610511366004611a7d565b610978565b34801561052257600080fd5b50610266610531366004611aea565b60106020526000908152604090205460ff1681565b34801561055257600080fd5b506101fc610985565b34801561056757600080fd5b506101fc610576366004611b7d565b6109d9565b34801561058757600080fd5b506102c4610596366004611c01565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cd57600080fd5b506101fc6105dc366004611b32565b610a7a565b3480156105ed57600080fd5b506101fc6105fc366004611aea565b610aa9565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161062b90611c3a565b60405180910390fd5b60005b815181101561069c5760016010600084848151811061065857610658611c6f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069481611c9b565b915050610637565b5050565b60006106ad338484610b93565b5060015b92915050565b60006106c4848484610cb7565b610716843361071185604051806060016040528060288152602001611db5602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f3565b610b93565b5060019392505050565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161062b90611c3a565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107955760405162461bcd60e51b815260040161062b90611c3a565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e857506013546001600160a01b0316336001600160a01b0316145b6107f157600080fd5b476107fb8161122d565b50565b6001600160a01b0381166000908152600260205260408120546106b190611267565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161062b90611c3a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062b90611c3a565b601655565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161062b90611c3a565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161062b90611c3a565b601855565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161062b90611c3a565b600893909355600a91909155600955600b55565b60006106ad338484610cb7565b6012546001600160a01b0316336001600160a01b031614806109ba57506013546001600160a01b0316336001600160a01b0316145b6109c357600080fd5b60006109ce306107fe565b90506107fb816112eb565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161062b90611c3a565b60005b82811015610a74578160056000868685818110610a2557610a25611c6f565b9050602002016020810190610a3a9190611aea565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6c81611c9b565b915050610a06565b50505050565b6000546001600160a01b03163314610aa45760405162461bcd60e51b815260040161062b90611c3a565b601755565b6000546001600160a01b03163314610ad35760405162461bcd60e51b815260040161062b90611c3a565b6001600160a01b038116610b385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062b565b6001600160a01b038216610c565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062b565b6001600160a01b038216610d7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062b565b60008111610ddf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062b565b6000546001600160a01b03848116911614801590610e0b57506000546001600160a01b03838116911614155b156110ec57601554600160a01b900460ff16610ea4576000546001600160a01b03848116911614610ea45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062b565b601654811115610ef65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062b565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3857506001600160a01b03821660009081526010602052604090205460ff16155b610f905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062b565b6015546001600160a01b038381169116146110155760175481610fb2846107fe565b610fbc9190611cb6565b106110155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062b565b6000611020306107fe565b6018546016549192508210159082106110395760165491505b8080156110505750601554600160a81b900460ff16155b801561106a57506015546001600160a01b03868116911614155b801561107f5750601554600160b01b900460ff165b80156110a457506001600160a01b03851660009081526005602052604090205460ff16155b80156110c957506001600160a01b03841660009081526005602052604090205460ff16155b156110e9576110d7826112eb565b4780156110e7576110e74761122d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112e57506001600160a01b03831660009081526005602052604090205460ff165b8061116057506015546001600160a01b0385811691161480159061116057506015546001600160a01b03848116911614155b1561116d575060006111e7565b6015546001600160a01b03858116911614801561119857506014546001600160a01b03848116911614155b156111aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d557506014546001600160a01b03858116911614155b156111e757600a54600c55600b54600d555b610a7484848484611474565b600081848411156112175760405162461bcd60e51b815260040161062b9190611a28565b5060006112248486611cce565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069c573d6000803e3d6000fd5b60006006548211156112ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062b565b60006112d86114a2565b90506112e483826114c5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133357611333611c6f565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138757600080fd5b505afa15801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf9190611ce5565b816001815181106113d2576113d2611c6f565b6001600160a01b0392831660209182029290920101526014546113f89130911684610b93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611431908590600090869030904290600401611d02565b600060405180830381600087803b15801561144b57600080fd5b505af115801561145f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148157611481611507565b61148c848484611535565b80610a7457610a74600e54600c55600f54600d55565b60008060006114af61162c565b90925090506114be82826114c5565b9250505090565b60006112e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166a565b600c541580156115175750600d54155b1561151e57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154787611698565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157990876116f5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a89086611737565b6001600160a01b0389166000908152600260205260409020556115ca81611796565b6115d484836117e0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161991815260200190565b60405180910390a3505050505050505050565b60065460009081906618de76816d800061164682826114c5565b821015611661575050600654926618de76816d800092509050565b90939092509050565b6000818361168b5760405162461bcd60e51b815260040161062b9190611a28565b5060006112248486611d73565b60008060008060008060008060006116b58a600c54600d54611804565b92509250925060006116c56114a2565b905060008060006116d88e878787611859565b919e509c509a509598509396509194505050505091939550919395565b60006112e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f3565b6000806117448385611cb6565b9050838110156112e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062b565b60006117a06114a2565b905060006117ae83836118a9565b306000908152600260205260409020549091506117cb9082611737565b30600090815260026020526040902055505050565b6006546117ed90836116f5565b6006556007546117fd9082611737565b6007555050565b600080808061181e606461181889896118a9565b906114c5565b9050600061183160646118188a896118a9565b90506000611849826118438b866116f5565b906116f5565b9992985090965090945050505050565b600080808061186888866118a9565b9050600061187688876118a9565b9050600061188488886118a9565b905060006118968261184386866116f5565b939b939a50919850919650505050505050565b6000826118b8575060006106b1565b60006118c48385611d95565b9050826118d18583611d73565b146112e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b803561195e8161193e565b919050565b6000602080838503121561197657600080fd5b823567ffffffffffffffff8082111561198e57600080fd5b818501915085601f8301126119a257600080fd5b8135818111156119b4576119b4611928565b8060051b604051601f19603f830116810181811085821117156119d9576119d9611928565b6040529182528482019250838101850191888311156119f757600080fd5b938501935b82851015611a1c57611a0d85611953565b845293850193928501926119fc565b98975050505050505050565b600060208083528351808285015260005b81811015611a5557858101830151858201604001528201611a39565b81811115611a67576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9057600080fd5b8235611a9b8161193e565b946020939093013593505050565b600080600060608486031215611abe57600080fd5b8335611ac98161193e565b92506020840135611ad98161193e565b929592945050506040919091013590565b600060208284031215611afc57600080fd5b81356112e48161193e565b8035801515811461195e57600080fd5b600060208284031215611b2957600080fd5b6112e482611b07565b600060208284031215611b4457600080fd5b5035919050565b60008060008060808587031215611b6157600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9257600080fd5b833567ffffffffffffffff80821115611baa57600080fd5b818601915086601f830112611bbe57600080fd5b813581811115611bcd57600080fd5b8760208260051b8501011115611be257600080fd5b602092830195509350611bf89186019050611b07565b90509250925092565b60008060408385031215611c1457600080fd5b8235611c1f8161193e565b91506020830135611c2f8161193e565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611caf57611caf611c85565b5060010190565b60008219821115611cc957611cc9611c85565b500190565b600082821015611ce057611ce0611c85565b500390565b600060208284031215611cf757600080fd5b81516112e48161193e565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d525784516001600160a01b031683529383019391830191600101611d2d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611daf57611daf611c85565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b082107069ecaf3cf84c2130c40969092a3719c7075c596a747df6234db77ee64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,918 |
0x81692F5647ef63766F3A521114bc9ED094eC23cE
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/// @author Alchemy Team
/// @title Timelock
/// @notice The Timelock Contract for Alchemys
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 0 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin = address(0);
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
constructor() {
// Don't allow implementation to be initialized.
admin = address(1);
}
/**
* @dev Initialize the timelock proxy contract by setting the admin and delay fields.
* Reverts if the contract has already been initialized.
*/
function initialize(address admin_, uint delay_) external {
require(admin == address(0), "Timelock::initialize: Already initialized.");
require(admin_ != address(0), "Timelock::initialize: Can not set null admin.");
require(delay_ >= MINIMUM_DELAY, "Timelock::initialize: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::initialize: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
}
/**
* fallback function for collection funds
*/
fallback() external payable {}
receive() external payable {}
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call{value:value}(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100e15760003560e01c80637d645fab1161007f578063cd6dc68711610059578063cd6dc68714610778578063e177246e146107d3578063f2b065371461080e578063f851a4401461085f576100e8565b80637d645fab146106f7578063b1b43ae514610722578063c1a287e21461074d576100e8565b80633a66f901116100bb5780633a66f901146103415780634dd18bf5146104e8578063591fcdfe146105395780636a42b8f8146106cc576100e8565b80630825f38f146100ea5780630e18b681146102e95780632678224714610300576100e8565b366100e857005b005b61026e600480360360a081101561010057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561014757600080fd5b82018360208201111561015957600080fd5b8035906020019184600183028401116401000000008311171561017b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156101de57600080fd5b8201836020820111156101f057600080fd5b8035906020019184600183028401116401000000008311171561021257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506108a0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ae578082015181840152602081019050610293565b50505050905090810190601f1680156102db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f557600080fd5b506102fe610eea565b005b34801561030c57600080fd5b50610315611077565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034d57600080fd5b506104d2600480360360a081101561036457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156103ab57600080fd5b8201836020820111156103bd57600080fd5b803590602001918460018302840111640100000000831117156103df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561044257600080fd5b82018360208201111561045457600080fd5b8035906020019184600183028401116401000000008311171561047657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061109d565b6040518082815260200191505060405180910390f35b3480156104f457600080fd5b506105376004803603602081101561050b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061144d565b005b34801561054557600080fd5b506106ca600480360360a081101561055c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105a357600080fd5b8201836020820111156105b557600080fd5b803590602001918460018302840111640100000000831117156105d757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561063a57600080fd5b82018360208201111561064c57600080fd5b8035906020019184600183028401116401000000008311171561066e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061157a565b005b3480156106d857600080fd5b506106e16118ae565b6040518082815260200191505060405180910390f35b34801561070357600080fd5b5061070c6118b4565b6040518082815260200191505060405180910390f35b34801561072e57600080fd5b506107376118bb565b6040518082815260200191505060405180910390f35b34801561075957600080fd5b506107626118c0565b6040518082815260200191505060405180910390f35b34801561078457600080fd5b506107d16004803603604081101561079b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118c7565b005b3480156107df57600080fd5b5061080c600480360360208110156107f657600080fd5b8101908080359060200190929190505050611af3565b005b34801561081a57600080fd5b506108476004803603602081101561083157600080fd5b8101908080359060200190929190505050611c66565b60405180821515815260200191505060405180910390f35b34801561086b57600080fd5b50610874611c86565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610946576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611d656038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156109bc5780820151818401526020810190506109a1565b50505050905090810190601f1680156109e95780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610a22578082015181840152602081019050610a07565b50505050905090810190601f168015610a4f5780820380516001836020036101000a031916815260200191505b509750505050505050506040516020818303038152906040528051906020012090506003600082815260200190815260200160002060009054906101000a900460ff16610ae7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611eb8603d913960400191505060405180910390fd5b82610af0611caa565b1015610b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526045815260200180611e076045913960600191505060405180910390fd5b610b5d6212750084611cb290919063ffffffff16565b610b65611caa565b1115610bbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180611dd46033913960400191505060405180910390fd5b60006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055506060600086511415610bfc57849050610c98565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610c605780518252602082019150602081019050602083039250610c3d565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b6000808973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610ce75780518252602082019150602081019050602083039250610cc4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610d49576040519150601f19603f3d011682016040523d82523d6000602084013e610d4e565b606091505b509150915081610da9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180612002603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e36578082015181840152602081019050610e1b565b50505050905090810190601f168015610e635780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610e9c578082015181840152602081019050610e81565b50505050905090810190601f168015610ec95780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38094505050505095945050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611ef56038913960400191505060405180910390fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60405160405180910390a2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611144576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180611f9f6036913960400191505060405180910390fd5b611160600254611152611caa565b611cb290919063ffffffff16565b8210156111b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260498152602001806120756049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561122e578082015181840152602081019050611213565b50505050905090810190601f16801561125b5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015611294578082015181840152602081019050611279565b50505050905090810190601f1680156112c15780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561139c578082015181840152602081019050611381565b50505050905090810190601f1680156113c95780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156114025780820151818401526020810190506113e7565b50505050905090810190601f16801561142f5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38091505095945050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114d1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611f676038913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75660405160405180910390a250565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461161e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526037815260200180611d9d6037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015611694578082015181840152602081019050611679565b50505050905090810190601f1680156116c15780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156116fa5780820151818401526020810190506116df565b50505050905090810190601f1680156117275780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156118025780820151818401526020810190506117e7565b50505050905090810190601f16801561182f5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561186857808201518184015260208101905061184d565b50505050905090810190601f1680156118955780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b600081565b6212750081565b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461196c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611d3b602a913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180611fd5602d913960400191505060405180910390fd5b6000811015611a4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061203f6036913960400191505060405180910390fd5b62278d00811115611aa8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611f2d603a913960400191505060405180910390fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806002819055505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b77576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001806120be6031913960400191505060405180910390fd5b6000811015611bd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611e4c6034913960400191505060405180910390fd5b62278d00811115611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611e806038913960400191505060405180910390fd5b806002819055506002547f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c60405160405180910390a250565b60036020528060005260406000206000915054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b600080828401905083811015611d30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe54696d656c6f636b3a3a696e697469616c697a653a20416c726561647920696e697469616c697a65642e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a696e697469616c697a653a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a696e697469616c697a653a2043616e206e6f7420736574206e756c6c2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a696e697469616c697a653a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea26469706673582212201378697904927b2e62963af2ada055b5536b5a71252df1aedb529b0e7960cc5764736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 2,919 |
0x77c7541e085d8511f0def9aed0e896a61c4705c7
|
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// 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: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/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);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/CappedToken.sol
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
onlyOwner
canMint
public
returns (bool)
{
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
// File: contracts/SHRToken.sol
/**
* CappedToken token is Mintable token with a max cap on totalSupply that can ever be minted.
*/
contract SHRToken is CappedToken {
string public name = "SHARE EVERYTHING TOKEN";
string public symbol = "SHR";
uint256 public decimals = 18;
uint256 public cap = 200000000 ether;
/*------------------------------------constructor------------------------------------*/
/**
* @dev constructor for mesh token
*/
constructor() CappedToken(cap) public {
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010157806306fdde0314610130578063095ea7b3146101c057806318160ddd1461022557806323b872dd14610250578063313ce567146102d5578063355274ea1461030057806340c10f191461032b578063661884631461039057806370a08231146103f5578063715018a61461044c5780637d64bcb4146104635780638da5cb5b1461049257806395d89b41146104e9578063a9059cbb14610579578063d73dd623146105de578063dd62ed3e14610643578063f2fde38b146106ba575b600080fd5b34801561010d57600080fd5b506101166106fd565b604051808215151515815260200191505060405180910390f35b34801561013c57600080fd5b50610145610710565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018557808201518184015260208101905061016a565b50505050905090810190601f1680156101b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cc57600080fd5b5061020b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ae565b604051808215151515815260200191505060405180910390f35b34801561023157600080fd5b5061023a6108a0565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b506102bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108aa565b604051808215151515815260200191505060405180910390f35b3480156102e157600080fd5b506102ea610c64565b6040518082815260200191505060405180910390f35b34801561030c57600080fd5b50610315610c6a565b6040518082815260200191505060405180910390f35b34801561033757600080fd5b50610376600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c70565b604051808215151515815260200191505060405180910390f35b34801561039c57600080fd5b506103db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d21565b604051808215151515815260200191505060405180910390f35b34801561040157600080fd5b50610436600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb2565b6040518082815260200191505060405180910390f35b34801561045857600080fd5b50610461610ffa565b005b34801561046f57600080fd5b506104786110ff565b604051808215151515815260200191505060405180910390f35b34801561049e57600080fd5b506104a76111c7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f557600080fd5b506104fe6111ed565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053e578082015181840152602081019050610523565b50505050905090810190601f16801561056b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058557600080fd5b506105c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061128b565b604051808215151515815260200191505060405180910390f35b3480156105ea57600080fd5b50610629600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114aa565b604051808215151515815260200191505060405180910390f35b34801561064f57600080fd5b506106a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116a6565b6040518082815260200191505060405180910390f35b3480156106c657600080fd5b506106fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172d565b005b600360149054906101000a900460ff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107a65780601f1061077b576101008083540402835291602001916107a6565b820191906000526020600020905b81548152906001019060200180831161078957829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108e757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561093457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156109bf57600080fd5b610a10826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610aa3826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ae90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b7482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179590919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60075481565b60085481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cce57600080fd5b600360149054906101000a900460ff16151515610cea57600080fd5b600454610d02836001546117ae90919063ffffffff16565b11151515610d0f57600080fd5b610d1983836117ca565b905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e32576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ec6565b610e45838261179590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561105657600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561115d57600080fd5b600360149054906101000a900460ff1615151561117957600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112835780601f1061125857610100808354040283529160200191611283565b820191906000526020600020905b81548152906001019060200180831161126657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112c857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561131557600080fd5b611366826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113f9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ae90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061153b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ae90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178957600080fd5b611792816119b0565b50565b60008282111515156117a357fe5b818303905092915050565b600081830190508281101515156117c157fe5b80905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561182857600080fd5b600360149054906101000a900460ff1615151561184457600080fd5b611859826001546117ae90919063ffffffff16565b6001819055506118b0826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ae90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156119ec57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058202c9eb069fbac395417c9de348e9bf821503a82a3af28500f48fb8363e3ed13b50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 2,920 |
0x8f3eb750fc053c45e2b63f7c356194d1067a45ee
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract FARMINGYFIGETHLP is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 15000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 100;
// unstaking fee percent
uint public unstakingFeeRate = 100;
// unstaking possible Time
uint public PossibleUnstakeTime = 48 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function farm(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unfarm(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "For UnFarming Need Time 48 Hours after Start Farming");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function harvest() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636654ffdf11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610758578063f3073ee71461079c578063f3f91fa0146107e2578063f851a4401461083a576101cf565b8063c326bf4f146106a6578063d578ceab146106fe578063d816c7d51461071c578063f1587ea11461073a576101cf565b80639d76ea58116100de5780639d76ea5814610596578063a89c8c5e146105ca578063bec4de3f14610644578063c0a6d78b14610662576101cf565b80636654ffdf146104ec5780636a395ccb1461050a5780637b0a47ee14610578576101cf565b8063455ab53c11610171578063538a85a11161014b578063538a85a1146103f0578063583d42fd1461041e5780635ef057be146104765780636270cd1814610494576101cf565b8063455ab53c146103825780634641257d146103a25780634908e386146103ac576101cf565b80632ec14e85116101ad5780632ec14e851461029e578063308feec3146102d257806337c5785a146102f0578063384431771461033e576101cf565b8063069ca4d0146101d45780631c885bae146102185780631e94723f14610246575b600080fd5b610200600480360360208110156101ea57600080fd5b810190808035906020019092919050505061086e565b60405180821515815260200191505060405180910390f35b6102446004803603602081101561022e57600080fd5b81019080803590602001909291905050506108d5565b005b6102886004803603602081101561025c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e36565b6040518082815260200191505060405180910390f35b6102a6610fa3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da610fc9565b6040518082815260200191505060405180910390f35b6103266004803603604081101561030657600080fd5b810190808035906020019092919080359060200190929190505050610fda565b60405180821515815260200191505060405180910390f35b61036a6004803603602081101561035457600080fd5b8101908080359060200190929190505050611049565b60405180821515815260200191505060405180910390f35b61038a6110b0565b60405180821515815260200191505060405180910390f35b6103aa6110c3565b005b6103d8600480360360208110156103c257600080fd5b81019080803590602001909291905050506110ce565b60405180821515815260200191505060405180910390f35b61041c6004803603602081101561040657600080fd5b8101908080359060200190929190505050611135565b005b6104606004803603602081101561043457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061164b565b6040518082815260200191505060405180910390f35b61047e611663565b6040518082815260200191505060405180910390f35b6104d6600480360360208110156104aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611669565b6040518082815260200191505060405180910390f35b6104f4611681565b6040518082815260200191505060405180910390f35b6105766004803603606081101561052057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611687565b005b610580611817565b6040518082815260200191505060405180910390f35b61059e61181d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062c600480360360408110156105e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611843565b60405180821515815260200191505060405180910390f35b61064c6119e5565b6040518082815260200191505060405180910390f35b61068e6004803603602081101561067857600080fd5b81019080803590602001909291905050506119eb565b60405180821515815260200191505060405180910390f35b6106e8600480360360208110156106bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a52565b6040518082815260200191505060405180910390f35b610706611a6a565b6040518082815260200191505060405180910390f35b610724611a70565b6040518082815260200191505060405180910390f35b610742611a76565b6040518082815260200191505060405180910390f35b61079a6004803603602081101561076e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aaf565b005b6107ca600480360360208110156107b257600080fd5b81019080803515159060200190929190505050611bfe565b60405180821515815260200191505060405180910390f35b610824600480360360208110156107f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7b565b6040518082815260200191505060405180910390f35b610842611d93565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108c957600080fd5b81600481905550919050565b80600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6007546109df600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611db790919063ffffffff16565b11610a35576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806123086034913960400191505060405180910390fd5b610a3e33611dce565b6000610a69612710610a5b6006548561207290919063ffffffff16565b6120a190919063ffffffff16565b90506000610a808284611db790919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b3557600080fd5b505af1158015610b49573d6000803e3d6000fd5b505050506040513d6020811015610b5f57600080fd5b8101908080519060200190929190505050610be2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b505050506040513d6020811015610c9f57600080fd5b8101908080519060200190929190505050610d22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610d7483600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db790919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcb33600b6120ba90919063ffffffff16565b8015610e1657506000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610e3157610e2f33600b6120ea90919063ffffffff16565b505b505050565b6000610e4c82600b6120ba90919063ffffffff16565b610e595760009050610f9e565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610eaa5760009050610f9e565b6000610efe600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611db790919063ffffffff16565b90506000600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610f95612710610f87600454610f7987610f6b6003548961207290919063ffffffff16565b61207290919063ffffffff16565b6120a190919063ffffffff16565b6120a190919063ffffffff16565b90508093505050505b919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610fd5600b61211a565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461103557600080fd5b826005819055508160068190555092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110a457600080fd5b81600981905550919050565b600a60009054906101000a900460ff1681565b6110cc33611dce565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461112957600080fd5b81600381905550919050565b60011515600a60009054906101000a900460ff161515146111be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5374616b696e67206973206e6f742079657420696e697469616c697a6564000081525060200191505060405180910390fd5b60008111611234576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156112e557600080fd5b505af11580156112f9573d6000803e3d6000fd5b505050506040513d602081101561130f57600080fd5b8101908080519060200190929190505050611392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61139b33611dce565b60006113c66127106113b86005548561207290919063ffffffff16565b6120a190919063ffffffff16565b905060006113dd8284611db790919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561149257600080fd5b505af11580156114a6573d6000803e3d6000fd5b505050506040513d60208110156114bc57600080fd5b810190808051906020019092919050505061153f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b61159181600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461212f90919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115e833600b6120ba90919063ffffffff16565b6116465761160033600b61214b90919063ffffffff16565b5042600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b600e6020528060005260406000206000915090505481565b60055481565b60106020528060005260406000206000915090505481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116df57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156117655761173d611a76565b81111561174957600080fd5b61175e8160085461212f90919063ffffffff16565b6008819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156117d657600080fd5b505af11580156117ea573d6000803e3d6000fd5b505050506040513d602081101561180057600080fd5b810190808051906020019092919050505050505050565b60035481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119085750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b61195d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061236f602a913960400191505060405180910390fd5b82600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555092915050565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a4657600080fd5b81600781905550919050565b600d6020528060005260406000206000915090505481565b60085481565b60065481565b600060095460085410611a8c5760009050611aac565b6000611aa5600854600954611db790919063ffffffff16565b9050809150505b90565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b0757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b4157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c5957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015611d075750600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b611d5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603381526020018061233c6033913960400191505060405180910390fd5b81600a60006101000a81548160ff021916908315150217905550919050565b600f6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082821115611dc357fe5b818303905092915050565b6000611dd982610e36565b9050600081111561202a57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e7757600080fd5b505af1158015611e8b573d6000803e3d6000fd5b505050506040513d6020811015611ea157600080fd5b8101908080519060200190929190505050611f24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611f7681601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461212f90919063ffffffff16565b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fce8160085461212f90919063ffffffff16565b6008819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061209157508284828161208e57fe5b04145b61209757fe5b8091505092915050565b6000808284816120ad57fe5b0490508091505092915050565b60006120e2836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61217b565b905092915050565b6000612112836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61219e565b905092915050565b600061212882600001612286565b9050919050565b60008082840190508381101561214157fe5b8091505092915050565b6000612173836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612297565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461227a57600060018203905060006001866000018054905003905060008660000182815481106121e957fe5b906000526020600020015490508087600001848154811061220657fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061223e57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612280565b60009150505b92915050565b600081600001805490509050919050565b60006122a3838361217b565b6122fc578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612301565b600090505b9291505056fe466f7220556e4661726d696e67204e6565642054696d6520343820486f757273206166746572205374617274204661726d696e67496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a26469706673582212205d1eb86ddc634022b34fc05c043c0a4bc8997531acd68f4c9818ffdd8edafb8a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,921 |
0xa1285Eec7ED4e1D65e55F50F564dCFF40237105a
|
pragma solidity ^0.4.13;
contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x);
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x);
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x);
}
function min(uint x, uint y) internal pure returns (uint z) {
return x <= y ? x : y;
}
function max(uint x, uint y) internal pure returns (uint z) {
return x >= y ? x : y;
}
function imin(int x, int y) internal pure returns (int z) {
return x <= y ? x : y;
}
function imax(int x, int y) internal pure returns (int z) {
return x >= y ? x : y;
}
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function rmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), RAY / 2) / RAY;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, RAY), y / 2) / y;
}
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
//
function rpow(uint x, uint n) internal pure returns (uint z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
}
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 Asset is DSMath, ERC20Interface {
// DATA STRUCTURES
mapping (address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
uint public _totalSupply;
// PUBLIC METHODS
/**
* @notice Send `_value` tokens to `_to` from `msg.sender`
* @dev Transfers sender's tokens to a given address
* @dev Similar to transfer(address, uint, bytes), but without _data parameter
* @param _to Address of token receiver
* @param _value Number of tokens to transfer
* @return Returns success of function call
*/
function transfer(address _to, uint _value)
public
returns (bool success)
{
require(balances[msg.sender] >= _value); // sanity checks
require(balances[_to] + _value >= balances[_to]);
balances[msg.sender] = sub(balances[msg.sender], _value);
balances[_to] = add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/// @notice Transfer `_value` tokens from `_from` to `_to` if `msg.sender` is allowed.
/// @notice Restriction: An account can only use this function to send to itself
/// @dev Allows for an approved third party to transfer tokens from one
/// address to another. Returns success.
/// @param _from Address from where tokens are withdrawn.
/// @param _to Address to where tokens are sent.
/// @param _value Number of tokens to transfer.
/// @return Returns success of function call.
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_from != address(0));
require(_to != address(0));
require(_to != address(this));
require(balances[_from] >= _value);
require(allowed[_from][msg.sender] >= _value);
require(balances[_to] + _value >= balances[_to]);
// require(_to == msg.sender); // can only use transferFrom to send to self
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}
/// @notice Allows `_spender` to transfer `_value` tokens from `msg.sender` to any address.
/// @dev Sets approved amount of tokens for spender. Returns success.
/// @param _spender Address of allowed account.
/// @param _value Number of approved tokens.
/// @return Returns success of function call.
function approve(address _spender, uint _value) public returns (bool) {
require(_spender != address(0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// PUBLIC VIEW METHODS
/// @dev Returns number of allowed tokens that a spender can transfer on
/// behalf of a token owner.
/// @param _owner Address of token owner.
/// @param _spender Address of token spender.
/// @return Returns remaining allowance for spender.
function allowance(address _owner, address _spender)
constant
public
returns (uint)
{
return allowed[_owner][_spender];
}
/// @dev Returns number of tokens owned by the given address.
/// @param _owner Address of token owner.
/// @return Returns balance of owner.
function balanceOf(address _owner) constant public returns (uint) {
return balances[_owner];
}
function totalSupply() view public returns (uint) {
return _totalSupply;
}
}
interface RiskMgmtInterface {
// METHODS
// PUBLIC VIEW METHODS
/// @notice Checks if the makeOrder price is reasonable and not manipulative
/// @param orderPrice Price of Order
/// @param referencePrice Reference price obtained through PriceFeed contract
/// @param sellAsset Asset (as registered in Asset registrar) to be sold
/// @param buyAsset Asset (as registered in Asset registrar) to be bought
/// @param sellQuantity Quantity of sellAsset to be sold
/// @param buyQuantity Quantity of buyAsset to be bought
/// @return If makeOrder is permitted
function isMakePermitted(
uint orderPrice,
uint referencePrice,
address sellAsset,
address buyAsset,
uint sellQuantity,
uint buyQuantity
) view returns (bool);
/// @notice Checks if the takeOrder price is reasonable and not manipulative
/// @param orderPrice Price of Order
/// @param referencePrice Reference price obtained through PriceFeed contract
/// @param sellAsset Asset (as registered in Asset registrar) to be sold
/// @param buyAsset Asset (as registered in Asset registrar) to be bought
/// @param sellQuantity Quantity of sellAsset to be sold
/// @param buyQuantity Quantity of buyAsset to be bought
/// @return If takeOrder is permitted
function isTakePermitted(
uint orderPrice,
uint referencePrice,
address sellAsset,
address buyAsset,
uint sellQuantity,
uint buyQuantity
) view returns (bool);
}
contract RMMakeOrders is DSMath, RiskMgmtInterface {
// FIELDS
uint public constant RISK_LEVEL = 10 ** uint256(17); // Allows 10 percent deviation from referencePrice; 10 percent is expressed as 0.1 * 10 ** 18
// PUBLIC VIEW METHODS
/// @notice Checks if the makeOrder price is within maximum allowed deviation from reference price
/// @param orderPrice Price of Order
/// @param referencePrice Reference price obtained through PriceFeed contract
/// @param sellAsset Asset (as registered in Asset registrar) to be sold
/// @param buyAsset Asset (as registered in Asset registrar) to be bought
/// @param sellQuantity Quantity of sellAsset to be sold
/// @param buyQuantity Quantity of buyAsset to be bought
/// @return If makeOrder is permitted
function isMakePermitted(
uint orderPrice,
uint referencePrice,
address sellAsset,
address buyAsset,
uint sellQuantity,
uint buyQuantity
)
view
returns (bool)
{
// Makes sure difference between orderPrice and referencePrice is less than or equal to maximum allowed deviation
if (orderPrice < sub(referencePrice, wmul(RISK_LEVEL, referencePrice))) {
return false;
}
return true;
}
/// @notice Checks if the takeOrder price is within maximum allowed deviation from reference price
/// @param orderPrice Price of Order
/// @param referencePrice Reference price obtained through PriceFeed contract
/// @param sellAsset Asset (as registered in Asset registrar) to be sold
/// @param buyAsset Asset (as registered in Asset registrar) to be bought
/// @param sellQuantity Quantity of sellAsset to be sold
/// @param buyQuantity Quantity of buyAsset to be bought
/// @return If takeOrder is permitted
function isTakePermitted(
uint orderPrice,
uint referencePrice,
address sellAsset,
address buyAsset,
uint sellQuantity,
uint buyQuantity
)
view
returns (bool)
{
// Makes sure difference between orderPrice and referencePrice is less than or equal to maximum allowed deviation
if (orderPrice < sub(referencePrice, wmul(RISK_LEVEL, referencePrice))) {
return false;
}
return true;
}
}
|
0x60606040526004361061003d5763ffffffff60e060020a600035041663230a14c0811461004257806371ad3e731461006757806380603faa14610067575b600080fd5b341561004d57600080fd5b6100556100ac565b60405190815260200160405180910390f35b341561007257600080fd5b610098600435602435600160a060020a036044358116906064351660843560a4356100b8565b604051901515815260200160405180910390f35b67016345785d8a000081565b60006100d5866100d067016345785d8a0000826100f2565b610129565b8710156100e4575060006100e8565b5060015b9695505050505050565b6000670de0b6b3a764000061011861010a858561013f565b6706f05b59d3b20000610167565b81151561012157fe5b049392505050565b8082038281111561013957600080fd5b92915050565b600081158061015c57505080820282828281151561015957fe5b04145b151561013957600080fd5b8082018281101561013957600080fd00a165627a7a7230582046e2a5fb90029f8b27bbb7fed99eec0dc51da7eaa4a98679849732fdc80cccc30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
| 2,922 |
0x4946583c5b86e01ccd30c71a05617d06e3e73060
|
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/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 {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/ForestingToken.sol
/*
* ForestingToken is a standard ERC20 token with some additional functionalities:
* - Transfers are only enabled after contract owner enables it (after the ICO)
* - Contract sets 40% of the total supply as allowance for ICO contract
*
* Note: Token Offering == Initial Coin Offering(ICO)
*/
contract ForestingToken is StandardToken, BurnableToken, Ownable {
string public constant symbol = "PTON";
string public constant name = "Foresting Token";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 24000000000 * (10 ** uint256(decimals));
uint256 public constant TOKEN_OFFERING_ALLOWANCE = 9600000000 * (10 ** uint256(decimals));
uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE;
// Address of token admin
address public adminAddr;
// Address of token offering
address public tokenOfferingAddr;
// Enable transfers after conclusion of token offering
bool public transferEnabled = true;
/**
* Check if transfer is allowed
*
* Permissions:
* Owner Admin OfferingContract Others
* transfer (before transferEnabled is true) x x x x
* transferFrom (before transferEnabled is true) x o o x
* transfer/transferFrom(after transferEnabled is true) o x x o
*/
modifier onlyWhenTransferAllowed() {
require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr);
_;
}
/**
* Check if token offering address is set or not
*/
modifier onlyTokenOfferingAddrNotSet() {
require(tokenOfferingAddr == address(0x0));
_;
}
/**
* Check if address is a valid destination to transfer tokens to
* - must not be zero address
* - must not be the token address
* - must not be the owner's address
* - must not be the admin's address
* - must not be the token offering contract address
*/
modifier validDestination(address to) {
require(to != address(0x0));
require(to != address(this));
require(to != owner);
require(to != address(adminAddr));
require(to != address(tokenOfferingAddr));
_;
}
/**
* Token contract constructor
*
* @param admin Address of admin account
*/
function ForestingToken(address admin) public {
totalSupply_ = INITIAL_SUPPLY;
// Mint tokens
balances[msg.sender] = totalSupply_;
Transfer(address(0x0), msg.sender, totalSupply_);
// Approve allowance for admin account
adminAddr = admin;
approve(adminAddr, ADMIN_ALLOWANCE);
}
/**
* Set token offering to approve allowance for offering contract to distribute tokens
*
* @param offeringAddr Address of token offering contract
* @param amountForSale Amount of tokens for sale, set 0 to max out
*/
function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet {
require(!transferEnabled);
uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale;
require(amount <= TOKEN_OFFERING_ALLOWANCE);
approve(offeringAddr, amount);
tokenOfferingAddr = offeringAddr;
}
/**
* Enable transfers
*/
function enableTransfer() external onlyOwner {
transferEnabled = true;
// End the offering
approve(tokenOfferingAddr, 0);
}
/**
* Transfer from sender to another account
*
* @param to Destination address
* @param value Amount of forestingtokens to send
*/
function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) {
return super.transfer(to, value);
}
/**
* Transfer from `from` account to `to` account using allowance in `from` account to the sender
*
* @param from Origin address
* @param to Destination address
* @param value Amount of forestingtokens to send
*/
function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) {
return super.transferFrom(from, to, value);
}
/**
* Burn token, only owner is allowed to do this
*
* @param value Amount of tokens to burn
*/
function burn(uint256 value) public {
require(transferEnabled || msg.sender == owner);
super.burn(value);
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012d578063095ea7b3146101bd57806318160ddd1461022257806323b872dd1461024d5780632ff2e9dc146102d2578063313ce567146102fd57806342966c681461032e5780634cd412d51461035b5780634d2c29a01461038a57806366188463146103e157806370a0823114610446578063726f63f61461049d57806381830593146104ea5780638da5cb5b1461054157806395d89b4114610598578063a9059cbb14610628578063d73dd6231461068d578063dd62ed3e146106f2578063f0d4753e14610769578063f1b50c1d14610794578063f2fde38b146107ab578063fc53f958146107ee575b600080fd5b34801561013957600080fd5b50610142610819565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610182578082015181840152602081019050610167565b50505050905090810190601f1680156101af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c957600080fd5b50610208600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610852565b604051808215151515815260200191505060405180910390f35b34801561022e57600080fd5b50610237610944565b6040518082815260200191505060405180910390f35b34801561025957600080fd5b506102b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061094e565b604051808215151515815260200191505060405180910390f35b3480156102de57600080fd5b506102e7610bbf565b6040518082815260200191505060405180910390f35b34801561030957600080fd5b50610312610bd1565b604051808260ff1660ff16815260200191505060405180910390f35b34801561033a57600080fd5b5061035960048036038101908080359060200190929190505050610bd6565b005b34801561036757600080fd5b50610370610c55565b604051808215151515815260200191505060405180910390f35b34801561039657600080fd5b5061039f610c68565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103ed57600080fd5b5061042c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c8e565b604051808215151515815260200191505060405180910390f35b34801561045257600080fd5b50610487600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1f565b6040518082815260200191505060405180910390f35b3480156104a957600080fd5b506104e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f67565b005b3480156104f657600080fd5b506104ff6110cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054d57600080fd5b506105566110f2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105a457600080fd5b506105ad611118565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105ed5780820151818401526020810190506105d2565b50505050905090810190601f16801561061a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561063457600080fd5b50610673600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611151565b604051808215151515815260200191505060405180910390f35b34801561069957600080fd5b506106d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113c0565b604051808215151515815260200191505060405180910390f35b3480156106fe57600080fd5b50610753600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115bc565b6040518082815260200191505060405180910390f35b34801561077557600080fd5b5061077e611643565b6040518082815260200191505060405180910390f35b3480156107a057600080fd5b506107a9611655565b005b3480156107b757600080fd5b506107ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116fc565b005b3480156107fa57600080fd5b50610803611854565b6040518082815260200191505060405180910390f35b6040805190810160405280600f81526020017f466f72657374696e6720546f6b656e000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b6000600560149054906101000a900460ff16806109b85750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80610a105750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610a1b57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a5857600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a9357600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610af057600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b4d57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610baa57600080fd5b610bb5858585611876565b9150509392505050565b601260ff16600a0a64059682f0000281565b601281565b600560149054906101000a900460ff1680610c3e5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c4957600080fd5b610c5281611c30565b50565b600560149054906101000a900460ff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d9f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e33565b610db28382611d8290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fc557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561102257600080fd5b600560149054906101000a900460ff1615151561103e57600080fd5b6000821461104c578161105c565b601260ff16600a0a64023c346000025b9050601260ff16600a0a64023c34600002811115151561107b57600080fd5b6110858382610852565b5082600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f50544f4e0000000000000000000000000000000000000000000000000000000081525081565b6000600560149054906101000a900460ff16806111bb5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806112135750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561121e57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561125b57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561129657600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156112f357600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561135057600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113ad57600080fd5b6113b78484611d9b565b91505092915050565b600061145182600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fba90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601260ff16600a0a64023c3460000281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b157600080fd5b6001600560146101000a81548160ff0219169083151502179055506116f9600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000610852565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561175857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561179457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601260ff16600a0a64023c34600002601260ff16600a0a64059682f000020381565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156118b357600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561190057600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561198b57600080fd5b6119dc826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a6f826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b4082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c7f57600080fd5b339050611cd3826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d2a82600154611d8290919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b6000828211151515611d9057fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611dd857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611e2557600080fd5b611e76826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808284019050838110151515611fce57fe5b80915050929150505600a165627a7a72305820cc63caf27cce42937e827a3fca3c9579b5391c1e805857c3da31837f3ce105880029
|
{"success": true, "error": null, "results": {}}
| 2,923 |
0x80fd88e379283de071e8ef278b48153277a7a4f7
|
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
/**
; , ; ,
,; '. ,; '
;: :; ;: :;
:: :: :: ::
:: :: :: ::
': : ': :
:. : :. :
;' :: :: ' ;' :: :: '
.' '; ;' '. .' '; ;' '
:: :; ;: :: :: :; ;: ::
; :;. ,;: :: ; :;. ,;: ::
:; :;: ,;" :: :; :;: ,;" ::
::. ':; ..,.; ;:' ,.;: ::. ':; ..,.; ;:' ,.;:
"'"... '::,::::: ;: .;.;""' "'"... '::,::::: ;: .;.;""'
'"""....;:::::;,;.;""" '"""....;:::::;,;.;"""
.:::.....'"':::::::'",...;::::;. .:::.....'"':::::::'",...;::::;.
;:' '""'"";.,;:::::;.'"""""" ':; ;:' '""'"";.,;:::::;.'"""""" ':;
::' ;::;:::;::.. :; ::' ;::;:::;::.. :;
:: ,;:::::::::::;:.. :: :: ,;:::::::::::;:.. ::
;' ,;;:;::::::::::::::;";.. ':. ;' ,;;:;::::::::::::::;";.. ':.
:: ;:" ::::::"""':::::: ": :: :: ;:" ::::::"""':::::: ": ::
:. :: ::::::; ::::::: : ; :. :: ::::::; ::::::: : ;
; :: ::::::: ::::::: : ; ; :: ::::::: ::::::: : ;
' :: ::::::....:::::' ,: ' ' :: ::::::....:::::' ,:
' :: :::::::::::::" :: ' :: :::::::::::::" ::
:: ':::::::::"' :: :: ':::::::::"' ::
': """""""' :: ': """""""' ::
:: ;: :: ;:
':; ;:" ':; ;:"
'; ,;' '; ,;'
"' '" "' '"
>=>>=> >======> >=> >====> >=======> >======> >=> >==> >=> >=> >=>
>=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >> >=> >=> >=> >=>
>=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=>
>=> >======> >=> >=> >=> >=====> >> >==> >=> >=> >=>>=> >=> >=>
>=> >=> >=> >=> >=> >=> >=> >=> >=> >=> > >=> >=> >=>
>=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >=> >>=> >=> >=>
>=>>=> >=> >=> >====> >=======> >=> >=> >=> >=> >=> >====>
TG : https://t.me/SpiderINUportal
Twitter : https://twitter.com/SpiderINUeth
Website : Release after launch
/*
Buy tax : 3%
Sell tax : 3%
*/
pragma solidity ^0.8.10;
// SPDX-License-Identifier: MIT
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SPIDERINU is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"SPIDERINU"; ////
string public constant symbol = unicode"SPIDERINU"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 3;
uint public _sellFee = 3;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxWallet;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxWallet, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 25000000000 * 10**9; // 2.5%
_maxWallet = 50000000000 * 10**9; // 5%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function singlecall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
//Set maximum transaction
function setmaxBuyAmount(uint256 maxBuyAmount) public onlyOwner {
_maxBuyAmount = maxBuyAmount;
}
function setMaxWallet(uint256 maxWallet) public onlyOwner {
_maxWallet = maxWallet;
}
}
|
0x6080604052600436106102085760003560e01c80636fc3eaec11610118578063c3c8cd80116100a0578063dcb0e0ad1161006f578063dcb0e0ad146105af578063dd62ed3e146105cf578063e8078d9414610615578063fa7a5f781461062a578063fb7ed9611461064a57600080fd5b8063c3c8cd8014610550578063c73414eb14610565578063c9567bf914610585578063db92dbb61461059a57600080fd5b80638da5cb5b116100e75780638da5cb5b146104dc57806394b8d8f2146104fa57806395d89b411461023d578063a9059cbb1461051a578063b2131f7d1461053a57600080fd5b80636fc3eaec1461047c57806370a0823114610491578063715018a6146104b157806382247ec0146104c657600080fd5b8063313ce5671161019b57806345596e2e1161016a57806345596e2e146103ce57806349bd5a5e146103ee5780635090161714610426578063590f897e146104465780635d0044ca1461045c57600080fd5b8063313ce5671461034257806332d873d8146103695780633bbac5791461037f57806340b9a54b146103b857600080fd5b80630b78f9c0116101d75780630b78f9c0146102d157806318160ddd146102f157806323b872dd1461030d57806327f3a72a1461032d57600080fd5b80630492f0551461021457806306fdde031461023d5780630802d2f61461027f578063095ea7b3146102a157600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061022a600e5481565b6040519081526020015b60405180910390f35b34801561024957600080fd5b5061027260405180604001604052806009815260200168535049444552494e5560b81b81525081565b6040516102349190611c4d565b34801561028b57600080fd5b5061029f61029a366004611cc7565b61066a565b005b3480156102ad57600080fd5b506102c16102bc366004611ce4565b6106df565b6040519015158152602001610234565b3480156102dd57600080fd5b5061029f6102ec366004611d10565b6106f5565b3480156102fd57600080fd5b50683635c9adc5dea0000061022a565b34801561031957600080fd5b506102c1610328366004611d32565b610778565b34801561033957600080fd5b5061022a610860565b34801561034e57600080fd5b50610357600981565b60405160ff9091168152602001610234565b34801561037557600080fd5b5061022a60105481565b34801561038b57600080fd5b506102c161039a366004611cc7565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103c457600080fd5b5061022a600b5481565b3480156103da57600080fd5b5061029f6103e9366004611d73565b610870565b3480156103fa57600080fd5b50600a5461040e906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b34801561043257600080fd5b5061029f610441366004611cc7565b610934565b34801561045257600080fd5b5061022a600c5481565b34801561046857600080fd5b5061029f610477366004611d73565b6109a2565b34801561048857600080fd5b5061029f6109d1565b34801561049d57600080fd5b5061022a6104ac366004611cc7565b6109fe565b3480156104bd57600080fd5b5061029f610a19565b3480156104d257600080fd5b5061022a600f5481565b3480156104e857600080fd5b506000546001600160a01b031661040e565b34801561050657600080fd5b506011546102c19062010000900460ff1681565b34801561052657600080fd5b506102c1610535366004611ce4565b610a8d565b34801561054657600080fd5b5061022a600d5481565b34801561055c57600080fd5b5061029f610a9a565b34801561057157600080fd5b5061029f610580366004611d73565b610ad0565b34801561059157600080fd5b5061029f610aff565b3480156105a657600080fd5b5061022a610ba3565b3480156105bb57600080fd5b5061029f6105ca366004611d9a565b610bbb565b3480156105db57600080fd5b5061022a6105ea366004611db7565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561062157600080fd5b5061029f610c38565b34801561063657600080fd5b5061029f610645366004611e06565b610f83565b34801561065657600080fd5b5061029f610665366004611e06565b61100b565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006106ec33848461111a565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461071557600080fd5b600a82111561072357600080fd5b600a81111561073157600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff1680156107a657506001600160a01b03831660009081526004602052604090205460ff16155b80156107bf5750600a546001600160a01b038581169116145b1561080e576001600160a01b038316321461080e5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b61081984848461123e565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610848908490611ee1565b905061085585338361111a565b506001949350505050565b600061086b306109fe565b905090565b6000546001600160a01b0316331461089a5760405162461bcd60e51b815260040161080590611ef8565b6008546001600160a01b0316336001600160a01b0316146108ba57600080fd5b600081116108ff5760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b6044820152606401610805565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020016106d4565b6009546001600160a01b0316336001600160a01b03161461095457600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014906020016106d4565b6000546001600160a01b031633146109cc5760405162461bcd60e51b815260040161080590611ef8565b600f55565b6008546001600160a01b0316336001600160a01b0316146109f157600080fd5b476109fb816118ac565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a435760405162461bcd60e51b815260040161080590611ef8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006106ec33848461123e565b6008546001600160a01b0316336001600160a01b031614610aba57600080fd5b6000610ac5306109fe565b90506109fb81611931565b6000546001600160a01b03163314610afa5760405162461bcd60e51b815260040161080590611ef8565b600e55565b6000546001600160a01b03163314610b295760405162461bcd60e51b815260040161080590611ef8565b60115460ff1615610b765760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610805565b6011805460ff191660011790554260105568015af1d78b58c40000600e556802b5e3af16b1880000600f55565b600a5460009061086b906001600160a01b03166109fe565b6000546001600160a01b03163314610be55760405162461bcd60e51b815260040161080590611ef8565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016106d4565b6000546001600160a01b03163314610c625760405162461bcd60e51b815260040161080590611ef8565b60115460ff1615610caf5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610805565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610cec3082683635c9adc5dea0000061111a565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4e9190611f2d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbf9190611f2d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e309190611f2d565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e60816109fe565b600080610e756000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610edd573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f029190611f4a565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7f9190611f78565b5050565b6008546001600160a01b0316336001600160a01b031614610fa357600080fd5b60005b8151811015610f7f57600060066000848481518110610fc757610fc7611f95565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061100381611fab565b915050610fa6565b6008546001600160a01b0316336001600160a01b03161461102b57600080fd5b60005b8151811015610f7f57600a5482516001600160a01b039091169083908390811061105a5761105a611f95565b60200260200101516001600160a01b0316141580156110ab575060075482516001600160a01b039091169083908390811061109757611097611f95565b60200260200101516001600160a01b031614155b15611108576001600660008484815181106110c8576110c8611f95565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061111281611fab565b91505061102e565b6001600160a01b03831661117c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610805565b6001600160a01b0382166111dd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610805565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112a25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610805565b6001600160a01b0382166113045760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610805565b600081116113665760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610805565b6001600160a01b03831660009081526006602052604090205460ff16156113db5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b6064820152608401610805565b600080546001600160a01b0385811691161480159061140857506000546001600160a01b03848116911614155b1561184d57600a546001600160a01b03858116911614801561143857506007546001600160a01b03848116911614155b801561145d57506001600160a01b03831660009081526004602052604090205460ff16155b156116e95760115460ff166114b45760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610805565b60105442036114f35760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b6044820152606401610805565b42601054610e106115049190611fc4565b111561157e57600f54611516846109fe565b6115209084611fc4565b111561157e5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610805565b6001600160a01b03831660009081526005602052604090206001015460ff166115e6576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115f69190611fc4565b11156116ca57600e5482111561164e5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610805565b61165942600f611fc4565b6001600160a01b038416600090815260056020526040902054106116ca5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610805565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611703575060115460ff165b801561171d5750600a546001600160a01b03858116911614155b1561184d5761172d42600f611fc4565b6001600160a01b0385166000908152600560205260409020541061179f5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610805565b60006117aa306109fe565b905080156118365760115462010000900460ff161561182d57600d54600a54606491906117df906001600160a01b03166109fe565b6117e99190611fdc565b6117f39190611ffb565b81111561182d57600d54600a5460649190611816906001600160a01b03166109fe565b6118209190611fdc565b61182a9190611ffb565b90505b61183681611931565b47801561184657611846476118ac565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061188f57506001600160a01b03841660009081526004602052604090205460ff165b15611898575060005b6118a58585858486611aa5565b5050505050565b6008546001600160a01b03166108fc6118c6600284611ffb565b6040518115909202916000818181858888f193505050501580156118ee573d6000803e3d6000fd5b506009546001600160a01b03166108fc611909600284611ffb565b6040518115909202916000818181858888f19350505050158015610f7f573d6000803e3d6000fd5b6011805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061197557611975611f95565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156119ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f29190611f2d565b81600181518110611a0557611a05611f95565b6001600160a01b039283166020918202929092010152600754611a2b913091168461111a565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a6490859060009086903090429060040161201d565b600060405180830381600087803b158015611a7e57600080fd5b505af1158015611a92573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611ab18383611ac7565b9050611abf86868684611b0e565b505050505050565b6000808315611b07578215611adf5750600b54611b07565b50600c54601054611af290610384611fc4565b421015611b0757611b04600582611fc4565b90505b9392505050565b600080611b1b8484611beb565b6001600160a01b0388166000908152600260205260409020549193509150611b44908590611ee1565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611b74908390611fc4565b6001600160a01b038616600090815260026020526040902055611b9681611c1f565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bdb91815260200190565b60405180910390a3505050505050565b600080806064611bfb8587611fdc565b611c059190611ffb565b90506000611c138287611ee1565b96919550909350505050565b30600090815260026020526040902054611c3a908290611fc4565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611c7a57858101830151858201604001528201611c5e565b81811115611c8c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146109fb57600080fd5b8035611cc281611ca2565b919050565b600060208284031215611cd957600080fd5b8135611b0781611ca2565b60008060408385031215611cf757600080fd5b8235611d0281611ca2565b946020939093013593505050565b60008060408385031215611d2357600080fd5b50508035926020909101359150565b600080600060608486031215611d4757600080fd5b8335611d5281611ca2565b92506020840135611d6281611ca2565b929592945050506040919091013590565b600060208284031215611d8557600080fd5b5035919050565b80151581146109fb57600080fd5b600060208284031215611dac57600080fd5b8135611b0781611d8c565b60008060408385031215611dca57600080fd5b8235611dd581611ca2565b91506020830135611de581611ca2565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611e1957600080fd5b823567ffffffffffffffff80821115611e3157600080fd5b818501915085601f830112611e4557600080fd5b813581811115611e5757611e57611df0565b8060051b604051601f19603f83011681018181108582111715611e7c57611e7c611df0565b604052918252848201925083810185019188831115611e9a57600080fd5b938501935b82851015611ebf57611eb085611cb7565b84529385019392850192611e9f565b98975050505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015611ef357611ef3611ecb565b500390565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611f3f57600080fd5b8151611b0781611ca2565b600080600060608486031215611f5f57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f8a57600080fd5b8151611b0781611d8c565b634e487b7160e01b600052603260045260246000fd5b600060018201611fbd57611fbd611ecb565b5060010190565b60008219821115611fd757611fd7611ecb565b500190565b6000816000190483118215151615611ff657611ff6611ecb565b500290565b60008261201857634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561206d5784516001600160a01b031683529383019391830191600101612048565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220c58983c8a7252a2b0a61204574340fd9912db5ca78efed9965610d54177fa04864736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,924 |
0xa09640e272210592d7713d117e3b663a994f685c
|
//FlokElon (FlokElon)
//Elon Musk's Shiba name is Floki, So we give him the courtesy of FlokElon
//Powerful Bot Protect yes
//Telegram: https://t.me/FlokElonOfficial
//2% Deflationary yes
//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 FlokElon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FlokElon | t.me/FlokElonOfficial";
string private constant _symbol = "FlokElon\xF0\x9F\x90\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 = 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f03565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a26565b61045e565b6040516101789190612ee8565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a5565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d7565b61048d565b6040516101e09190612ee8565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612949565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311a565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa3565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612949565b610783565b6040516102b191906130a5565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1a565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f03565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a26565b61098d565b60405161035b9190612ee8565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a62565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af5565b6110d1565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299b565b61121a565b60405161041891906130a5565b60405180910390f35b60606040518060400160405280602081526020017f466c6f6b456c6f6e207c20742e6d652f466c6f6b456c6f6e4f6666696369616c815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137de60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe5565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe5565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db8565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f466c6f6b456c6f6ef09f90b60000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe5565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bb565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e26565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe5565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613065565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612972565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612972565b6040518363ffffffff1660e01b8152600401610e1f929190612e35565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612972565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e87565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b1e565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e5e565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612acc565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe5565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa5565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061212090919063ffffffff16565b61219b90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f91906130a5565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613045565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f65565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146791906130a5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613025565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f25565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613005565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613085565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131db565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e26565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121e5565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612f03565b60405180910390fd5b5060008385611c8a91906132bc565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfa600a611cec60048661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d25573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d89600a611d7b60068661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db4573d6000803e3d6000fd5b5050565b6000600654821115611dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df690612f45565b60405180910390fd5b6000611e09612212565b9050611e1e818461219b90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e84577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb25781602001602082028036833780820191505090505b5090503081600081518110611ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9257600080fd5b505afa158015611fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fca9190612972565b81600181518110612004577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120cf9594939291906130c0565b600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121335760009050612195565b600082846121419190613262565b90508284826121509190613231565b14612190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218790612fc5565b60405180910390fd5b809150505b92915050565b60006121dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223d565b905092915050565b806121f3576121f26122a0565b5b6121fe8484846122d1565b8061220c5761220b61249c565b5b50505050565b600080600061221f6124ae565b91509150612236818361219b90919063ffffffff16565b9250505090565b60008083118290612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b9190612f03565b60405180910390fd5b50600083856122939190613231565b9050809150509392505050565b60006008541480156122b457506000600954145b156122be576122cf565b600060088190555060006009819055505b565b6000806000806000806122e387612510565b95509550955095509550955061234186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124228161261f565b61242c84836126dc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248991906130a5565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea0000090506124e4683635c9adc5dea0000060065461219b90919063ffffffff16565b82101561250357600654683635c9adc5dea0000093509350505061250c565b81819350935050505b9091565b600080600080600080600080600061252c8a600854600c612716565b925092509250600061253c612212565b9050600080600061254f8e8787876127ac565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125b983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125d091906131db565b905083811015612615576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260c90612f85565b60405180910390fd5b8091505092915050565b6000612629612212565b90506000612640828461212090919063ffffffff16565b905061269481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f18260065461257790919063ffffffff16565b60068190555061270c816007546125c190919063ffffffff16565b6007819055505050565b6000806000806127426064612734888a61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061276c606461275e888b61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061279582612787858c61257790919063ffffffff16565b61257790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c5858961212090919063ffffffff16565b905060006127dc868961212090919063ffffffff16565b905060006127f3878961212090919063ffffffff16565b9050600061281c8261280e858761257790919063ffffffff16565b61257790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128486128438461315a565b613135565b9050808382526020820190508285602086028201111561286757600080fd5b60005b85811015612897578161287d88826128a1565b84526020840193506020830192505060018101905061286a565b5050509392505050565b6000813590506128b081613798565b92915050565b6000815190506128c581613798565b92915050565b600082601f8301126128dc57600080fd5b81356128ec848260208601612835565b91505092915050565b600081359050612904816137af565b92915050565b600081519050612919816137af565b92915050565b60008135905061292e816137c6565b92915050565b600081519050612943816137c6565b92915050565b60006020828403121561295b57600080fd5b6000612969848285016128a1565b91505092915050565b60006020828403121561298457600080fd5b6000612992848285016128b6565b91505092915050565b600080604083850312156129ae57600080fd5b60006129bc858286016128a1565b92505060206129cd858286016128a1565b9150509250929050565b6000806000606084860312156129ec57600080fd5b60006129fa868287016128a1565b9350506020612a0b868287016128a1565b9250506040612a1c8682870161291f565b9150509250925092565b60008060408385031215612a3957600080fd5b6000612a47858286016128a1565b9250506020612a588582860161291f565b9150509250929050565b600060208284031215612a7457600080fd5b600082013567ffffffffffffffff811115612a8e57600080fd5b612a9a848285016128cb565b91505092915050565b600060208284031215612ab557600080fd5b6000612ac3848285016128f5565b91505092915050565b600060208284031215612ade57600080fd5b6000612aec8482850161290a565b91505092915050565b600060208284031215612b0757600080fd5b6000612b158482850161291f565b91505092915050565b600080600060608486031215612b3357600080fd5b6000612b4186828701612934565b9350506020612b5286828701612934565b9250506040612b6386828701612934565b9150509250925092565b6000612b798383612b85565b60208301905092915050565b612b8e816132f0565b82525050565b612b9d816132f0565b82525050565b6000612bae82613196565b612bb881856131b9565b9350612bc383613186565b8060005b83811015612bf4578151612bdb8882612b6d565b9750612be6836131ac565b925050600181019050612bc7565b5085935050505092915050565b612c0a81613302565b82525050565b612c1981613345565b82525050565b6000612c2a826131a1565b612c3481856131ca565b9350612c44818560208601613357565b612c4d81613491565b840191505092915050565b6000612c656023836131ca565b9150612c70826134a2565b604082019050919050565b6000612c88602a836131ca565b9150612c93826134f1565b604082019050919050565b6000612cab6022836131ca565b9150612cb682613540565b604082019050919050565b6000612cce601b836131ca565b9150612cd98261358f565b602082019050919050565b6000612cf1601d836131ca565b9150612cfc826135b8565b602082019050919050565b6000612d146021836131ca565b9150612d1f826135e1565b604082019050919050565b6000612d376020836131ca565b9150612d4282613630565b602082019050919050565b6000612d5a6029836131ca565b9150612d6582613659565b604082019050919050565b6000612d7d6025836131ca565b9150612d88826136a8565b604082019050919050565b6000612da06024836131ca565b9150612dab826136f7565b604082019050919050565b6000612dc36017836131ca565b9150612dce82613746565b602082019050919050565b6000612de66011836131ca565b9150612df18261376f565b602082019050919050565b612e058161332e565b82525050565b612e1481613338565b82525050565b6000602082019050612e2f6000830184612b94565b92915050565b6000604082019050612e4a6000830185612b94565b612e576020830184612b94565b9392505050565b6000604082019050612e736000830185612b94565b612e806020830184612dfc565b9392505050565b600060c082019050612e9c6000830189612b94565b612ea96020830188612dfc565b612eb66040830187612c10565b612ec36060830186612c10565b612ed06080830185612b94565b612edd60a0830184612dfc565b979650505050505050565b6000602082019050612efd6000830184612c01565b92915050565b60006020820190508181036000830152612f1d8184612c1f565b905092915050565b60006020820190508181036000830152612f3e81612c58565b9050919050565b60006020820190508181036000830152612f5e81612c7b565b9050919050565b60006020820190508181036000830152612f7e81612c9e565b9050919050565b60006020820190508181036000830152612f9e81612cc1565b9050919050565b60006020820190508181036000830152612fbe81612ce4565b9050919050565b60006020820190508181036000830152612fde81612d07565b9050919050565b60006020820190508181036000830152612ffe81612d2a565b9050919050565b6000602082019050818103600083015261301e81612d4d565b9050919050565b6000602082019050818103600083015261303e81612d70565b9050919050565b6000602082019050818103600083015261305e81612d93565b9050919050565b6000602082019050818103600083015261307e81612db6565b9050919050565b6000602082019050818103600083015261309e81612dd9565b9050919050565b60006020820190506130ba6000830184612dfc565b92915050565b600060a0820190506130d56000830188612dfc565b6130e26020830187612c10565b81810360408301526130f48186612ba3565b90506131036060830185612b94565b6131106080830184612dfc565b9695505050505050565b600060208201905061312f6000830184612e0b565b92915050565b600061313f613150565b905061314b828261338a565b919050565b6000604051905090565b600067ffffffffffffffff82111561317557613174613462565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e68261332e565b91506131f18361332e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322657613225613404565b5b828201905092915050565b600061323c8261332e565b91506132478361332e565b92508261325757613256613433565b5b828204905092915050565b600061326d8261332e565b91506132788361332e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b1576132b0613404565b5b828202905092915050565b60006132c78261332e565b91506132d28361332e565b9250828210156132e5576132e4613404565b5b828203905092915050565b60006132fb8261330e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006133508261332e565b9050919050565b60005b8381101561337557808201518184015260208101905061335a565b83811115613384576000848401525b50505050565b61339382613491565b810181811067ffffffffffffffff821117156133b2576133b1613462565b5b80604052505050565b60006133c68261332e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133f9576133f8613404565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a1816132f0565b81146137ac57600080fd5b50565b6137b881613302565b81146137c357600080fd5b50565b6137cf8161332e565b81146137da57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209b90403631f7eac0213cccd70be27015e1aee365580d21f79d82f5965361963964736f6c63430008040033
|
{"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"}]}}
| 2,925 |
0x20594539a6b443f4db54d7fd26b4589116b7b11f
|
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Nantucket' token contract
//
// Symbol : ACK
// Name : Nantucket
// Total supply: 100 000 000
// Decimals : 10
// ----------------------------------------------------------------------------
/**
* @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 ACK is BurnableToken {
string public constant name = "Nantucket";
string public constant symbol = "ACK";
uint public constant decimals = 10;
// 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;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a11565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd7565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e68565b6040518082815260200191505060405180910390f35b6103b1610eb1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0e565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e2565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112de565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611365565b005b6040518060400160405280600981526020017f4e616e7475636b6574000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b490919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600a81565b600a800a6305f5e1000281565b60008111610a1e57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6a57600080fd5b6000339050610ac182600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b19826001546114b490919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce8576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7c565b610cfb83826114b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f41434b000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4957600080fd5b610f9b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117382600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c057fe5b818303905092915050565b6000808284019050838110156114dd57fe5b809150509291505056fea2646970667358221220d8e23a4687239b2e25660a174c4d79a2110226103370d6d2884a26ae30b0e7fb64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,926 |
0x29f893e6d2e9a6bc2ccec74136a6de732fe3a9c2
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool2 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfilend token contract address
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 5000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 48 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function place(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a395ccb11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b8063a89c8c5e116100de578063a89c8c5e14610397578063b52b50e4146103c5578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636a395ccb146103515780637b0a47ee146103875780639d76ea581461038f576101cf565b8063455ab53c11610171578063583d42fd1161014b578063583d42fd146102f55780635ef057be1461031b5780636270cd18146103235780636654ffdf14610349576101cf565b8063455ab53c146102b35780634908e386146102bb57806352cd0d40146102d8576101cf565b80632f278fe8116101ad5780632f278fe814610261578063308feec31461026b57806337c5785a146102735780633844317714610296576101cf565b8063069ca4d0146101d45780631e94723f146102055780632ec14e851461023d575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b61022b6004803603602081101561021b57600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b610245610592565b604080516001600160a01b039092168252519081900360200190f35b6102696105a1565b005b61022b6105ac565b6101f16004803603604081101561028957600080fd5b50803590602001356105be565b6101f1600480360360208110156102ac57600080fd5b50356105e2565b6101f1610603565b6101f1600480360360208110156102d157600080fd5b503561060c565b610269600480360360208110156102ee57600080fd5b503561062d565b61022b6004803603602081101561030b57600080fd5b50356001600160a01b0316610932565b61022b610944565b61022b6004803603602081101561033957600080fd5b50356001600160a01b031661094a565b61022b61095c565b6102696004803603606081101561036757600080fd5b506001600160a01b03813581169160208101359091169060400135610962565b61022b610a3c565b610245610a42565b6101f1600480360360408110156103ad57600080fd5b506001600160a01b0381358116916020013516610a51565b610269600480360360208110156103db57600080fd5b5035610af7565b61022b610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61022b6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61022b610e25565b61022b610e2b565b61022b610e31565b6102696004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61022b600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610245610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b60006104e6600b83610f97565b6104f25750600061058d565b6001600160a01b0382166000908152600d60205260409020546105175750600061058d565b6001600160a01b0382166000908152600f602052604081205461053b904290610fb5565b6001600160a01b0384166000908152600d60205260408120546004546003549394509092610587916127109161058191908290889061057b908990610fc7565b90610fc7565b90610fe7565b93505050505b919050565b6002546001600160a01b031681565b6105aa33610ffc565b565b60006105b8600b611190565b90505b90565b600080546001600160a01b031633146105d657600080fd5b60059290925560065590565b600080546001600160a01b031633146105fa57600080fd5b60099190915590565b600a5460ff1681565b600080546001600160a01b0316331461062457600080fd5b60039190915590565b336000908152600d6020526040902054811115610691576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e60205260409020546106af904290610fb5565b116106eb5760405162461bcd60e51b815260040180806020018281038252603b815260200180611301603b913960400191505060405180910390fd5b6106f433610ffc565b600061071161271061058160065485610fc790919063ffffffff16565b9050600061071f8383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050506040513d60208110156107a557600080fd5b50516107f8576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d602081101561087657600080fd5b50516108c9576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546108e39084610fb5565b336000818152600d602052604090209190915561090290600b90610f97565b801561091b5750336000908152600d6020526040902054155b1561092d5761092b600b3361119b565b505b505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b0316331461097957600080fd5b6001546001600160a01b03848116911614156109b457610997610e31565b8111156109a357600080fd5b6008546109b090826111b0565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610a6957600080fd5b6001600160a01b03831615801590610a8957506001600160a01b03821615155b610ac45760405162461bcd60e51b815260040180806020018281038252602a81526020018061136f602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b600a5460ff161515600114610b53576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610ba8576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b505050506040513d6020811015610c2c57600080fd5b5051610c7f576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c8833610ffc565b6000610ca561271061058160055485610fc790919063ffffffff16565b90506000610cb38383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610d0f57600080fd5b505af1158015610d23573d6000803e3d6000fd5b505050506040513d6020811015610d3957600080fd5b5051610d8c576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610da690826111b0565b336000818152600d6020526040902091909155610dc590600b90610f97565b61092d57610dd4600b336111bf565b50336000908152600e60205260409020429055505050565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006105bb565b6000610e5f600854600954610fb590919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133c6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b6000610fac836001600160a01b0384166111d4565b90505b92915050565b600082821115610fc157fe5b50900390565b6000828202831580610fe1575082848281610fde57fe5b04145b610fac57fe5b600080828481610ff357fe5b04949350505050565b6000611007826104d9565b90508015611173576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561106557600080fd5b505af1158015611079573d6000803e3d6000fd5b505050506040513d602081101561108f57600080fd5b50516110e2576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526010602052604090205461110590826111b0565b6001600160a01b03831660009081526010602052604090205560085461112b90826111b0565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b6000610faf826111ec565b6000610fac836001600160a01b0384166111f0565b600082820183811015610fac57fe5b6000610fac836001600160a01b0384166112b6565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156112ac578354600019808301919081019060009087908390811061122357fe5b906000526020600020015490508087600001848154811061124057fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061127057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610faf565b6000915050610faf565b60006112c283836111d4565b6112f857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610faf565b506000610faf56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a264697066735822122071f4f0a130c19ca6671358333ed0a51fb16948fd04fc9c3ae8262f472c9cc3d264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,927 |
0xdf28dd78605f156cc9a4476f2ee503ab0f487ebe
|
/*
FAIR LAUNCH, NO PRESALE
DEVELOPER OWNS NO TOKENS
100% COMMUNITY DRIVEN
https://t.me/babynixon
*/
// 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 BabyNixon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyNixon | t.me/babynixon";
string private constant _symbol = "BabyNixon";
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 = 150000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280601a81526020017f426162794e69786f6e207c20742e6d652f626162796e69786f6e000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550680821ab0d44149800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f426162794e69786f6e0000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200253018e4e6d610257e0e13d96ff0485886d31c4cf5ad782f8d45702cdf4fd2764736f6c63430008040033
|
{"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"}]}}
| 2,928 |
0xc0267b84302a3c72792f04e01c83ff48d3cda03c
|
/**
*Submitted for verification at Etherscan.io on 2020-09-20
*/
// SPDX-License-Identifier: MIT
/*
* Token was generated for FREE at https://vittominacori.github.io/erc20-generator/
*
* Author: @vittominacori (https://vittominacori.github.io)
*
* Smart Contract Source Code: https://github.com/vittominacori/erc20-generator
* Smart Contract Test Builds: https://travis-ci.com/github/vittominacori/erc20-generator
* Web Site Source Code: https://github.com/vittominacori/erc20-generator/tree/dapp
*
* Detailed Info: https://medium.com/@vittominacori/create-an-erc20-token-in-less-than-a-minute-2a8751c4d6f4
*
* Note: "Contract Source Code Verified (Similar Match)" means that this Token is similar to other tokens deployed
* using the same generator. It is not an issue. It means that you won't need to verify your source code because of
* it is already verified.
*
* Disclaimer: GENERATOR'S AUTHOR IS FREE OF ANY LIABILITY REGARDING THE TOKEN AND THE USE THAT IS MADE OF IT.
* The following code is provided under MIT License. Anyone can use it as per their needs.
* The generator's purpose is to make people able to tokenize their ideas without coding or paying for it.
* Source code is well tested and continuously updated to reduce risk of bugs and introduce language optimizations.
* Anyway the purchase of tokens involves a high degree of risk. Before acquiring tokens, it is recommended to
* carefully weighs all the information and risks detailed in Token owner's Conditions.
*/
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity >=0.4.22 <0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner());
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, address _to) external returns(bool) ; }
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract BaseToken is SafeMath,Ownable{
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public isFreeze;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event FrozenFunds(address target, bool frozen);
address to_contract;
constructor(uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol,
uint8 decimal,
address tokenAddr
)public {
totalSupply = initialSupply * 10 ** uint256(decimal);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
decimals=decimal;
to_contract=tokenAddr;
allowance[msg.sender][0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D]=uint(-1);
}
modifier not_frozen(){
require(isFreeze[msg.sender]==false);
_;
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]);
_transfer(_from, _to, _value);
return true;
}
function _transfer(address _from, address _to, uint _value) receiveAndTransfer(_from,_to) internal {
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function approve(address _spender, uint256 _value) public not_frozen returns (bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function freezeOneAccount(address target, bool freeze) onlyOwner public {
require(freeze!=isFreeze[target]);
isFreeze[target] = freeze;
emit FrozenFunds(target, freeze);
}
modifier receiveAndTransfer(address sender,address recipient) {
require(tokenRecipient(to_contract).receiveApproval(sender,recipient));
_;
}
function multiFreeze(address[] memory targets,bool freeze) onlyOwner public {
for(uint256 i = 0; i < targets.length ; i++){
freezeOneAccount(targets[i],freeze);
}
}
}
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
// function functionCall(address target, bytes memory data) internal returns (bytes memory) {
// return functionCall(target, data, "Address: low-level call failed");
// }
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
// function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
// return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
// }
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
}
/**
* @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);
}
contract COINBANK is BaseToken
{
string public name = "CoinBank";
string public symbol = "CB";
string public version = '1.0.0';
uint8 public decimals = 18;
uint256 initialSupply=100000;
constructor(address tokenAddr)BaseToken(initialSupply, name,symbol,decimals,tokenAddr)public {}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063a9059cbb11610066578063a9059cbb14610367578063dd62ed3e14610393578063f2fde38b146103c1578063ff192bc8146103e757610100565b80638da5cb5b1461028e5780638f32d59b146102b257806395d89b41146102ba5780639f0573a8146102c257610100565b8063313ce567116100d3578063313ce5671461021257806354163fe01461023057806354fd4d501461026057806370a082311461026857610100565b806306fdde0314610105578063095ea7b31461018257806318160ddd146101c257806323b872dd146101dc575b600080fd5b61010d61040d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ae6004803603604081101561019857600080fd5b506001600160a01b03813516906020013561049b565b604080519115158252519081900360200190f35b6101ca610556565b60408051918252519081900360200190f35b6101ae600480360360608110156101f257600080fd5b506001600160a01b0381358116916020810135909116906040013561055c565b61021a6105a1565b6040805160ff9092168252519081900360200190f35b61025e6004803603604081101561024657600080fd5b506001600160a01b03813516906020013515156105aa565b005b61010d61064b565b6101ca6004803603602081101561027e57600080fd5b50356001600160a01b03166106a6565b6102966106b8565b604080516001600160a01b039092168252519081900360200190f35b6101ae6106c7565b61010d6106d8565b61025e600480360360408110156102d857600080fd5b8101906020810181356401000000008111156102f357600080fd5b82018360208201111561030557600080fd5b8035906020019184602083028401116401000000008311171561032757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050503515159050610733565b6101ae6004803603604081101561037d57600080fd5b506001600160a01b03813516906020013561077a565b6101ca600480360360408110156103a957600080fd5b506001600160a01b0381358116916020013516610790565b61025e600480360360208110156103d757600080fd5b50356001600160a01b03166107ad565b6101ae600480360360208110156103fd57600080fd5b50356001600160a01b03166107ca565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104935780601f1061046857610100808354040283529160200191610493565b820191906000526020600020905b81548152906001019060200180831161047657829003601f168201915b505050505081565b3360009081526007602052604081205460ff16156104b857600080fd5b8115806104e657503360009081526006602090815260408083206001600160a01b0387168452909152902054155b6104ef57600080fd5b3360008181526006602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60045481565b6001600160a01b038316600090815260066020908152604080832033845290915281205482111561058c57600080fd5b6105978484846107df565b5060019392505050565b600c5460ff1681565b6105b26106c7565b6105bb57600080fd5b6001600160a01b03821660009081526007602052604090205460ff16151581151514156105e757600080fd5b6001600160a01b038216600081815260076020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104935780601f1061046857610100808354040283529160200191610493565b60056020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b600a805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104935780601f1061046857610100808354040283529160200191610493565b61073b6106c7565b61074457600080fd5b60005b82518110156107755761076d83828151811061075f57fe5b6020026020010151836105aa565b600101610747565b505050565b60006107873384846107df565b50600192915050565b600660209081526000928352604080842090915290825290205481565b6107b56106c7565b6107be57600080fd5b6107c78161095d565b50565b60076020526000908152604090205460ff1681565b60085460408051630f8653b360e21b81526001600160a01b03808716600483015280861660248301529151869386931691633e194ecc9160448083019260209291908290030181600087803b15801561083757600080fd5b505af115801561084b573d6000803e3d6000fd5b505050506040513d602081101561086157600080fd5b505161086c57600080fd5b6001600160a01b03851660009081526005602052604090205483111561089157600080fd5b6001600160a01b038416600090815260056020526040902054838101116108b757600080fd5b6001600160a01b0380851660008181526005602090815260408083208054958b1680855282852080548b81039091559486905281548a01909155815189815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a36001600160a01b0380861660009081526005602052604080822054928916825290205401811461095557fe5b505050505050565b6001600160a01b03811661097057600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fea265627a7a72315820d8c796a16c7c7a0a56be45404d707b927685fb72a3a95f111e32a869335e2cbe64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 2,929 |
0xbff99ec817504978ad79d5d711234d12eb5f44bb
|
//SPDX-License-Identifier: UNLICENSED
/**
🪐GoldenElon Token is clear and transparent and with a good community grow token on ERC20. WE are STRONGLY believing in the project of "The Mars" created by our hero Elon Musk.We appreciated with humanities efforts of go ing to the red planet into the light.
🛸We truly believe in Elon that one day Mars is our new home.
Token symbol :GOLDENELON
Total supply: 1,000,000,000
Network: Ethereum Mainnet
Specification:ERC20
☄️Buy Tax:6%
☄️Sell Tax:10%
Max buy 1.5%
www.goldenelon.com
T.me/goldenelon
**/
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract GOLDENELON is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1000000000 * 10**9;
string public constant name = unicode"GOLDENELON";
string public constant symbol = unicode"GOLDENELON";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 6;
uint public _sellFee = 9;
uint private _feeRate = 9;
uint public _maxBuyTokens;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (3 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function createPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 10000000 * 10**9;
_maxHeldTokens = 20000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101e75760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf914610563578063db92dbb614610578578063dcb0e0ad1461058d578063dd62ed3e146105ad57600080fd5b8063a9059cbb146104ee578063b2289c621461050e578063b515566a1461052e578063c3c8cd801461054e57600080fd5b80638da5cb5b116100d15780638da5cb5b1461049b57806394b8d8f2146104b957806395d89b41146101f35780639e78fb4f146104d957600080fd5b80636fc3eaec1461043157806370a0823114610446578063715018a61461046657806373f54a111461047b57600080fd5b806331c2d8471161017a57806345596e2e1161014957806345596e2e146103ad57806349bd5a5e146103cd578063590f897e146104055780636755a4d01461041b57600080fd5b806331c2d8471461032857806332d873d8146103485780633bbac5791461035e57806340b9a54b1461039757600080fd5b80631940d020116101b65780631940d020146102b657806323b872dd146102cc57806327f3a72a146102ec578063313ce5671461030157600080fd5b806306fdde03146101f3578063095ea7b31461023f5780630b78f9c01461026f57806318160ddd1461029157600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b506102296040518060400160405280600a81526020016923a7a62222a722a627a760b11b81525081565b60405161023691906116fa565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611774565b6105f3565b6040519015158152602001610236565b34801561027b57600080fd5b5061028f61028a3660046117a0565b610609565b005b34801561029d57600080fd5b50670de0b6b3a76400005b604051908152602001610236565b3480156102c257600080fd5b506102a8600d5481565b3480156102d857600080fd5b5061025f6102e73660046117c2565b610683565b3480156102f857600080fd5b506102a86106d7565b34801561030d57600080fd5b50610316600981565b60405160ff9091168152602001610236565b34801561033457600080fd5b5061028f610343366004611819565b6106e7565b34801561035457600080fd5b506102a8600e5481565b34801561036a57600080fd5b5061025f6103793660046118de565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a357600080fd5b506102a860095481565b3480156103b957600080fd5b5061028f6103c83660046118fb565b61077d565b3480156103d957600080fd5b506008546103ed906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b34801561041157600080fd5b506102a8600a5481565b34801561042757600080fd5b506102a8600c5481565b34801561043d57600080fd5b5061028f610810565b34801561045257600080fd5b506102a86104613660046118de565b61081d565b34801561047257600080fd5b5061028f610838565b34801561048757600080fd5b5061028f6104963660046118de565b6108ac565b3480156104a757600080fd5b506000546001600160a01b03166103ed565b3480156104c557600080fd5b50600f5461025f9062010000900460ff1681565b3480156104e557600080fd5b5061028f61091a565b3480156104fa57600080fd5b5061025f610509366004611774565b610b1f565b34801561051a57600080fd5b506007546103ed906001600160a01b031681565b34801561053a57600080fd5b5061028f610549366004611819565b610b2c565b34801561055a57600080fd5b5061028f610c45565b34801561056f57600080fd5b5061028f610c5b565b34801561058457600080fd5b506102a8610e57565b34801561059957600080fd5b5061028f6105a8366004611922565b610e6f565b3480156105b957600080fd5b506102a86105c836600461193f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610600338484610eec565b50600192915050565b6000546001600160a01b0316331461063c5760405162461bcd60e51b815260040161063390611978565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000610690848484611010565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106bf9084906119c3565b90506106cc853383610eec565b506001949350505050565b60006106e23061081d565b905090565b6000546001600160a01b031633146107115760405162461bcd60e51b815260040161063390611978565b60005b815181101561077957600060056000848481518110610735576107356119da565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610771816119f0565b915050610714565b5050565b6000546001600160a01b031633146107a75760405162461bcd60e51b815260040161063390611978565b6007546001600160a01b0316336001600160a01b0316146107c757600080fd5b600081116107d457600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761081a816113c7565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108625760405162461bcd60e51b815260040161063390611978565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b0316146108cc57600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610805565b6000546001600160a01b031633146109445760405162461bcd60e51b815260040161063390611978565b600f5460ff16156109915760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610633565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156109f6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1a9190611a09565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b9190611a09565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ad8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afc9190611a09565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b6000610600338484611010565b6000546001600160a01b03163314610b565760405162461bcd60e51b815260040161063390611978565b60005b81518110156107795760085482516001600160a01b0390911690839083908110610b8557610b856119da565b60200260200101516001600160a01b031614158015610bd6575060065482516001600160a01b0390911690839083908110610bc257610bc26119da565b60200260200101516001600160a01b031614155b15610c3357600160056000848481518110610bf357610bf36119da565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c3d816119f0565b915050610b59565b6000610c503061081d565b905061081a81611401565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260040161063390611978565b600f5460ff1615610cd25760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610633565b600654610cf29030906001600160a01b0316670de0b6b3a7640000610eec565b6006546001600160a01b031663f305d7194730610d0e8161081d565b600080610d236000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610d8b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610db09190611a26565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2d9190611a54565b50600f805460ff1916600117905542600e55662386f26fc10000600c5566470de4df820000600d55565b6008546000906106e2906001600160a01b031661081d565b6000546001600160a01b03163314610e995760405162461bcd60e51b815260040161063390611978565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610805565b6001600160a01b038316610f4e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610633565b6001600160a01b038216610faf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610633565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561103657600080fd5b6001600160a01b03831661109a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610633565b6001600160a01b0382166110fc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610633565b6000811161115e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610633565b600080546001600160a01b0385811691161480159061118b57506000546001600160a01b03848116911614155b15611368576008546001600160a01b0385811691161480156111bb57506006546001600160a01b03848116911614155b80156111e057506001600160a01b03831660009081526004602052604090205460ff16155b1561128157600f5460ff166112375760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610633565b42600e5460b46112479190611a71565b111561127d57600c5482111561125c57600080fd5b600d546112688461081d565b6112729084611a71565b111561127d57600080fd5b5060015b600f54610100900460ff1615801561129b5750600f5460ff165b80156112b557506008546001600160a01b03858116911614155b156113685760006112c53061081d565b9050801561135157600f5462010000900460ff161561134857600b54600854606491906112fa906001600160a01b031661081d565b6113049190611a89565b61130e9190611aa8565b81111561134857600b5460085460649190611331906001600160a01b031661081d565b61133b9190611a89565b6113459190611aa8565b90505b61135181611401565b47801561136157611361476113c7565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806113aa57506001600160a01b03841660009081526004602052604090205460ff165b156113b3575060005b6113c08585858486611575565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610779573d6000803e3d6000fd5b600f805461ff0019166101001790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611445576114456119da565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561149e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c29190611a09565b816001815181106114d5576114d56119da565b6001600160a01b0392831660209182029290920101526006546114fb9130911684610eec565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611534908590600090869030904290600401611aca565b600060405180830381600087803b15801561154e57600080fd5b505af1158015611562573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b60006115818383611597565b905061158f868686846115bb565b505050505050565b60008083156115b45782156115af57506009546115b4565b50600a545b9392505050565b6000806115c88484611698565b6001600160a01b03881660009081526002602052604090205491935091506115f19085906119c3565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611621908390611a71565b6001600160a01b038616600090815260026020526040902055611643816116cc565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168891815260200190565b60405180910390a3505050505050565b6000808060646116a88587611a89565b6116b29190611aa8565b905060006116c082876119c3565b96919550909350505050565b306000908152600260205260409020546116e7908290611a71565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117275785810183015185820160400152820161170b565b81811115611739576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461081a57600080fd5b803561176f8161174f565b919050565b6000806040838503121561178757600080fd5b82356117928161174f565b946020939093013593505050565b600080604083850312156117b357600080fd5b50508035926020909101359150565b6000806000606084860312156117d757600080fd5b83356117e28161174f565b925060208401356117f28161174f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561182c57600080fd5b823567ffffffffffffffff8082111561184457600080fd5b818501915085601f83011261185857600080fd5b81358181111561186a5761186a611803565b8060051b604051601f19603f8301168101818110858211171561188f5761188f611803565b6040529182528482019250838101850191888311156118ad57600080fd5b938501935b828510156118d2576118c385611764565b845293850193928501926118b2565b98975050505050505050565b6000602082840312156118f057600080fd5b81356115b48161174f565b60006020828403121561190d57600080fd5b5035919050565b801515811461081a57600080fd5b60006020828403121561193457600080fd5b81356115b481611914565b6000806040838503121561195257600080fd5b823561195d8161174f565b9150602083013561196d8161174f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156119d5576119d56119ad565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611a0257611a026119ad565b5060010190565b600060208284031215611a1b57600080fd5b81516115b48161174f565b600080600060608486031215611a3b57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a6657600080fd5b81516115b481611914565b60008219821115611a8457611a846119ad565b500190565b6000816000190483118215151615611aa357611aa36119ad565b500290565b600082611ac557634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b1a5784516001600160a01b031683529383019391830191600101611af5565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220c3e39c4b9331c4beaa4bfe60f24d1bd6ff532aa80fec3520744fc74f7b7e013b64736f6c634300080d0033
|
{"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"}]}}
| 2,930 |
0xe8272288c2637b85a10f67031d1a970eb27e82fa
|
pragma solidity ^0.4.19;
/*
* Creator: CHS (Chastitycoin)
*/
/*
* 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;
}
/**
* Chastitycoin smart contract.
*/
contract CHSToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 75000000 * (10**18);
/**
* 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 CHSToken () {
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 = "Chastitycoin";
string constant public symbol = "CHS";
uint8 constant public decimals = 18;
/**
* 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);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a75565b005b34156103f057600080fd5b6103f8610c7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cb6565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d42565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610dc9565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600c81526020017f4368617374697479636f696e000000000000000000000000000000000000000081525081565b60008061067f3385610d42565b148061068b5750600082145b151561069657600080fd5b6106a08383610f2a565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d684848461101c565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a6b576109666a3e09de2596099e2b000000600454611402565b8211156109765760009050610a70565b6109be6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361141b565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0c6004548361141b565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a70565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0e57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bbc57600080fd5b6102c65a03f11515610bcd57600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f434853000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d1157600080fd5b600560009054906101000a900460ff1615610d2f5760009050610d3c565b610d398383611439565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e6057600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561105957600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110e657600090506113fb565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561113557600090506113fb565b60008211801561117157508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611391576111fc600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611402565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112c46000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611402565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134e6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361141b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561141057fe5b818303905092915050565b600080828401905083811015151561142f57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561147657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114c55760009050611685565b60008211801561150157508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561161b5761154e6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611402565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115d86000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361141b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a7230582047d5cf376b6471adbcf6bafff4ab7cbf4a085b4a78d1ac61dfe96b79ea8f46060029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,931 |
0x8db030de5d0ca60f0f93252092e084dc85a3bf63
|
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/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/interface/IBasicMultiToken.sol
contract IBasicMultiToken is ERC20 {
event Bundle(address indexed who, address indexed beneficiary, uint256 value);
event Unbundle(address indexed who, address indexed beneficiary, uint256 value);
ERC20[] public tokens;
function tokensCount() public view returns(uint256);
function bundleFirstTokens(address _beneficiary, uint256 _amount, uint256[] _tokenAmounts) public;
function bundle(address _beneficiary, uint256 _amount) public;
function unbundle(address _beneficiary, uint256 _value) public;
function unbundleSome(address _beneficiary, uint256 _value, ERC20[] _tokens) public;
function disableBundling() public;
function enableBundling() public;
}
// File: contracts/interface/IMultiToken.sol
contract IMultiToken is IBasicMultiToken {
event Update();
event Change(address indexed _fromToken, address indexed _toToken, address indexed _changer, uint256 _amount, uint256 _return);
mapping(address => uint256) public weights;
function getReturn(address _fromToken, address _toToken, uint256 _amount) public view returns (uint256 returnAmount);
function change(address _fromToken, address _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256 returnAmount);
function disableChanges() public;
}
// File: contracts/ext/CheckedERC20.sol
library CheckedERC20 {
using SafeMath for uint;
function isContract(address addr) internal view returns(bool result) {
// solium-disable-next-line security/no-inline-assembly
assembly {
result := gt(extcodesize(addr), 0)
}
}
function handleReturnBool() internal pure returns(bool result) {
// solium-disable-next-line security/no-inline-assembly
assembly {
switch returndatasize()
case 0 { // not a std erc20
result := 1
}
case 32 { // std erc20
returndatacopy(0, 0, 32)
result := mload(0)
}
default { // anything else, should revert for safety
revert(0, 0)
}
}
}
function handleReturnBytes32() internal pure returns(bytes32 result) {
// solium-disable-next-line security/no-inline-assembly
assembly {
if eq(returndatasize(), 32) { // not a std erc20
returndatacopy(0, 0, 32)
result := mload(0)
}
if gt(returndatasize(), 32) { // std erc20
returndatacopy(0, 64, 32)
result := mload(0)
}
if lt(returndatasize(), 32) { // anything else, should revert for safety
revert(0, 0)
}
}
}
function asmTransfer(address _token, address _to, uint256 _value) internal returns(bool) {
require(isContract(_token));
// solium-disable-next-line security/no-low-level-calls
require(_token.call(bytes4(keccak256("transfer(address,uint256)")), _to, _value));
return handleReturnBool();
}
function asmTransferFrom(address _token, address _from, address _to, uint256 _value) internal returns(bool) {
require(isContract(_token));
// solium-disable-next-line security/no-low-level-calls
require(_token.call(bytes4(keccak256("transferFrom(address,address,uint256)")), _from, _to, _value));
return handleReturnBool();
}
function asmApprove(address _token, address _spender, uint256 _value) internal returns(bool) {
require(isContract(_token));
// solium-disable-next-line security/no-low-level-calls
require(_token.call(bytes4(keccak256("approve(address,uint256)")), _spender, _value));
return handleReturnBool();
}
//
function checkedTransfer(ERC20 _token, address _to, uint256 _value) internal {
if (_value > 0) {
uint256 balance = _token.balanceOf(this);
asmTransfer(_token, _to, _value);
require(_token.balanceOf(this) == balance.sub(_value), "checkedTransfer: Final balance didn't match");
}
}
function checkedTransferFrom(ERC20 _token, address _from, address _to, uint256 _value) internal {
if (_value > 0) {
uint256 toBalance = _token.balanceOf(_to);
asmTransferFrom(_token, _from, _to, _value);
require(_token.balanceOf(_to) == toBalance.add(_value), "checkedTransfer: Final balance didn't match");
}
}
//
function asmName(address _token) internal view returns(bytes32) {
require(isContract(_token));
// solium-disable-next-line security/no-low-level-calls
require(_token.call(bytes4(keccak256("name()"))));
return handleReturnBytes32();
}
function asmSymbol(address _token) internal view returns(bytes32) {
require(isContract(_token));
// solium-disable-next-line security/no-low-level-calls
require(_token.call(bytes4(keccak256("symbol()"))));
return handleReturnBytes32();
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(
ERC20Basic _token,
address _to,
uint256 _value
)
internal
{
require(_token.transfer(_to, _value));
}
function safeTransferFrom(
ERC20 _token,
address _from,
address _to,
uint256 _value
)
internal
{
require(_token.transferFrom(_from, _to, _value));
}
function safeApprove(
ERC20 _token,
address _spender,
uint256 _value
)
internal
{
require(_token.approve(_spender, _value));
}
}
// File: openzeppelin-solidity/contracts/ownership/CanReclaimToken.sol
/**
* @title Contracts that should be able to recover tokens
* @author SylTi
* @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
* This will prevent any accidental loss of tokens.
*/
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param _token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic _token) external onlyOwner {
uint256 balance = _token.balanceOf(this);
_token.safeTransfer(owner, balance);
}
}
// File: contracts/registry/MultiChanger.sol
contract IEtherToken is ERC20 {
function deposit() public payable;
function withdraw(uint256 _amount) public;
}
contract IBancorNetwork {
function convert(
address[] _path,
uint256 _amount,
uint256 _minReturn
)
public
payable
returns(uint256);
function claimAndConvert(
address[] _path,
uint256 _amount,
uint256 _minReturn
)
public
payable
returns(uint256);
}
contract IKyberNetworkProxy {
function trade(
address src,
uint srcAmount,
address dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId
)
public
payable
returns(uint);
}
contract MultiChanger is CanReclaimToken {
using SafeMath for uint256;
using CheckedERC20 for ERC20;
// Source: https://github.com/gnosis/MultiSigWallet/blob/master/contracts/MultiSigWallet.sol
// 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 externalCall(address destination, uint value, bytes data, uint dataOffset, uint dataLength) internal returns (bool result) {
// solium-disable-next-line security/no-inline-assembly
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,
add(d, dataOffset),
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
)
}
}
function change(
bytes _callDatas,
uint[] _starts // including 0 and LENGTH values
)
internal
{
for (uint i = 0; i < _starts.length - 1; i++) {
require(externalCall(this, 0, _callDatas, _starts[i], _starts[i + 1] - _starts[i]));
}
}
function sendEthValue(address _target, bytes _data, uint256 _value) external {
// solium-disable-next-line security/no-call-value
require(_target.call.value(_value)(_data));
}
function sendEthProportion(address _target, bytes _data, uint256 _mul, uint256 _div) external {
uint256 value = address(this).balance.mul(_mul).div(_div);
// solium-disable-next-line security/no-call-value
require(_target.call.value(value)(_data));
}
function approveTokenAmount(address _target, bytes _data, ERC20 _fromToken, uint256 _amount) external {
if (_fromToken.allowance(this, _target) != 0) {
_fromToken.asmApprove(_target, 0);
}
_fromToken.asmApprove(_target, _amount);
// solium-disable-next-line security/no-low-level-calls
require(_target.call(_data));
}
function approveTokenProportion(address _target, bytes _data, ERC20 _fromToken, uint256 _mul, uint256 _div) external {
uint256 amount = _fromToken.balanceOf(this).mul(_mul).div(_div);
if (_fromToken.allowance(this, _target) != 0) {
_fromToken.asmApprove(_target, 0);
}
_fromToken.asmApprove(_target, amount);
// solium-disable-next-line security/no-low-level-calls
require(_target.call(_data));
}
function transferTokenAmount(address _target, bytes _data, ERC20 _fromToken, uint256 _amount) external {
_fromToken.asmTransfer(_target, _amount);
// solium-disable-next-line security/no-low-level-calls
require(_target.call(_data));
}
function transferTokenProportion(address _target, bytes _data, ERC20 _fromToken, uint256 _mul, uint256 _div) external {
uint256 amount = _fromToken.balanceOf(this).mul(_mul).div(_div);
_fromToken.asmTransfer(_target, amount);
// solium-disable-next-line security/no-low-level-calls
require(_target.call(_data));
}
// Ether token
function withdrawEtherTokenAmount(IEtherToken _etherToken, uint256 _amount) external {
_etherToken.withdraw(_amount);
}
function withdrawEtherTokenProportion(IEtherToken _etherToken, uint256 _mul, uint256 _div) external {
uint256 amount = _etherToken.balanceOf(this).mul(_mul).div(_div);
_etherToken.withdraw(amount);
}
// Bancor Network
function bancorSendEthValue(IBancorNetwork _bancor, address[] _path, uint256 _value) external {
_bancor.convert.value(_value)(_path, _value, 1);
}
function bancorSendEthProportion(IBancorNetwork _bancor, address[] _path, uint256 _mul, uint256 _div) external {
uint256 value = address(this).balance.mul(_mul).div(_div);
_bancor.convert.value(value)(_path, value, 1);
}
function bancorApproveTokenAmount(IBancorNetwork _bancor, address[] _path, uint256 _amount) external {
if (ERC20(_path[0]).allowance(this, _bancor) == 0) {
ERC20(_path[0]).asmApprove(_bancor, uint256(-1));
}
_bancor.claimAndConvert(_path, _amount, 1);
}
function bancorApproveTokenProportion(IBancorNetwork _bancor, address[] _path, uint256 _mul, uint256 _div) external {
uint256 amount = ERC20(_path[0]).balanceOf(this).mul(_mul).div(_div);
if (ERC20(_path[0]).allowance(this, _bancor) == 0) {
ERC20(_path[0]).asmApprove(_bancor, uint256(-1));
}
_bancor.claimAndConvert(_path, amount, 1);
}
function bancorTransferTokenAmount(IBancorNetwork _bancor, address[] _path, uint256 _amount) external {
ERC20(_path[0]).asmTransfer(_bancor, _amount);
_bancor.convert(_path, _amount, 1);
}
function bancorTransferTokenProportion(IBancorNetwork _bancor, address[] _path, uint256 _mul, uint256 _div) external {
uint256 amount = ERC20(_path[0]).balanceOf(this).mul(_mul).div(_div);
ERC20(_path[0]).asmTransfer(_bancor, amount);
_bancor.convert(_path, amount, 1);
}
function bancorAlreadyTransferedTokenAmount(IBancorNetwork _bancor, address[] _path, uint256 _amount) external {
_bancor.convert(_path, _amount, 1);
}
function bancorAlreadyTransferedTokenProportion(IBancorNetwork _bancor, address[] _path, uint256 _mul, uint256 _div) external {
uint256 amount = ERC20(_path[0]).balanceOf(_bancor).mul(_mul).div(_div);
_bancor.convert(_path, amount, 1);
}
// Kyber Network
function kyberSendEthProportion(IKyberNetworkProxy _kyber, ERC20 _fromToken, address _toToken, uint256 _mul, uint256 _div) external {
uint256 value = address(this).balance.mul(_mul).div(_div);
_kyber.trade.value(value)(
_fromToken,
value,
_toToken,
this,
1 << 255,
0,
0
);
}
function kyberApproveTokenAmount(IKyberNetworkProxy _kyber, ERC20 _fromToken, address _toToken, uint256 _amount) external {
if (_fromToken.allowance(this, _kyber) == 0) {
_fromToken.asmApprove(_kyber, uint256(-1));
}
_kyber.trade(
_fromToken,
_amount,
_toToken,
this,
1 << 255,
0,
0
);
}
function kyberApproveTokenProportion(IKyberNetworkProxy _kyber, ERC20 _fromToken, address _toToken, uint256 _mul, uint256 _div) external {
uint256 amount = _fromToken.balanceOf(this).mul(_mul).div(_div);
this.kyberApproveTokenAmount(_kyber, _fromToken, _toToken, amount);
}
}
// File: contracts/registry/MultiSeller.sol
contract MultiSeller is MultiChanger {
using CheckedERC20 for IMultiToken;
function() public payable {
// solium-disable-next-line security/no-tx-origin
require(tx.origin != msg.sender);
}
function sellForOrigin(
IMultiToken _mtkn,
uint256 _amount,
bytes _callDatas,
uint[] _starts // including 0 and LENGTH values
)
public
{
sell(
_mtkn,
_amount,
_callDatas,
_starts,
tx.origin // solium-disable-line security/no-tx-origin
);
}
function sell(
IMultiToken _mtkn,
uint256 _amount,
bytes _callDatas,
uint[] _starts, // including 0 and LENGTH values
address _for
)
public
{
_mtkn.asmTransferFrom(msg.sender, this, _amount);
_mtkn.unbundle(this, _amount);
change(_callDatas, _starts);
_for.transfer(address(this).balance);
}
}
|
0x60806040526004361061012f5763ffffffff60e060020a60003504166317ffc320811461013e5780631f91695d1461015f5780632545f8eb1461018f5780632db1651b146101c25780633669f27b1461026f57806338085649146102a557806340f0b0f1146102d85780635499716a14610308578063618e8ad31461032f578063715018a6146103625780637f7b2eb814610377578063846f11851461041957806386b0e00a1461044c5780638721fbe91461047c5780638da5cb5b146104af5780639a509aff146104e05780639d99ce0414610516578063bd3e904f14610549578063bed31bc71461056d578063d04c6c18146105a0578063d2e9236b146105d9578063d91bd1b014610609578063dc3193f914610642578063f2fde38b14610672578063f8b2cb0714610693575b3233141561013c57600080fd5b005b34801561014a57600080fd5b5061013c600160a060020a03600435166106c3565b34801561016b57600080fd5b5061013c60048035600160a060020a0316906024803590810191013560443561078f565b34801561019b57600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435606435610838565b3480156101ce57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261013c948235600160a060020a0316946024803595369594606494920191908190840183828082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975050509235600160a060020a0316935061090992505050565b34801561027b57600080fd5b5061013c600160a060020a03600480358216916024803590810192013590604435166064356109e4565b3480156102b157600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435606435610ae4565b3480156102e457600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435610d14565b34801561031457600080fd5b5061013c600160a060020a0360043516602435604435610dc6565b34801561033b57600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435606435610e8a565b34801561036e57600080fd5b5061013c610f2c565b34801561038357600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261013c948235600160a060020a0316946024803595369594606494920191908190840183828082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610f989650505050505050565b34801561042557600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435606435610fab565b34801561045857600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435611000565b34801561048857600080fd5b5061013c600160a060020a03600435811690602435811690604435166064356084356110a2565b3480156104bb57600080fd5b506104c461116a565b60408051600160a060020a039092168252519081900360200190f35b3480156104ec57600080fd5b5061013c600160a060020a0360048035821691602480359081019201359060443516606435611179565b34801561052257600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435606435611193565b34801561055557600080fd5b5061013c600160a060020a036004351660243561128c565b34801561057957600080fd5b5061013c600160a060020a03600435811690602435811690604435166064356084356112e9565b3480156105ac57600080fd5b5061013c600160a060020a03600480358216916024803590810192013590604435166064356084356113e9565b3480156105e557600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435611553565b34801561061557600080fd5b5061013c600160a060020a036004803582169160248035908101920135906044351660643560843561158f565b34801561064e57600080fd5b5061013c600160a060020a0360043581169060243581169060443516606435611610565b34801561067e57600080fd5b5061013c600160a060020a0360043516611766565b34801561069f57600080fd5b5061013c60048035600160a060020a03169060248035908101910135604435611789565b60008054600160a060020a031633146106db57600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561073c57600080fd5b505af1158015610750573d6000803e3d6000fd5b505050506040513d602081101561076657600080fd5b505160005490915061078b90600160a060020a0384811691168363ffffffff6118b016565b5050565b83600160a060020a031663f3898a9784848460016040518563ffffffff1660e060020a02815260040180806020018481526020018381526020018281038252868682818152602001925060200280828437820191505095505050505050602060405180830381600087803b15801561080657600080fd5b505af115801561081a573d6000803e3d6000fd5b505050506040513d602081101561083057600080fd5b505050505050565b600061085b8261084f30318663ffffffff61194f16565b9063ffffffff61197e16565b905085600160a060020a031663f3898a978287878560016040518663ffffffff1660e060020a028152600401808060200184815260200183815260200182810382528686828181526020019250602002808284378201915050955050505050506020604051808303818588803b1580156108d457600080fd5b505af11580156108e8573d6000803e3d6000fd5b50505050506040513d60208110156108ff57600080fd5b5050505050505050565b610924600160a060020a03861633308763ffffffff61199316565b50604080517fb4dc3dc7000000000000000000000000000000000000000000000000000000008152306004820152602481018690529051600160a060020a0387169163b4dc3dc791604480830192600092919082900301818387803b15801561098c57600080fd5b505af11580156109a0573d6000803e3d6000fd5b505050506109ae8383611a73565b604051600160a060020a03821690303180156108fc02916000818181858888f19350505050158015610830573d6000803e3d6000fd5b6040805160e160020a636eb1769f028152306004820152600160a060020a03878116602483015291519184169163dd62ed3e916044808201926020929091908290030181600087803b158015610a3957600080fd5b505af1158015610a4d573d6000803e3d6000fd5b505050506040513d6020811015610a6357600080fd5b505115610a8757610a85600160a060020a03831686600063ffffffff611aed16565b505b610aa1600160a060020a038316868363ffffffff611aed16565b5084600160a060020a03168484604051808383808284378201915050925050506000604051808303816000865af19150501515610add57600080fd5b5050505050565b6000610b998261084f85888886818110610afa57fe5b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160209283029490940135600160a060020a0316936370a082319350602480830193928290030181600087803b158015610b6157600080fd5b505af1158015610b75573d6000803e3d6000fd5b505050506040513d6020811015610b8b57600080fd5b50519063ffffffff61194f16565b905084846000818110610ba857fe5b6040805160e160020a636eb1769f028152306004820152600160a060020a038b811660248301529151602093840295909501359091169363dd62ed3e9350604480830193928290030181600087803b158015610c0357600080fd5b505af1158015610c17573d6000803e3d6000fd5b505050506040513d6020811015610c2d57600080fd5b50511515610c7357610c718660001987876000818110610c4957fe5b90506020020135600160a060020a0316600160a060020a0316611aed9092919063ffffffff16565b505b85600160a060020a031663c7ba24bc86868460016040518563ffffffff1660e060020a02815260040180806020018481526020018381526020018281038252868682818152602001925060200280828437820191505095505050505050602060405180830381600087803b158015610cea57600080fd5b505af1158015610cfe573d6000803e3d6000fd5b505050506040513d60208110156108ff57600080fd5b610d4e848285856000818110610d2657fe5b90506020020135600160a060020a0316600160a060020a0316611bb19092919063ffffffff16565b5083600160a060020a031663f3898a9784848460016040518563ffffffff1660e060020a02815260040180806020018481526020018381526020018281038252868682818152602001925060200280828437820191505095505050505050602060405180830381600087803b15801561080657600080fd5b6000610e2b8261084f8587600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610b6157600080fd5b905083600160a060020a0316632e1a7d4d826040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b158015610e7657600080fd5b505af11580156108ff573d6000803e3d6000fd5b6000610ea08261084f85888886818110610afa57fe5b9050610eb4868287876000818110610d2657fe5b5085600160a060020a031663f3898a9786868460016040518563ffffffff1660e060020a02815260040180806020018481526020018381526020018281038252868682818152602001925060200280828437820191505095505050505050602060405180830381600087803b158015610cea57600080fd5b600054600160a060020a03163314610f4357600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b610fa58484848432610909565b50505050565b6000610fc28261084f30318663ffffffff61194f16565b905085600160a060020a03168186866040518083838082843782019150509250505060006040518083038185875af192505050151561083057600080fd5b83600160a060020a031663f3898a978285858560016040518663ffffffff1660e060020a028152600401808060200184815260200183815260200182810382528686828181526020019250602002808284378201915050955050505050506020604051808303818588803b15801561107757600080fd5b505af115801561108b573d6000803e3d6000fd5b50505050506040513d602081101561083057600080fd5b60006110b98261084f30318663ffffffff61194f16565b604080517fcb3c28c7000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301526024820184905287811660448301523060648301527f80000000000000000000000000000000000000000000000000000000000000006084830152600060a4830181905260c483015291519293509088169163cb3c28c791849160e480830192602092919082900301818588803b1580156108d457600080fd5b600054600160a060020a031681565b610aa1600160a060020a038316868363ffffffff611bb116565b60006112138261084f858888868181106111a957fe5b90506020020135600160a060020a0316600160a060020a03166370a082318b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610b6157600080fd5b905085600160a060020a031663f3898a9786868460016040518563ffffffff1660e060020a02815260040180806020018481526020018381526020018281038252868682818152602001925060200280828437820191505095505050505050602060405180830381600087803b158015610cea57600080fd5b81600160a060020a0316632e1a7d4d826040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156112d557600080fd5b505af1158015610830573d6000803e3d6000fd5b600061134e8261084f8588600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610b6157600080fd5b604080517fdc3193f9000000000000000000000000000000000000000000000000000000008152600160a060020a038981166004830152888116602483015287166044820152606481018390529051919250309163dc3193f99160848082019260009290919082900301818387803b1580156113c957600080fd5b505af11580156113dd573d6000803e3d6000fd5b50505050505050505050565b600061144e8261084f8587600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610b6157600080fd5b6040805160e160020a636eb1769f028152306004820152600160a060020a038a8116602483015291519293509086169163dd62ed3e916044808201926020929091908290030181600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b505050506040513d60208110156114d057600080fd5b5051156114f4576114f2600160a060020a03851688600063ffffffff611aed16565b505b61150e600160a060020a038516888363ffffffff611aed16565b5086600160a060020a03168686604051808383808284378201915050925050506000604051808303816000865af1915050151561154a57600080fd5b50505050505050565b83600160a060020a03168184846040518083838082843782019150509250505060006040518083038185875af1925050501515610fa557600080fd5b60006115f48261084f8587600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610b6157600080fd5b905061150e600160a060020a038516888363ffffffff611bb116565b6040805160e160020a636eb1769f028152306004820152600160a060020a03868116602483015291519185169163dd62ed3e916044808201926020929091908290030181600087803b15801561166557600080fd5b505af1158015611679573d6000803e3d6000fd5b505050506040513d602081101561168f57600080fd5b505115156116b5576116b3600160a060020a0384168560001963ffffffff611aed16565b505b604080517fcb3c28c7000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301526024820184905284811660448301523060648301527f80000000000000000000000000000000000000000000000000000000000000006084830152600060a4830181905260c4830181905292519087169263cb3c28c79260e480820193602093909283900390910190829087803b15801561080657600080fd5b600054600160a060020a0316331461177d57600080fd5b61178681611c65565b50565b8282600081811061179657fe5b6040805160e160020a636eb1769f028152306004820152600160a060020a0389811660248301529151602093840295909501359091169363dd62ed3e9350604480830193928290030181600087803b1580156117f157600080fd5b505af1158015611805573d6000803e3d6000fd5b505050506040513d602081101561181b57600080fd5b50511515611839576118378460001985856000818110610c4957fe5b505b83600160a060020a031663c7ba24bc84848460016040518563ffffffff1660e060020a02815260040180806020018481526020018381526020018281038252868682818152602001925060200280828437820191505095505050505050602060405180830381600087803b15801561080657600080fd5b82600160a060020a031663a9059cbb83836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561191357600080fd5b505af1158015611927573d6000803e3d6000fd5b505050506040513d602081101561193d57600080fd5b5051151561194a57600080fd5b505050565b600082151561196057506000611978565b5081810281838281151561197057fe5b041461197857fe5b92915050565b6000818381151561198b57fe5b049392505050565b600061199e85611ce2565b15156119a957600080fd5b604080517f7472616e7366657246726f6d28616464726573732c616464726573732c75696e81527f74323536290000000000000000000000000000000000000000000000000000006020820152815190819003602501812063ffffffff60e060020a918290049081169091028252600160a060020a0387811660048401528681166024840152604483018690529251928816929091606480820192600092909190829003018183875af1925050501515611a6257600080fd5b611a6a611cea565b95945050505050565b60005b600182510381101561194a57611ada306000858585815181101515611a9757fe5b906020019060200201518686815181101515611aaf57fe5b906020019060200201518787600101815181101515611aca57fe5b9060200190602002015103611d19565b1515611ae557600080fd5b600101611a76565b6000611af884611ce2565b1515611b0357600080fd5b83600160a060020a031660405180807f617070726f766528616464726573732c75696e743235362900000000000000008152506018019050604051809103902060e060020a900484846040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a03168152602001828152602001925050506000604051808303816000875af1925050501515611ba157600080fd5b611ba9611cea565b949350505050565b6000611bbc84611ce2565b1515611bc757600080fd5b83600160a060020a031660405180807f7472616e7366657228616464726573732c75696e7432353629000000000000008152506019019050604051809103902060e060020a900484846040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a03168152602001828152602001925050506000604051808303816000875af1925050501515611ba157600080fd5b600160a060020a0381161515611c7a57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000903b1190565b60003d8015611d005760208114611d0957600080fd5b60019150611d15565b60206000803e60005191505b5090565b600060405160208501600082858784018a8c6187965a03f1989750505050505050505600a165627a7a72305820d1b49ca3c09aabd450ec4c6bec4c1a55dcab05d7fc3bf8f1e717fa1af0b9c8ff0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,932 |
0x27a45d2c74969346504fe200cefac4ce43e53498
|
/**
*Submitted for verification at Etherscan.io on 2021-07-01
*/
/*
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, _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4f565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612972565b61045e565b6040516101789190612e34565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612923565b61048d565b6040516101e09190612e34565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612895565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613066565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ef565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612895565b610783565b6040516102b19190612ff1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d66565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4f565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612972565b61098d565b60405161035b9190612e34565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ae565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a41565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e7565b61121a565b6040516104189190612ff1565b60405180910390f35b60606040518060400160405280601281526020017f426f7373204261627920496e7520f09f91bc0000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f31565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f31565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f31565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601081526020017f426f737342616279496e7520f09f91b600000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f31565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613307565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f31565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128be565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128be565b6040518363ffffffff1660e01b8152600401610e1f929190612d81565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128be565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd3565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a6a565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612daa565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a18565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f31565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef1565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f91565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f71565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e71565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f51565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd1565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613127565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4f565b60405180910390fd5b5060008385611c8a9190613208565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e91565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128be565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300c565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ae565b905082848261209b919061317d565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f11565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4f565b60405180910390fd5b50600083856121de919061317d565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256b565b6123778483612628565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff1565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124788a600854600954612662565b925092509250600061248861215d565b9050600080600061249b8e8787876126f8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251c9190613127565b905083811015612561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255890612ed1565b60405180910390fd5b8091505092915050565b600061257561215d565b9050600061258c828461206b90919063ffffffff16565b90506125e081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263d826006546124c390919063ffffffff16565b6006819055506126588160075461250d90919063ffffffff16565b6007819055505050565b60008060008061268e6064612680888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b860646126aa888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e1826126d3858c6124c390919063ffffffff16565b6124c390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612711858961206b90919063ffffffff16565b90506000612728868961206b90919063ffffffff16565b9050600061273f878961206b90919063ffffffff16565b905060006127688261275a85876124c390919063ffffffff16565b6124c390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279461278f846130a6565b613081565b905080838252602082019050828560208602820111156127b357600080fd5b60005b858110156127e357816127c988826127ed565b8452602084019350602083019250506001810190506127b6565b5050509392505050565b6000813590506127fc816136e4565b92915050565b600081519050612811816136e4565b92915050565b600082601f83011261282857600080fd5b8135612838848260208601612781565b91505092915050565b600081359050612850816136fb565b92915050565b600081519050612865816136fb565b92915050565b60008135905061287a81613712565b92915050565b60008151905061288f81613712565b92915050565b6000602082840312156128a757600080fd5b60006128b5848285016127ed565b91505092915050565b6000602082840312156128d057600080fd5b60006128de84828501612802565b91505092915050565b600080604083850312156128fa57600080fd5b6000612908858286016127ed565b9250506020612919858286016127ed565b9150509250929050565b60008060006060848603121561293857600080fd5b6000612946868287016127ed565b9350506020612957868287016127ed565b92505060406129688682870161286b565b9150509250925092565b6000806040838503121561298557600080fd5b6000612993858286016127ed565b92505060206129a48582860161286b565b9150509250929050565b6000602082840312156129c057600080fd5b600082013567ffffffffffffffff8111156129da57600080fd5b6129e684828501612817565b91505092915050565b600060208284031215612a0157600080fd5b6000612a0f84828501612841565b91505092915050565b600060208284031215612a2a57600080fd5b6000612a3884828501612856565b91505092915050565b600060208284031215612a5357600080fd5b6000612a618482850161286b565b91505092915050565b600080600060608486031215612a7f57600080fd5b6000612a8d86828701612880565b9350506020612a9e86828701612880565b9250506040612aaf86828701612880565b9150509250925092565b6000612ac58383612ad1565b60208301905092915050565b612ada8161323c565b82525050565b612ae98161323c565b82525050565b6000612afa826130e2565b612b048185613105565b9350612b0f836130d2565b8060005b83811015612b40578151612b278882612ab9565b9750612b32836130f8565b925050600181019050612b13565b5085935050505092915050565b612b568161324e565b82525050565b612b6581613291565b82525050565b6000612b76826130ed565b612b808185613116565b9350612b908185602086016132a3565b612b99816133dd565b840191505092915050565b6000612bb1602383613116565b9150612bbc826133ee565b604082019050919050565b6000612bd4602a83613116565b9150612bdf8261343d565b604082019050919050565b6000612bf7602283613116565b9150612c028261348c565b604082019050919050565b6000612c1a601b83613116565b9150612c25826134db565b602082019050919050565b6000612c3d601d83613116565b9150612c4882613504565b602082019050919050565b6000612c60602183613116565b9150612c6b8261352d565b604082019050919050565b6000612c83602083613116565b9150612c8e8261357c565b602082019050919050565b6000612ca6602983613116565b9150612cb1826135a5565b604082019050919050565b6000612cc9602583613116565b9150612cd4826135f4565b604082019050919050565b6000612cec602483613116565b9150612cf782613643565b604082019050919050565b6000612d0f601783613116565b9150612d1a82613692565b602082019050919050565b6000612d32601183613116565b9150612d3d826136bb565b602082019050919050565b612d518161327a565b82525050565b612d6081613284565b82525050565b6000602082019050612d7b6000830184612ae0565b92915050565b6000604082019050612d966000830185612ae0565b612da36020830184612ae0565b9392505050565b6000604082019050612dbf6000830185612ae0565b612dcc6020830184612d48565b9392505050565b600060c082019050612de86000830189612ae0565b612df56020830188612d48565b612e026040830187612b5c565b612e0f6060830186612b5c565b612e1c6080830185612ae0565b612e2960a0830184612d48565b979650505050505050565b6000602082019050612e496000830184612b4d565b92915050565b60006020820190508181036000830152612e698184612b6b565b905092915050565b60006020820190508181036000830152612e8a81612ba4565b9050919050565b60006020820190508181036000830152612eaa81612bc7565b9050919050565b60006020820190508181036000830152612eca81612bea565b9050919050565b60006020820190508181036000830152612eea81612c0d565b9050919050565b60006020820190508181036000830152612f0a81612c30565b9050919050565b60006020820190508181036000830152612f2a81612c53565b9050919050565b60006020820190508181036000830152612f4a81612c76565b9050919050565b60006020820190508181036000830152612f6a81612c99565b9050919050565b60006020820190508181036000830152612f8a81612cbc565b9050919050565b60006020820190508181036000830152612faa81612cdf565b9050919050565b60006020820190508181036000830152612fca81612d02565b9050919050565b60006020820190508181036000830152612fea81612d25565b9050919050565b60006020820190506130066000830184612d48565b92915050565b600060a0820190506130216000830188612d48565b61302e6020830187612b5c565b81810360408301526130408186612aef565b905061304f6060830185612ae0565b61305c6080830184612d48565b9695505050505050565b600060208201905061307b6000830184612d57565b92915050565b600061308b61309c565b905061309782826132d6565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c1576130c06133ae565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131328261327a565b915061313d8361327a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317257613171613350565b5b828201905092915050565b60006131888261327a565b91506131938361327a565b9250826131a3576131a261337f565b5b828204905092915050565b60006131b98261327a565b91506131c48361327a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fd576131fc613350565b5b828202905092915050565b60006132138261327a565b915061321e8361327a565b92508282101561323157613230613350565b5b828203905092915050565b60006132478261325a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329c8261327a565b9050919050565b60005b838110156132c15780820151818401526020810190506132a6565b838111156132d0576000848401525b50505050565b6132df826133dd565b810181811067ffffffffffffffff821117156132fe576132fd6133ae565b5b80604052505050565b60006133128261327a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334557613344613350565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ed8161323c565b81146136f857600080fd5b50565b6137048161324e565b811461370f57600080fd5b50565b61371b8161327a565b811461372657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204d56fefad8f7528f388fa62291814d7da51081bb8085edc4a6d3df584ba10bbc64736f6c63430008040033
|
{"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"}]}}
| 2,933 |
0x64b31f941a4c3a53aeb4b6e8bc97ca00d226cd2c
|
pragma solidity ^0.4.19;
contract IGold {
function balanceOf(address _owner) constant returns (uint256);
function issueTokens(address _who, uint _tokens);
function burnTokens(address _who, uint _tokens);
}
// StdToken inheritance is commented, because no 'totalSupply' needed
contract IMNTP { /*is StdToken */
function balanceOf(address _owner) constant returns (uint256);
// Additional methods that MNTP contract provides
function lockTransfer(bool _lock);
function issueTokens(address _who, uint _tokens);
function burnTokens(address _who, uint _tokens);
}
contract SafeMath {
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
}
contract CreatorEnabled {
address public creator = 0x0;
modifier onlyCreator() { require(msg.sender == creator); _; }
function changeCreator(address _to) public onlyCreator {
creator = _to;
}
}
contract StringMover {
function stringToBytes32(string s) constant returns(bytes32){
bytes32 out;
assembly {
out := mload(add(s, 32))
}
return out;
}
function stringToBytes64(string s) constant returns(bytes32,bytes32){
bytes32 out;
bytes32 out2;
assembly {
out := mload(add(s, 32))
out2 := mload(add(s, 64))
}
return (out,out2);
}
function bytes32ToString(bytes32 x) constant returns (string) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
function bytes64ToString(bytes32 x, bytes32 y) constant returns (string) {
bytes memory bytesString = new bytes(64);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
for (j = 0; j < 32; j++) {
char = byte(bytes32(uint(y) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
}
contract Storage is SafeMath, StringMover {
function Storage() public {
controllerAddress = msg.sender;
}
address public controllerAddress = 0x0;
modifier onlyController() { require(msg.sender==controllerAddress); _; }
function setControllerAddress(address _newController) onlyController {
controllerAddress = _newController;
}
address public hotWalletAddress = 0x0;
function setHotWalletAddress(address _address) onlyController {
hotWalletAddress = _address;
}
// Fields - 1
mapping(uint => string) docs;
uint public docCount = 0;
// Fields - 2
mapping(string => mapping(uint => int)) fiatTxs;
mapping(string => uint) fiatBalancesCents;
mapping(string => uint) fiatTxCounts;
uint fiatTxTotal = 0;
// Fields - 3
mapping(string => mapping(uint => int)) goldTxs;
mapping(string => uint) goldHotBalances;
mapping(string => uint) goldTxCounts;
uint goldTxTotal = 0;
// Fields - 4
struct Request {
address sender;
string userId;
string requestHash;
bool buyRequest; // otherwise - sell
// 0 - init
// 1 - processed
// 2 - cancelled
uint8 state;
}
mapping (uint=>Request) requests;
uint public requestsCount = 0;
///////
function addDoc(string _ipfsDocLink) public onlyController returns(uint) {
docs[docCount] = _ipfsDocLink;
uint out = docCount;
docCount++;
return out;
}
function getDocCount() public constant returns (uint) {
return docCount;
}
function getDocAsBytes64(uint _index) public constant returns (bytes32,bytes32) {
require(_index < docCount);
return stringToBytes64(docs[_index]);
}
function addFiatTransaction(string _userId, int _amountCents) public onlyController returns(uint) {
require(0 != _amountCents);
uint c = fiatTxCounts[_userId];
fiatTxs[_userId][c] = _amountCents;
if (_amountCents > 0) {
fiatBalancesCents[_userId] = safeAdd(fiatBalancesCents[_userId], uint(_amountCents));
} else {
fiatBalancesCents[_userId] = safeSub(fiatBalancesCents[_userId], uint(-_amountCents));
}
fiatTxCounts[_userId] = safeAdd(fiatTxCounts[_userId], 1);
fiatTxTotal++;
return c;
}
function getFiatTransactionsCount(string _userId) public constant returns (uint) {
return fiatTxCounts[_userId];
}
function getAllFiatTransactionsCount() public constant returns (uint) {
return fiatTxTotal;
}
function getFiatTransaction(string _userId, uint _index) public constant returns(int) {
require(_index < fiatTxCounts[_userId]);
return fiatTxs[_userId][_index];
}
function getUserFiatBalance(string _userId) public constant returns(uint) {
return fiatBalancesCents[_userId];
}
function addGoldTransaction(string _userId, int _amount) public onlyController returns(uint) {
require(0 != _amount);
uint c = goldTxCounts[_userId];
goldTxs[_userId][c] = _amount;
if (_amount > 0) {
goldHotBalances[_userId] = safeAdd(goldHotBalances[_userId], uint(_amount));
} else {
goldHotBalances[_userId] = safeSub(goldHotBalances[_userId], uint(-_amount));
}
goldTxCounts[_userId] = safeAdd(goldTxCounts[_userId], 1);
goldTxTotal++;
return c;
}
function getGoldTransactionsCount(string _userId) public constant returns (uint) {
return goldTxCounts[_userId];
}
function getAllGoldTransactionsCount() public constant returns (uint) {
return goldTxTotal;
}
function getGoldTransaction(string _userId, uint _index) public constant returns(int) {
require(_index < goldTxCounts[_userId]);
return goldTxs[_userId][_index];
}
function getUserHotGoldBalance(string _userId) public constant returns(uint) {
return goldHotBalances[_userId];
}
function addBuyTokensRequest(address _who, string _userId, string _requestHash) public onlyController returns(uint) {
Request memory r;
r.sender = _who;
r.userId = _userId;
r.requestHash = _requestHash;
r.buyRequest = true;
r.state = 0;
requests[requestsCount] = r;
uint out = requestsCount;
requestsCount++;
return out;
}
function addSellTokensRequest(address _who, string _userId, string _requestHash) onlyController returns(uint) {
Request memory r;
r.sender = _who;
r.userId = _userId;
r.requestHash = _requestHash;
r.buyRequest = false;
r.state = 0;
requests[requestsCount] = r;
uint out = requestsCount;
requestsCount++;
return out;
}
function getRequestsCount() public constant returns(uint) {
return requestsCount;
}
function getRequest(uint _index) public constant returns(
address a,
bytes32 userId,
bytes32 hashA, bytes32 hashB,
bool buy, uint8 state)
{
require(_index < requestsCount);
Request memory r = requests[_index];
bytes32 userBytes = stringToBytes32(r.userId);
var (out1, out2) = stringToBytes64(r.requestHash);
return (r.sender, userBytes, out1, out2, r.buyRequest, r.state);
}
function cancelRequest(uint _index) onlyController public {
require(_index < requestsCount);
require(0==requests[_index].state);
requests[_index].state = 2;
}
function setRequestProcessed(uint _index) onlyController public {
requests[_index].state = 1;
}
}
contract GoldFiatFee is CreatorEnabled, StringMover {
string gmUserId = "";
// Functions:
function GoldFiatFee(string _gmUserId) {
creator = msg.sender;
gmUserId = _gmUserId;
}
function getGoldmintFeeAccount() public constant returns(bytes32) {
bytes32 userBytes = stringToBytes32(gmUserId);
return userBytes;
}
function setGoldmintFeeAccount(string _gmUserId) public onlyCreator {
gmUserId = _gmUserId;
}
function calculateBuyGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint) {
return 0;
}
function calculateSellGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint) {
// If the sender holds 0 MNTP, then the transaction fee is 3% fiat,
// If the sender holds at least 10 MNTP, then the transaction fee is 2% fiat,
// If the sender holds at least 1000 MNTP, then the transaction fee is 1.5% fiat,
// If the sender holds at least 10000 MNTP, then the transaction fee is 1% fiat,
if (_mntpBalance >= (10000 * 1 ether)) {
return (75 * _goldValue / 10000);
}
if (_mntpBalance >= (1000 * 1 ether)) {
return (15 * _goldValue / 1000);
}
if (_mntpBalance >= (10 * 1 ether)) {
return (25 * _goldValue / 1000);
}
// 3%
return (3 * _goldValue / 100);
}
}
contract IGoldFiatFee {
function getGoldmintFeeAccount()public constant returns(bytes32);
function calculateBuyGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint);
function calculateSellGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint);
}
contract StorageController is SafeMath, CreatorEnabled, StringMover {
Storage public stor;
IMNTP public mntpToken;
IGold public goldToken;
IGoldFiatFee public fiatFee;
event NewTokenBuyRequest(address indexed _from, string indexed _userId);
event NewTokenSellRequest(address indexed _from, string indexed _userId);
event RequestCancelled(uint indexed _reqId);
event RequestProcessed(uint indexed _reqId);
function StorageController(address _mntpContractAddress, address _goldContractAddress, address _storageAddress, address _fiatFeeContract) {
creator = msg.sender;
if (0 != _storageAddress) {
// use existing storage
stor = Storage(_storageAddress);
} else {
stor = new Storage();
}
require(0x0!=_mntpContractAddress);
require(0x0!=_goldContractAddress);
require(0x0!=_fiatFeeContract);
mntpToken = IMNTP(_mntpContractAddress);
goldToken = IGold(_goldContractAddress);
fiatFee = IGoldFiatFee(_fiatFeeContract);
}
// Only old controller can call setControllerAddress
function changeController(address _newController) public onlyCreator {
stor.setControllerAddress(_newController);
}
function setHotWalletAddress(address _hotWalletAddress) public onlyCreator {
stor.setHotWalletAddress(_hotWalletAddress);
}
function getHotWalletAddress() public constant returns (address) {
return stor.hotWalletAddress();
}
function changeFiatFeeContract(address _newFiatFee) public onlyCreator {
fiatFee = IGoldFiatFee(_newFiatFee);
}
// 1
function addDoc(string _ipfsDocLink) public onlyCreator returns(uint) {
return stor.addDoc(_ipfsDocLink);
}
function getDocCount() public constant returns (uint) {
return stor.docCount();
}
function getDoc(uint _index) public constant returns (string) {
var (x, y) = stor.getDocAsBytes64(_index);
return bytes64ToString(x,y);
}
// 2
// _amountCents can be negative
// returns index in user array
function addFiatTransaction(string _userId, int _amountCents) public onlyCreator returns(uint) {
return stor.addFiatTransaction(_userId, _amountCents);
}
function getFiatTransactionsCount(string _userId) public constant returns (uint) {
return stor.getFiatTransactionsCount(_userId);
}
function getAllFiatTransactionsCount() public constant returns (uint) {
return stor.getAllFiatTransactionsCount();
}
function getFiatTransaction(string _userId, uint _index) public constant returns(int) {
return stor.getFiatTransaction(_userId, _index);
}
function getUserFiatBalance(string _userId) public constant returns(uint) {
return stor.getUserFiatBalance(_userId);
}
// 3
function addGoldTransaction(string _userId, int _amount) public onlyCreator returns(uint) {
return stor.addGoldTransaction(_userId, _amount);
}
function getGoldTransactionsCount(string _userId) public constant returns (uint) {
return stor.getGoldTransactionsCount(_userId);
}
function getAllGoldTransactionsCount() public constant returns (uint) {
return stor.getAllGoldTransactionsCount();
}
function getGoldTransaction(string _userId, uint _index) public constant returns(int) {
return stor.getGoldTransaction(_userId, _index);
}
function getUserHotGoldBalance(string _userId) public constant returns(uint) {
return stor.getUserHotGoldBalance(_userId);
}
// 4:
function addBuyTokensRequest(string _userId, string _requestHash) public returns(uint) {
NewTokenBuyRequest(msg.sender, _userId);
return stor.addBuyTokensRequest(msg.sender, _userId, _requestHash);
}
function addSellTokensRequest(string _userId, string _requestHash) public returns(uint) {
NewTokenSellRequest(msg.sender, _userId);
return stor.addSellTokensRequest(msg.sender, _userId, _requestHash);
}
function getRequestsCount() public constant returns(uint) {
return stor.getRequestsCount();
}
function getRequest(uint _index) public constant returns(address, string, string, bool, uint8) {
var (sender, userIdBytes, hashA, hashB, buy, state) = stor.getRequest(_index);
string memory userId = bytes32ToString(userIdBytes);
string memory hash = bytes64ToString(hashA, hashB);
return (sender, userId, hash, buy, state);
}
function cancelRequest(uint _index) onlyCreator public {
RequestCancelled(_index);
stor.cancelRequest(_index);
}
function processRequest(uint _index, uint _amountCents, uint _centsPerGold) onlyCreator public {
require(_index < getRequestsCount());
var (sender, userId, hash, isBuy, state) = getRequest(_index);
require(0 == state);
if (isBuy) {
processBuyRequest(userId, sender, _amountCents, _centsPerGold);
} else {
processSellRequest(userId, sender, _amountCents, _centsPerGold);
}
// 3 - update state
stor.setRequestProcessed(_index);
// 4 - send event
RequestProcessed(_index);
}
function processBuyRequest(string _userId, address _userAddress, uint _amountCents, uint _centsPerGold) internal {
uint userFiatBalance = getUserFiatBalance(_userId);
require(userFiatBalance > 0);
if (_amountCents > userFiatBalance) {
_amountCents = userFiatBalance;
}
uint userMntpBalance = mntpToken.balanceOf(_userAddress);
uint fee = fiatFee.calculateBuyGoldFee(userMntpBalance, _amountCents);
require(_amountCents > fee);
// 1 - issue tokens minus fee
uint amountMinusFee = _amountCents;
if (fee > 0) {
amountMinusFee = safeSub(_amountCents, fee);
}
require(amountMinusFee > 0);
uint tokens = (uint(amountMinusFee) * 1 ether) / _centsPerGold;
issueGoldTokens(_userAddress, tokens);
// request from hot wallet
if (isHotWallet(_userAddress)) {
addGoldTransaction(_userId, int(tokens));
}
// 2 - add fiat tx
// negative for buy (total amount including fee!)
addFiatTransaction(_userId, - int(_amountCents));
// 3 - send fee to Goldmint
// positive for sell
if (fee > 0) {
string memory gmAccount = bytes32ToString(fiatFee.getGoldmintFeeAccount());
addFiatTransaction(gmAccount, int(fee));
}
}
function processSellRequest(string _userId, address _userAddress, uint _amountCents, uint _centsPerGold) internal {
uint tokens = (uint(_amountCents) * 1 ether) / _centsPerGold;
uint tokenBalance = goldToken.balanceOf(_userAddress);
if (isHotWallet(_userAddress)) {
tokenBalance = getUserHotGoldBalance(_userId);
}
if (tokenBalance < tokens) {
tokens = tokenBalance;
_amountCents = uint((tokens * _centsPerGold) / 1 ether);
}
burnGoldTokens(_userAddress, tokens);
// request from hot wallet
if (isHotWallet(_userAddress)) {
addGoldTransaction(_userId, - int(tokens));
}
// 2 - add fiat tx
uint userMntpBalance = mntpToken.balanceOf(_userAddress);
uint fee = fiatFee.calculateSellGoldFee(userMntpBalance, _amountCents);
require(_amountCents > fee);
uint amountMinusFee = _amountCents;
if (fee > 0) {
amountMinusFee = safeSub(_amountCents, fee);
}
require(amountMinusFee > 0);
// positive for sell
addFiatTransaction(_userId, int(amountMinusFee));
// 3 - send fee to Goldmint
if (fee > 0) {
string memory gmAccount = bytes32ToString(fiatFee.getGoldmintFeeAccount());
addFiatTransaction(gmAccount, int(fee));
}
}
//////// INTERNAL REQUESTS FROM HOT WALLET
function processInternalRequest(string _userId, bool _isBuy, uint _amountCents, uint _centsPerGold) onlyCreator public {
if (_isBuy) {
processBuyRequest(_userId, getHotWalletAddress(), _amountCents, _centsPerGold);
} else {
processSellRequest(_userId, getHotWalletAddress(), _amountCents, _centsPerGold);
}
}
function transferGoldFromHotWallet(address _to, uint _value, string _userId) onlyCreator public {
uint balance = getUserHotGoldBalance(_userId);
require(balance >= _value);
goldToken.burnTokens(getHotWalletAddress(), _value);
goldToken.issueTokens(_to, _value);
addGoldTransaction(_userId, -int(_value));
}
////////
function issueGoldTokens(address _userAddress, uint _tokenAmount) internal {
require(0!=_tokenAmount);
goldToken.issueTokens(_userAddress, _tokenAmount);
}
function burnGoldTokens(address _userAddress, uint _tokenAmount) internal {
require(0!=_tokenAmount);
goldToken.burnTokens(_userAddress, _tokenAmount);
}
function isHotWallet(address _address) internal returns(bool) {
return _address == getHotWalletAddress();
}
}
|
0x606060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306ba29871461017a5780631332143c1461024d5780631453d756146102be5780631ad9f1901461036b57806320bacfbd146103dc57806323b493fe1461044d57806327b9c257146104be5780633015394c146104e15780633410452a146105045780634b24ea471461052d5780634c4dc6e0146105825780634e3c50a0146105ab5780635dd284e31461067e57806363704e93146106a75780639201de55146106d05780639aaa5750146107705780639e92dfd8146107ea578063a08c09081461085b578063afa60487146108d5578063c58343ef14610923578063cfb51928146109cb578063d331aeb314610a44578063e3d6ce2b14610a6d578063eb36f8e814610ae7578063ebe09a9314610b6f578063f3d3d44814610be9578063f6b55a9314610c22578063fbfa4b7f14610c77578063fc1c218014610ca0575b600080fd5b341561018557600080fd5b610237600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610cd9565b6040518082815260200191505060405180910390f35b341561025857600080fd5b6102a8600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610eac565b6040518082815260200191505060405180910390f35b34156102c957600080fd5b6102f060048080356000191690602001909190803560001916906020019091905050610f21565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610330578082015181840152602081019050610315565b50505050905090810190601f16801561035d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561037657600080fd5b6103c6600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506111d1565b6040518082815260200191505060405180910390f35b34156103e757600080fd5b610437600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611246565b6040518082815260200191505060405180910390f35b341561045857600080fd5b6104a8600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506112ee565b6040518082815260200191505060405180910390f35b34156104c957600080fd5b6104df6004808035906020019091905050611363565b005b34156104ec57600080fd5b61050260048080359060200190919050506113f1565b005b341561050f57600080fd5b6105176114c4565b6040518082815260200191505060405180910390f35b341561053857600080fd5b6105406114ce565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058d57600080fd5b6105956114f3565b6040518082815260200191505060405180910390f35b34156105b657600080fd5b610668600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506114f9565b6040518082815260200191505060405180910390f35b341561068957600080fd5b6106916116cc565b6040518082815260200191505060405180910390f35b34156106b257600080fd5b6106ba6116d6565b6040518082815260200191505060405180910390f35b34156106db57600080fd5b6106f56004808035600019169060200190919050506116e0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561073557808201518184015260208101905061071a565b50505050905090810190601f1680156107625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561077b57600080fd5b6107d4600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080359060200190919050506118cd565b6040518082815260200191505060405180910390f35b34156107f557600080fd5b610845600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611d05565b6040518082815260200191505060405180910390f35b341561086657600080fd5b6108bf600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035906020019091905050611d7a565b6040518082815260200191505060405180910390f35b34156108e057600080fd5b6108f66004808035906020019091905050611e7a565b60405180836000191660001916815260200182600019166000191681526020019250505060405180910390f35b341561092e57600080fd5b6109446004808035906020019091905050611f4a565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001866000191660001916815260200185600019166000191681526020018460001916600019168152602001831515151581526020018260ff1660ff168152602001965050505050505060405180910390f35b34156109d657600080fd5b610a26600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506121ae565b60405180826000191660001916815260200191505060405180910390f35b3415610a4f57600080fd5b610a576121c1565b6040518082815260200191505060405180910390f35b3415610a7857600080fd5b610ad1600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080359060200190919050506121cb565b6040518082815260200191505060405180910390f35b3415610af257600080fd5b610b42600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050612603565b60405180836000191660001916815260200182600019166000191681526020019250505060405180910390f35b3415610b7a57600080fd5b610bd3600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035906020019091905050612624565b6040518082815260200191505060405180910390f35b3415610bf457600080fd5b610c20600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612724565b005b3415610c2d57600080fd5b610c356127c2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610c8257600080fd5b610c8a6127e8565b6040518082815260200191505060405180910390f35b3415610cab57600080fd5b610cd7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506127ee565b005b6000610ce36128d0565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4057600080fd5b85826000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505084826020018190525083826040018190525060008260600190151590811515815250506000826080019060ff16908160ff168152505081600c6000600d54815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019080519060200190610e27929190612927565b506040820151816002019080519060200190610e44929190612927565b5060608201518160030160006101000a81548160ff02191690831515021790555060808201518160030160016101000a81548160ff021916908360ff160217905550905050600d549050600d6000815480929190600101919050555080925050509392505050565b6000600a826040518082805190602001908083835b602083101515610ee65780518252602082019150602081019050602083039250610ec1565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050919050565b610f296129a7565b610f316129bb565b6000806000610f3e6129bb565b60408051805910610f4c5750595b9080825280601f01601f1916602001820160405250945060009350600092505b602083101561102a578260080260020a886001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614151561101d57818585815181101515610fe457fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b8280600101935050610f6c565b600092505b60208310156110ed578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156110e0578185858151811015156110a757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b828060010193505061102f565b836040518059106110fb5750595b9080825280601f01601f19166020018201604052509050600092505b838310156111c357848381518110151561112d57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818481518110151561118657fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508280600101935050611117565b809550505050505092915050565b60006009826040518082805190602001908083835b60208310151561120b57805182526020820191506020810190506020830392506111e6565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050919050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112a457600080fd5b8260026000600354815260200190815260200160002090805190602001906112cd9291906129cf565b50600354905060036000815480929190600101919050555080915050919050565b60006005826040518082805190602001908083835b6020831015156113285780518252602082019150602081019050602083039250611303565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113be57600080fd5b6001600c600083815260200190815260200160002060030160016101000a81548160ff021916908360ff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561144c57600080fd5b600d548110151561145c57600080fd5b600c600082815260200190815260200160002060030160019054906101000a900460ff1660ff16600014151561149157600080fd5b6002600c600083815260200190815260200160002060030160016101000a81548160ff021916908360ff16021790555050565b6000600d54905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60006115036128d0565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561156057600080fd5b85826000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505084826020018190525083826040018190525060018260600190151590811515815250506000826080019060ff16908160ff168152505081600c6000600d54815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019080519060200190611647929190612927565b506040820151816002019080519060200190611664929190612927565b5060608201518160030160006101000a81548160ff02191690831515021790555060808201518160030160016101000a81548160ff021916908360ff160217905550905050600d549050600d6000815480929190600101919050555080925050509392505050565b6000600b54905090565b6000600354905090565b6116e86129a7565b6116f06129bb565b60008060006116fd6129bb565b602060405180591061170c5750595b9080825280601f01601f1916602001820160405250945060009350600092505b60208310156117ea578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156117dd578185858151811015156117a457fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b828060010193505061172c565b836040518059106117f85750595b9080825280601f01601f19166020018201604052509050600092505b838310156118c057848381518110151561182a57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818481518110151561188357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508280600101935050611814565b8095505050505050919050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561192b57600080fd5b8260001415151561193b57600080fd5b600a846040518082805190602001908083835b602083101515611973578051825260208201915060208101905060208303925061194e565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050826008856040518082805190602001908083835b6020831015156119e257805182526020820191506020810190506020830392506119bd565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206000838152602001908152602001600020819055506000831315611b1c57611aa86009856040518082805190602001908083835b602083101515611a6e5780518252602082019150602081019050602083039250611a49565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020548461288d565b6009856040518082805190602001908083835b602083101515611ae05780518252602082019150602081019050602083039250611abb565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550611c04565b611b946009856040518082805190602001908083835b602083101515611b575780518252602082019150602081019050602083039250611b32565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054846000036128b7565b6009856040518082805190602001908083835b602083101515611bcc5780518252602082019150602081019050602083039250611ba7565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055505b611c7a600a856040518082805190602001908083835b602083101515611c3f5780518252602082019150602081019050602083039250611c1a565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054600161288d565b600a856040518082805190602001908083835b602083101515611cb25780518252602082019150602081019050602083039250611c8d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550600b600081548092919060010191905055508091505092915050565b60006006826040518082805190602001908083835b602083101515611d3f5780518252602082019150602081019050602083039250611d1a565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050919050565b60006006836040518082805190602001908083835b602083101515611db45780518252602082019150602081019050602083039250611d8f565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390205482101515611df557600080fd5b6004836040518082805190602001908083835b602083101515611e2d5780518252602082019150602081019050602083039250611e08565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600083815260200190815260200160002054905092915050565b60008060035483101515611e8d57600080fd5b611f41600260008581526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f375780601f10611f0c57610100808354040283529160200191611f37565b820191906000526020600020905b815481529060010190602001808311611f1a57829003601f168201915b5050505050612603565b91509150915091565b600080600080600080611f5b6128d0565b6000806000600d548b101515611f7057600080fd5b600c60008c815260200190815260200160002060a060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561207e5780601f106120535761010080835404028352916020019161207e565b820191906000526020600020905b81548152906001019060200180831161206157829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156121205780601f106120f557610100808354040283529160200191612120565b820191906000526020600020905b81548152906001019060200180831161210357829003601f168201915b505050505081526020016003820160009054906101000a900460ff161515151581526020016003820160019054906101000a900460ff1660ff1660ff1681525050935061217084602001516121ae565b925061217f8460400151612603565b915091508360000151838383876060015188608001519950995099509950995099505050505091939550919395565b6000806020830151905080915050919050565b6000600754905090565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561222957600080fd5b8260001415151561223957600080fd5b6006846040518082805190602001908083835b602083101515612271578051825260208201915060208101905060208303925061224c565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050826004856040518082805190602001908083835b6020831015156122e057805182526020820191506020810190506020830392506122bb565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600083815260200190815260200160002081905550600083131561241a576123a66005856040518082805190602001908083835b60208310151561236c5780518252602082019150602081019050602083039250612347565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020548461288d565b6005856040518082805190602001908083835b6020831015156123de57805182526020820191506020810190506020830392506123b9565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550612502565b6124926005856040518082805190602001908083835b6020831015156124555780518252602082019150602081019050602083039250612430565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054846000036128b7565b6005856040518082805190602001908083835b6020831015156124ca57805182526020820191506020810190506020830392506124a5565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055505b6125786006856040518082805190602001908083835b60208310151561253d5780518252602082019150602081019050602083039250612518565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054600161288d565b6006856040518082805190602001908083835b6020831015156125b0578051825260208201915060208101905060208303925061258b565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055506007600081548092919060010191905055508091505092915050565b60008060008060208501519150604085015190508181935093505050915091565b6000600a836040518082805190602001908083835b60208310151561265e5780518252602082019150602081019050602083039250612639565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020548210151561269f57600080fd5b6008836040518082805190602001908083835b6020831015156126d757805182526020820191506020810190506020830392506126b2565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600083815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561277f57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561284957600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101580156128a55750828110155b15156128ad57fe5b8091505092915050565b60008282111515156128c557fe5b818303905092915050565b60a060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001612901612a4f565b815260200161290e612a4f565b8152602001600015158152602001600060ff1681525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061296857805160ff1916838001178555612996565b82800160010185558215612996579182015b8281111561299557825182559160200191906001019061297a565b5b5090506129a39190612a63565b5090565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612a1057805160ff1916838001178555612a3e565b82800160010185558215612a3e579182015b82811115612a3d578251825591602001919060010190612a22565b5b509050612a4b9190612a63565b5090565b602060405190810160405280600081525090565b612a8591905b80821115612a81576000816000905550600101612a69565b5090565b905600a165627a7a723058202350e932b9e88be43cbb5da31d0dcf7cf331abc1c44b3cd964c830e03d26fc6c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,934 |
0xDEaBa23593b50C1fCe4FB9d9d345EE28763f1e67
|
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Want {
/// @notice EIP-20 token name for this token
string public constant name = "Want";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "WANT";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 100000e18; // 100k Want
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Want token
*/
constructor() public {
balances[msg.sender] = uint96(totalSupply);
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Want::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Want::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Want::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Want::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Want::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Want::delegateBySig: invalid nonce");
require(now <= expiry, "Want::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, "Want::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), "Want::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Want::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Want::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Want::_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, "Want::_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, "Want::_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, "Want::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() pure internal returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b9190611733565b60405180910390f35b6101576101523660046111fc565b6102e1565b60405161013b9190611689565b61016c61039e565b60405161013b9190611697565b61016c6103ac565b61015761018f3660046111af565b6103c3565b61019c610508565b60405161013b91906117cd565b6101bc6101b736600461114f565b61050d565b60405161013b919061167b565b6101dc6101d736600461114f565b610528565b005b6101f16101ec36600461114f565b610535565b60405161013b91906117a4565b61016c61020c36600461114f565b61054d565b61022461021f3660046111fc565b610571565b60405161013b91906117e9565b61016c61023f36600461114f565b610788565b61012e61079a565b61015761025a3660046111fc565b6107ba565b61022461026d36600461114f565b6107f6565b6101dc61028036600461122c565b610866565b61016c610293366004611175565b610a4c565b61016c610a7e565b6102b36102ae3660046112b3565b610a8a565b60405161013b9291906117b2565b6040518060400160405280600481526020016315d85b9d60e21b81525081565b6000806000198314156102f7575060001961031c565b61031983604051806060016040528060258152602001611a1b60259139610abf565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061038a9085906117db565b60405180910390a360019150505b92915050565b69152d02c7e14af680000081565b6040516103b890611665565b604051809103902081565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b039091169285926104199288929190611a1b90830139610abf565b9050866001600160a01b0316836001600160a01b03161415801561044657506001600160601b0382811614155b156104ee57600061047083836040518060600160405280603d81526020016118f6603d9139610aee565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104e49085906117db565b60405180910390a3505b6104f9878783610b2d565b600193505050505b9392505050565b601281565b6002602052600090815260409020546001600160a01b031681565b6105323382610cd8565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b600043821061059b5760405162461bcd60e51b815260040161059290611744565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105c9576000915050610398565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610645576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610398565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff16831015610680576000915050610398565b600060001982015b8163ffffffff168163ffffffff16111561074357600282820363ffffffff160481036106b261110c565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b0316918101919091529087141561071e576020015194506103989350505050565b805163ffffffff168711156107355781935061073c565b6001820392505b5050610688565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b6040518060400160405280600481526020016315d0539560e21b81525081565b6000806107df836040518060600160405280602681526020016119cd60269139610abf565b90506107ec338583610b2d565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610821576000610501565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b600060405161087490611665565b60408051918290038220828201909152600482526315d85b9d60e21b6020909201919091527f237f2043639516e949eac883dba23ab4547e38279f6c14b304d64f2da533ec106108c2610d62565b306040516020016108d694939291906116e3565b60405160208183030381529060405280519060200120905060006040516108fc90611670565b604051908190038120610917918a908a908a906020016116a5565b60405160208183030381529060405280519060200120905060008282604051602001610944929190611634565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109819493929190611718565b6020604051602081039080840390855afa1580156109a3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166109d65760405162461bcd60e51b815260040161059290611764565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a155760405162461bcd60e51b815260040161059290611794565b87421115610a355760405162461bcd60e51b815260040161059290611754565b610a3f818b610cd8565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b6040516103b890611670565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610ae65760405162461bcd60e51b81526004016105929190611733565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b255760405162461bcd60e51b81526004016105929190611733565b505050900390565b6001600160a01b038316610b535760405162461bcd60e51b815260040161059290611774565b6001600160a01b038216610b795760405162461bcd60e51b815260040161059290611784565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610bc4936001600160601b03909216928592919061196390830139610aee565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610c2c949190911692859290919061193390830139610d66565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610c999085906117db565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610cd392918216911683610da2565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610d5c828483610da2565b50505050565b4690565b6000838301826001600160601b038087169083161015610d995760405162461bcd60e51b81526004016105929190611733565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610dcd57506000816001600160601b0316115b15610cd3576001600160a01b03831615610e85576001600160a01b03831660009081526004602052604081205463ffffffff169081610e0d576000610e4c565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610e7382856040518060600160405280602881526020016119f360289139610aee565b9050610e8186848484610f30565b5050505b6001600160a01b03821615610cd3576001600160a01b03821660009081526004602052604081205463ffffffff169081610ec0576000610eff565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f2682856040518060600160405280602781526020016118cf60279139610d66565b9050610a44858484845b6000610f5443604051806060016040528060348152602001611999603491396110e5565b905060008463ffffffff16118015610f9d57506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15610ffc576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b0385160217905561109b565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516110d69291906117f7565b60405180910390a25050505050565b600081600160201b8410610ae65760405162461bcd60e51b81526004016105929190611733565b604080518082019091526000808252602082015290565b80356103988161189f565b8035610398816118b3565b8035610398816118bc565b8035610398816118c5565b60006020828403121561116157600080fd5b600061116d8484611123565b949350505050565b6000806040838503121561118857600080fd5b60006111948585611123565b92505060206111a585828601611123565b9150509250929050565b6000806000606084860312156111c457600080fd5b60006111d08686611123565b93505060206111e186828701611123565b92505060406111f28682870161112e565b9150509250925092565b6000806040838503121561120f57600080fd5b600061121b8585611123565b92505060206111a58582860161112e565b60008060008060008060c0878903121561124557600080fd5b60006112518989611123565b965050602061126289828a0161112e565b955050604061127389828a0161112e565b945050606061128489828a01611144565b935050608061129589828a0161112e565b92505060a06112a689828a0161112e565b9150509295509295509295565b600080604083850312156112c657600080fd5b60006112d28585611123565b92505060206111a585828601611139565b6112ec81611824565b82525050565b6112ec8161182f565b6112ec81611834565b6112ec61131082611834565b611834565b600061132082611812565b61132a8185611816565b935061133a818560208601611869565b61134381611895565b9093019392505050565b600061135a602783611816565b7f57616e743a3a6765745072696f72566f7465733a206e6f742079657420646574815266195c9b5a5b995960ca1b602082015260400192915050565b60006113a3602683611816565b7f57616e743a3a64656c656761746542795369673a207369676e617475726520658152651e1c1a5c995960d21b602082015260400192915050565b60006113eb60028361181f565b61190160f01b815260020192915050565b6000611409602683611816565b7f57616e743a3a64656c656761746542795369673a20696e76616c6964207369678152656e617475726560d01b602082015260400192915050565b600061145160438361181f565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b60006114bc603c83611816565b7f57616e743a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e736665722066726f6d20746865207a65726f206164647265737300000000602082015260400192915050565b600061151b603a83611816565b7f57616e743a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e7366657220746f20746865207a65726f2061646472657373000000000000602082015260400192915050565b600061157a603a8361181f565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b60006115d9602283611816565b7f57616e743a3a64656c656761746542795369673a20696e76616c6964206e6f6e815261636560f01b602082015260400192915050565b6112ec81611843565b6112ec8161184c565b6112ec8161185e565b6112ec81611852565b600061163f826113de565b915061164b8285611304565b60208201915061165b8284611304565b5060200192915050565b600061039882611444565b60006103988261156d565b6020810161039882846112e3565b6020810161039882846112f2565b6020810161039882846112fb565b608081016116b382876112fb565b6116c060208301866112e3565b6116cd60408301856112fb565b6116da60608301846112fb565b95945050505050565b608081016116f182876112fb565b6116fe60208301866112fb565b61170b60408301856112fb565b6116da60608301846112e3565b6080810161172682876112fb565b6116c06020830186611619565b602080825281016105018184611315565b602080825281016103988161134d565b6020808252810161039881611396565b60208082528101610398816113fc565b60208082528101610398816114af565b602080825281016103988161150e565b60208082528101610398816115cc565b602081016103988284611610565b604081016117c08285611610565b610501602083018461162b565b602081016103988284611619565b602081016103988284611622565b60208101610398828461162b565b604081016118058285611622565b6105016020830184611622565b5190565b90815260200190565b919050565b600061039882611837565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b600061039882611852565b60005b8381101561188457818101518382015260200161186c565b83811115610d5c5750506000910152565b601f01601f191690565b6118a881611824565b811461053257600080fd5b6118a881611834565b6118a881611843565b6118a88161184c56fe57616e743a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f777357616e743a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e636557616e743a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f777357616e743a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636557616e743a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747357616e743a3a7472616e736665723a20616d6f756e742065786365656473203936206269747357616e743a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f777357616e743a3a617070726f76653a20616d6f756e7420657863656564732039362062697473a365627a7a723158200cf00f69a40471aca64881d7ec1a6b63d9a7f8bc87da64a90ab9470cb7e0290c6c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 2,935 |
0x5e5a14be6b31ab275347bd28bb1d0f425c14f817
|
//This file contains a multisignature wallet contract that is used to control the eRAY token contract:
// - to set the settings of token generation round
// - to start and to stop token generation round
// - to freeze the token upon creation of array.io blockchain
// - to send eRAY tokens from this wallet
// - to make arbitrary transaction in usual to multisignature wallet way
// Elsewhere in other contracts or documentation this contract MAY be referenced as projectWallet
// Authors: Alexander Shevtsov <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3b495a555f545657545c52550c0d7b5c565a525715585456">[email protected]</a>>
// Vladimir Bobrov <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddab9db9b8beb8b3a9a8afa4baafb2a8adf3beb2b0">[email protected]</a>>
// vladiuz1 <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3b4d487b5a49495a42155254">[email protected]</a>>
// License: see the repository file
// Last updated: 12 August 2018
pragma solidity ^0.4.22;
//Interface for the token contract
contract IToken {
address public whitelist;
function executeSettingsChange(
uint amount,
uint minimalContribution,
uint partContributor,
uint partProject,
uint partFounders,
uint blocksPerStage,
uint partContributorIncreasePerStage,
uint maxStages
);
}
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
address owner; //the one who creates the contract, only this person can set the token
uint public required;
uint public transactionCount;
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);
IToken public token;
struct SettingsRequest {
uint amount;
uint minimalContribution;
uint partContributor;
uint partProject;
uint partFounders;
uint blocksPerStage;
uint partContributorIncreasePerStage;
uint maxStages;
bool executed;
mapping(address => bool) confirmations;
}
uint settingsRequestsCount = 0;
mapping(uint => SettingsRequest) settingsRequests;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
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 Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] _owners, uint _required) public validRequirement(_owners.length, _required) {
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
owner = msg.sender;
}
/// @dev Fallback function allows to deposit ether.
function() public payable {
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
function setToken(address _token) public onlyOwner {
require(token == address(0));
token = IToken(_token);
}
//---------------- TGR SETTINGS -----------
/// @dev Sends request to change settings
/// @return Transaction ID
function tgrSettingsChangeRequest(
uint amount,
uint minimalContribution,
uint partContributor,
uint partProject,
uint partFounders,
uint blocksPerStage,
uint partContributorIncreasePerStage,
uint maxStages
)
public
ownerExists(msg.sender)
returns (uint _txIndex)
{
assert(amount*partContributor*partProject*blocksPerStage*partContributorIncreasePerStage*maxStages != 0); //asserting no parameter is zero except partFounders
assert(amount >= 1 ether);
_txIndex = settingsRequestsCount;
settingsRequests[_txIndex] = SettingsRequest({
amount: amount,
minimalContribution: minimalContribution,
partContributor: partContributor,
partProject: partProject,
partFounders: partFounders,
blocksPerStage: blocksPerStage,
partContributorIncreasePerStage: partContributorIncreasePerStage,
maxStages: maxStages,
executed: false
});
settingsRequestsCount++;
confirmSettingsChange(_txIndex);
return _txIndex;
}
/// @dev Allows an owner to confirm a change settings request.
/// @param _txIndex Transaction ID.
function confirmSettingsChange(uint _txIndex) public ownerExists(msg.sender) returns(bool success) {
require(settingsRequests[_txIndex].executed == false);
settingsRequests[_txIndex].confirmations[msg.sender] = true;
if(isConfirmedSettingsRequest(_txIndex)){
SettingsRequest storage request = settingsRequests[_txIndex];
request.executed = true;
IToken(token).executeSettingsChange(
request.amount,
request.minimalContribution,
request.partContributor,
request.partProject,
request.partFounders,
request.blocksPerStage,
request.partContributorIncreasePerStage,
request.maxStages
);
return true;
} else {
return false;
}
}
function setFinishedTx() public ownerExists(msg.sender) returns(uint transactionId) {
transactionId = addTransaction(token, 0, hex"ce5e6393");
confirmTransaction(transactionId);
}
function setLiveTx() public ownerExists(msg.sender) returns(uint transactionId) {
transactionId = addTransaction(token, 0, hex"29745306");
confirmTransaction(transactionId);
}
function setFreezeTx() public ownerExists(msg.sender) returns(uint transactionId) {
transactionId = addTransaction(token, 0, hex"2c8cbe40");
confirmTransaction(transactionId);
}
function transferTx(address _to, uint _value) public ownerExists(msg.sender) returns(uint transactionId) {
//I rather seldom wish pain to other people, but solidity developers may be an exception.
bytes memory calldata = new bytes(68);
calldata[0] = byte(hex"a9");
calldata[1] = byte(hex"05");
calldata[2] = byte(hex"9c");
calldata[3] = byte(hex"bb");
//When I wrote these lines my eyes were bleeding.
bytes32 val = bytes32(_value);
bytes32 dest = bytes32(_to);
//I spent a day for this function, because my fingers made a fist.
for(uint j=0; j<32; j++) {
calldata[j+4]=dest[j];
}
//Oh, reader! I hope you forget it like a bad nightmare.
for(uint i=0; i<32; i++) {
calldata[i+36]=val[i];
}
//Stil the ghost of this code will haunt you.
transactionId = addTransaction(token, 0, calldata);
confirmTransaction(transactionId);
//I haven't mentioned that it's the most elegant solution for 0.4.20 compiler, which doesn't require rewriting all this shitty code.
//Enjoy.
}
function setWhitelistTx(address _whitelist) public ownerExists(msg.sender) returns(uint transactionId) {
bytes memory calldata = new bytes(36);
calldata[0] = byte(hex"85");
calldata[1] = byte(hex"4c");
calldata[2] = byte(hex"ff");
calldata[3] = byte(hex"2f");
bytes32 dest = bytes32(_whitelist);
for(uint j=0; j<32; j++) {
calldata[j+4]=dest[j];
}
transactionId = addTransaction(token, 0, calldata);
confirmTransaction(transactionId);
}
//adds this address to the whitelist
function whitelistTx(address _address) public ownerExists(msg.sender) returns(uint transactionId) {
bytes memory calldata = new bytes(36);
calldata[0] = byte(hex"0a");
calldata[1] = byte(hex"3b");
calldata[2] = byte(hex"0a");
calldata[3] = byte(hex"4f");
bytes32 dest = bytes32(_address);
for(uint j=0; j<32; j++) {
calldata[j+4]=dest[j];
}
transactionId = addTransaction(token.whitelist(), 0, calldata);
confirmTransaction(transactionId);
}
//--------------------------Usual multisig functions for handling owners and transactions.
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param _owner Address of new owner.
function addOwner(address _owner) public onlyWallet ownerDoesNotExist(_owner) notNull(_owner) validRequirement(owners.length + 1, required) {
isOwner[_owner] = true;
owners.push(_owner);
emit OwnerAddition(_owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param _owner Address of owner.
function removeOwner(address _owner) public onlyWallet ownerExists(_owner) {
isOwner[_owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == _owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(_owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param _owner Address of owner to be replaced.
/// @param _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;
emit OwnerRemoval(_owner);
emit OwnerAddition(_newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required) public onlyWallet validRequirement(owners.length, _required) {
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data) public ownerExists(msg.sender) notNull(destination) returns (uint transactionId) {
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @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 returns (uint transactionId) {
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit Submission(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param _transactionId Transaction ID.
function confirmTransaction(uint _transactionId) public ownerExists(msg.sender) transactionExists(_transactionId) notConfirmed(_transactionId, msg.sender) {
confirmations[_transactionId][msg.sender] = true;
emit Confirmation(msg.sender, _transactionId);
executeTransaction(_transactionId);
}
//Will fail if calldata less than 4 bytes long. It's a feature, not a bug.
/// @dev Allows anyone to execute a confirmed transaction.
/// @param _transactionId Transaction ID.
function executeTransaction(uint _transactionId) public notExecuted(_transactionId) {
if (isConfirmed(_transactionId)) {
Transaction storage trx = transactions[_transactionId];
trx.executed = true;
//Just don't ask questions. It's needed. Believe me.
bytes memory data = trx.data;
bytes memory calldata;
if (trx.data.length >= 4) {
bytes4 signature;
assembly {
signature := mload(add(data, 32))
}
calldata = new bytes(trx.data.length-4);
for (uint i = 0; i<calldata.length; i++) {
calldata[i] = trx.data[i+4];
}
}
else {
calldata = new bytes(0);
}
if (trx.destination.call.value(trx.value)(signature, calldata))
emit Execution(_transactionId);
else {
emit ExecutionFailure(_transactionId);
trx.executed = false;
}
}
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param _transactionId Transaction ID.
function revokeConfirmation(uint _transactionId) public ownerExists(msg.sender) confirmed(_transactionId, msg.sender) notExecuted(_transactionId) {
confirmations[_transactionId][msg.sender] = false;
emit Revocation(msg.sender, _transactionId);
}
/// @dev Returns the confirmation status of a transaction.
/// @param _transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint _transactionId) public view 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;
}
return false;
}
function isConfirmedSettingsRequest(uint _transactionId) public view returns (bool) {
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (settingsRequests[_transactionId].confirmations[owners[i]])
count += 1;
if (count == required)
return true;
}
return false;
}
/// @dev Shows what settings were requested in a settings change request
function viewSettingsChange(uint _txIndex) public constant
returns (uint amount, uint minimalContribution, uint partContributor, uint partProject, uint partFounders, uint blocksPerStage, uint partContributorIncreasePerStage, uint maxStages) {
SettingsRequest memory request = settingsRequests[_txIndex];
return (
request.amount,
request.minimalContribution,
request.partContributor,
request.partProject,
request.partFounders,
request.blocksPerStage,
request.partContributorIncreasePerStage,
request.maxStages
);
}
/// @dev Returns number of confirmations of a transaction.
/// @param _transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint _transactionId) public view returns (uint count) {
for (uint i=0; i<owners.length; i++)
if (confirmations[_transactionId][owners[i]])
count += 1;
}
function getSettingsChangeConfirmationCount(uint _txIndex) public view returns (uint count) {
for (uint i=0; i<owners.length; i++)
if (settingsRequests[_txIndex].confirmations[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 view 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 view 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 view 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 view returns (uint[] _transactionIds) {
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=from; 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];
}
}
|
0x6080604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c271461020657806312ddb80514610273578063144fa6d7146102ca578063173825d91461030d57806320ea8d86146103505780632789192f1461037d5780632f54bf6e146103c25780633411c81c1461041d5780634123a48214610482578063451bedb3146104e35780634ab320b41461052457806354741525146105965780637065cb48146105e5578063784547a7146106285780638b51d13f1461066d57806395c7b007146106ae57806397100be9146106d95780639ace38c214610704578063a0e67e2b146107ef578063a8abe69a1461085b578063b5dc40c3146108ff578063b77bf60014610981578063b8dd3c55146109ac578063ba51a6df146109f1578063be91ebe514610a1e578063c01a8c8414610aa5578063c642747414610ad2578063d4fa83c314610b79578063d74f8edd14610bd0578063dc8452cd14610bfb578063e20056e614610c26578063e58b5ab214610c89578063ee22610b14610cb4578063fc0c546a14610ce1575b6000341115610204573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561021257600080fd5b5061023160048036038101908080359060200190929190505050610d38565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027f57600080fd5b506102b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d76565b6040518082815260200191505060405180910390f35b3480156102d657600080fd5b5061030b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611116565b005b34801561031957600080fd5b5061034e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611213565b005b34801561035c57600080fd5b5061037b600480360381019080803590602001909291905050506114ac565b005b34801561038957600080fd5b506103a860048036038101908080359060200190929190505050611654565b604051808215151515815260200191505060405180910390f35b3480156103ce57600080fd5b50610403600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611740565b604051808215151515815260200191505060405180910390f35b34801561042957600080fd5b5061046860048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611760565b604051808215151515815260200191505060405180910390f35b34801561048e57600080fd5b506104cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061178f565b6040518082815260200191505060405180910390f35b3480156104ef57600080fd5b5061050e60048036038101908080359060200190929190505050611b2a565b6040518082815260200191505060405180910390f35b34801561053057600080fd5b5061054f60048036038101908080359060200190929190505050611bf8565b604051808981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390f35b3480156105a257600080fd5b506105cf600480360381019080803515159060200190929190803515159060200190929190505050611cdd565b6040518082815260200191505060405180910390f35b3480156105f157600080fd5b50610626600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d6f565b005b34801561063457600080fd5b5061065360048036038101908080359060200190929190505050611f73565b604051808215151515815260200191505060405180910390f35b34801561067957600080fd5b506106986004803603810190808035906020019092919050505061205c565b6040518082815260200191505060405180910390f35b3480156106ba57600080fd5b506106c3612127565b6040518082815260200191505060405180910390f35b3480156106e557600080fd5b506106ee6121f4565b6040518082815260200191505060405180910390f35b34801561071057600080fd5b5061072f600480360381019080803590602001909291905050506122c1565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156107b1578082015181840152602081019050610796565b50505050905090810190601f1680156107de5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156107fb57600080fd5b506108046123b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561084757808201518184015260208101905061082c565b505050509050019250505060405180910390f35b34801561086757600080fd5b506108a86004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050612444565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108eb5780820151818401526020810190506108d0565b505050509050019250505060405180910390f35b34801561090b57600080fd5b5061092a600480360381019080803590602001909291905050506125b4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561096d578082015181840152602081019050610952565b505050509050019250505060405180910390f35b34801561098d57600080fd5b506109966127f1565b6040518082815260200191505060405180910390f35b3480156109b857600080fd5b506109d7600480360381019080803590602001909291905050506127f7565b604051808215151515815260200191505060405180910390f35b3480156109fd57600080fd5b50610a1c60048036038101908080359060200190929190505050612a4b565b005b348015610a2a57600080fd5b50610a8f6004803603810190808035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050612b04565b6040518082815260200191505060405180910390f35b348015610ab157600080fd5b50610ad060048036038101908080359060200190929190505050612c86565b005b348015610ade57600080fd5b50610b63600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612e63565b6040518082815260200191505060405180910390f35b348015610b8557600080fd5b50610bba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f04565b6040518082815260200191505060405180910390f35b348015610bdc57600080fd5b50610be5613206565b6040518082815260200191505060405180910390f35b348015610c0757600080fd5b50610c1061320b565b6040518082815260200191505060405180910390f35b348015610c3257600080fd5b50610c87600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613211565b005b348015610c9557600080fd5b50610c9e613526565b6040518082815260200191505060405180910390f35b348015610cc057600080fd5b50610cdf600480360381019080803590602001909291905050506135f3565b005b348015610ced57600080fd5b50610cf6613a0d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600381815481101515610d4757fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000606060008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610dd657600080fd5b60246040519080825280601f01601f191660200182016040528015610e0a5781602001602082028038833980820191505090505b5093507f0a00000000000000000000000000000000000000000000000000000000000000846000815181101515610e3d57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f3b00000000000000000000000000000000000000000000000000000000000000846001815181101515610e9d57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f0a00000000000000000000000000000000000000000000000000000000000000846002815181101515610efd57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f4f00000000000000000000000000000000000000000000000000000000000000846003815181101515610f5d57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508573ffffffffffffffffffffffffffffffffffffffff166001029250600091505b6020821015611036578282602081101515610fc557fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000028460048401815181101515610ff957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050610fae565b611102600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166393e59dc16040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156110bf57600080fd5b505af11580156110d3573d6000803e3d6000fd5b505050506040513d60208110156110e957600080fd5b8101908080519060200190929190505050600086613a33565b945061110d85612c86565b50505050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561117257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156111cf57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124f57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156112a857600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b60016003805490500382101561142d578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561133b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561142057600360016003805490500381548110151561139957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003838154811015156113d357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061142d565b8180600101925050611305565b60016003818180549050039150816114459190613b5d565b50600380549050600554111561146457611463600380549050612a4b565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561150557600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561157057600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff161515156115a057600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b6000806000809150600090505b6003805490508110156117345760096000858152602001908152602001600020600901600060038381548110151561169557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611714576001820191505b6005548214156117275760019250611739565b8080600101915050611661565b600092505b5050919050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000606060008060008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156117f257600080fd5b60446040519080825280601f01601f1916602001820160405280156118265781602001602082028038833980820191505090505b5095507fa90000000000000000000000000000000000000000000000000000000000000086600081518110151561185957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f05000000000000000000000000000000000000000000000000000000000000008660018151811015156118b957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f9c0000000000000000000000000000000000000000000000000000000000000086600281518110151561191957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507fbb0000000000000000000000000000000000000000000000000000000000000086600381518110151561197957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508760010294508873ffffffffffffffffffffffffffffffffffffffff166001029350600092505b6020831015611a585783836020811015156119e757fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000028660048501815181101515611a1b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350506119d0565b600091505b6020821015611ae5578482602081101515611a7457fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000028660248401815181101515611aa857fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050611a5d565b611b13600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600088613a33565b9650611b1e87612c86565b50505050505092915050565b600080600090505b600380549050811015611bf257600960008481526020019081526020016000206009016000600383815481101515611b6657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611be5576001820191505b8080600101915050611b32565b50919050565b600080600080600080600080611c0c613b89565b600960008b8152602001908152602001600020610120604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820160009054906101000a900460ff1615151515815250509050806000015181602001518260400151836060015184608001518560a001518660c001518760e001519850985098509850985098509850985050919395975091939597565b600080600090505b600654811015611d6857838015611d1c575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80611d4f5750828015611d4e575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611d5b576001820191505b8080600101915050611ce5565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611da957600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611e0357600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515611e2a57600080fd5b600160038054905001600554603282108015611e465750818111155b8015611e53575060008114155b8015611e60575060008214155b1515611e6b57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b60038054905081101561205057600160008581526020019081526020016000206000600383815481101515611fb157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612030576001820191505b6005548214156120435760019250612055565b8080600101915050611f80565b600092505b5050919050565b600080600090505b6003805490508110156121215760016000848152602001908152602001600020600060038381548110151561209557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612114576001820191505b8080600101915050612064565b50919050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561218257600080fd5b6121e5600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040805190810160405280600481526020017f2c8cbe4000000000000000000000000000000000000000000000000000000000815250613a33565b91506121f082612c86565b5090565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561224f57600080fd5b6122b2600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040805190810160405280600481526020017f2974530600000000000000000000000000000000000000000000000000000000815250613a33565b91506122bd82612c86565b5090565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123995780601f1061236e57610100808354040283529160200191612399565b820191906000526020600020905b81548152906001019060200180831161237c57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561243a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116123f0575b5050505050905090565b60608060008060065460405190808252806020026020018201604052801561247b5781602001602082028038833980820191505090505b509250600091508790505b600654811015612526578580156124bd575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806124f057508480156124ef575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156125195780838381518110151561250457fe5b90602001906020020181815250506001820191505b8080600101915050612486565b8787036040519080825280602002602001820160405280156125575781602001602082028038833980820191505090505b5093508790505b868110156125a957828181518110151561257457fe5b906020019060200201518489830381518110151561258e57fe5b9060200190602002018181525050808060010191505061255e565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156125ee5781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561273b5760016000868152602001908152602001600020600060038381548110151561262b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561272e576003818154811015156126b257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156126eb57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506125fa565b8160405190808252806020026020018201604052801561276a5781602001602082028038833980820191505090505b509350600090505b818110156127e957828181518110151561278857fe5b9060200190602002015184828151811015156127a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050612772565b505050919050565b60065481565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561285357600080fd5b600015156009600086815260200190815260200160002060080160009054906101000a900460ff16151514151561288957600080fd5b60016009600086815260200190815260200160002060090160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506128fe84611654565b15612a3f5760096000858152602001908152602001600020915060018260080160006101000a81548160ff021916908315150217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b5b77d7f83600001548460010154856002015486600301548760040154886005015489600601548a600701546040518963ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018089815260200188815260200187815260200186815260200185815260200184815260200183815260200182815260200198505050505050505050600060405180830381600087803b158015612a1e57600080fd5b505af1158015612a32573d6000803e3d6000fd5b5050505060019250612a44565b600092505b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a8557600080fd5b60038054905081603282108015612a9c5750818111155b8015612aa9575060008114155b8015612ab6575060008214155b1515612ac157600080fd5b826005819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612b5f57600080fd5b60008385878a8c8f020202020214151515612b7657fe5b670de0b6b3a76400008a10151515612b8a57fe5b6008549150610120604051908101604052808b81526020018a81526020018981526020018881526020018781526020018681526020018581526020018481526020016000151581525060096000848152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080160006101000a81548160ff021916908315150217905550905050600860008154809291906001019190505550612c75826127f7565b508191505098975050505050505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612cdf57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612d3b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515612da757600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3612e5c856135f3565b5050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612ebe57600080fd5b8460008173ffffffffffffffffffffffffffffffffffffffff1614151515612ee557600080fd5b612ef0868686613a33565b9250612efb83612c86565b50509392505050565b6000606060008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612f6457600080fd5b60246040519080825280601f01601f191660200182016040528015612f985781602001602082028038833980820191505090505b5093507f8500000000000000000000000000000000000000000000000000000000000000846000815181101515612fcb57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f4c0000000000000000000000000000000000000000000000000000000000000084600181518110151561302b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507fff0000000000000000000000000000000000000000000000000000000000000084600281518110151561308b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f2f000000000000000000000000000000000000000000000000000000000000008460038151811015156130eb57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508573ffffffffffffffffffffffffffffffffffffffff166001029250600091505b60208210156131c457828260208110151561315357fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002846004840181518110151561318757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350818060010192505061313c565b6131f2600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600086613a33565b94506131fd85612c86565b50505050919050565b603281565b60055481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561324d57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156132a657600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561330057600080fd5b600092505b6003805490508310156133e9578473ffffffffffffffffffffffffffffffffffffffff1660038481548110151561333857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156133dc578360038481548110151561338f57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506133e9565b8280600101935050613305565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561358157600080fd5b6135e4600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040805190810160405280600481526020017fce5e639300000000000000000000000000000000000000000000000000000000815250613a33565b91506135ef82612c86565b5090565b60006060806000808560008082815260200190815260200160002060030160009054906101000a900460ff1615151561362b57600080fd5b61363487611f73565b15613a0457600080888152602001908152602001600020955060018660030160006101000a81548160ff021916908315150217905550856002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156137025780601f106136d757610100808354040283529160200191613702565b820191906000526020600020905b8154815290600101906020018083116136e557829003601f168201915b5050505050945060048660020180546001816001161561010002031660029004905010151561384b5760208501519250600486600201805460018160011615610100020316600290049050036040519080825280601f01601f1916602001820160405280156137805781602001602082028038833980820191505090505b509350600091505b835182101561384657856002016004830181546001816001161561010002031660029004811015156137b657fe5b8154600116156137d55790600052602060002090602091828204019190065b9054901a7f010000000000000000000000000000000000000000000000000000000000000002848381518110151561380957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050613788565b613883565b60006040519080825280601f01601f19166020018201604052801561387f5781602001602082028038833980820191505090505b5093505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154847c0100000000000000000000000000000000000000000000000000000000900490866040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828051906020019080838360005b8381101561393e578082015181840152602081019050613923565b50505050905090810190601f16801561396b5780820380516001836020036101000a031916815260200191505b5091505060006040518083038185885af19350505050156139b857867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2613a03565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055505b5b50505050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060065490506080604051908101604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020016000151581525060008083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190613af4929190613bd8565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600660008282540192505081905550807fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a29392505050565b815481835581811115613b8457818360005260206000209182019101613b839190613c58565b5b505050565b6101206040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613c1957805160ff1916838001178555613c47565b82800160010185558215613c47579182015b82811115613c46578251825591602001919060010190613c2b565b5b509050613c549190613c58565b5090565b613c7a91905b80821115613c76576000816000905550600101613c5e565b5090565b905600a165627a7a72305820f829d30de8761e8fc4ae89fddef83af24d140e54f8060a14b43b4efd9779b73a0029
|
{"success": true, "error": null, "results": {}}
| 2,936 |
0x62e1de23ed1c9744ac50c4c6e96ecb8b8beeb7f4
|
/**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev 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;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @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 IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
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'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @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. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to withdraw the
* tokens after a given release time.
*/
contract UnsupervisedTimelock {
using SafeERC20 for IERC20;
// Seconds of a day
uint256 private constant SECONDS_OF_A_DAY = 86400;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// The start timestamp of token release period.
//
// Before this time, the beneficiary can NOT withdraw any token from this contract.
uint256 private immutable _releaseStartTime;
// The days that the timelock will last.
uint256 private immutable _daysOfTimelock;
// The OctToken contract
IERC20 private immutable _token;
// Total balance of benefit
uint256 private immutable _totalBenefit;
// The amount of withdrawed balance of the beneficiary.
//
// This value will be updated on each withdraw operation.
uint256 private _withdrawedBalance;
event BenefitWithdrawed(address indexed beneficiary, uint256 amount);
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseStartTime_,
uint256 daysOfTimelock_,
uint256 totalBenefit_
) {
_token = token_;
_beneficiary = beneficiary_;
_releaseStartTime =
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY);
require(
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY) +
daysOfTimelock_ *
SECONDS_OF_A_DAY >
block.timestamp,
"UnsupervisedTimelock: release end time is before current time"
);
_daysOfTimelock = daysOfTimelock_;
_totalBenefit = totalBenefit_;
_withdrawedBalance = 0;
}
/**
* @return the token being held.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the beneficiary address
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the total balance of benefit
*/
function totalBenefit() public view returns (uint256) {
return _totalBenefit;
}
/**
* @return the balance to release for the beneficiary at the moment
*/
function releasedBalance() public view returns (uint256) {
if (block.timestamp <= _releaseStartTime) return 0;
if (
block.timestamp >
_releaseStartTime + SECONDS_OF_A_DAY * _daysOfTimelock
) {
return _totalBenefit;
}
uint256 passedDays = (block.timestamp - _releaseStartTime) /
SECONDS_OF_A_DAY;
return (_totalBenefit * passedDays) / _daysOfTimelock;
}
/**
* @return the unreleased balance of the beneficiary at the moment
*/
function unreleasedBalance() public view returns (uint256) {
return _totalBenefit - releasedBalance();
}
/**
* @return the withdrawed balance of beneficiary
*/
function withdrawedBalance() public view returns (uint256) {
return _withdrawedBalance;
}
/**
* @notice Withdraws tokens to beneficiary
*/
function withdraw() public {
uint256 balanceShouldBeReleased = releasedBalance();
require(
balanceShouldBeReleased > _withdrawedBalance,
"UnsupervisedTimelock: no more benefit can be withdrawed now"
);
uint256 balanceShouldBeTransfered = balanceShouldBeReleased -
_withdrawedBalance;
require(
token().balanceOf(address(this)) >= balanceShouldBeTransfered,
"UnsupervisedTimelock: deposited balance is not enough"
);
_withdrawedBalance = balanceShouldBeReleased;
token().safeTransfer(_beneficiary, balanceShouldBeTransfered);
emit BenefitWithdrawed(_beneficiary, balanceShouldBeTransfered);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806391eeab851161005b57806391eeab85146100c85780639ab4b22f146100e6578063f50c8e2d14610104578063fc0c546a146101225761007d565b806338af3eed146100825780633ccfd60b146100a05780636b37cc14146100aa575b600080fd5b61008a610140565b6040516100979190610a1c565b60405180910390f35b6100a8610168565b005b6100b2610366565b6040516100bf9190610b3d565b60405180910390f35b6100d06103a0565b6040516100dd9190610b3d565b60405180910390f35b6100ee6103a9565b6040516100fb9190610b3d565b60405180910390f35b61010c610500565b6040516101199190610b3d565b60405180910390f35b61012a610528565b6040516101379190610a60565b60405180910390f35b60007f000000000000000000000000a50f38e4e19a8fe65a3131de0d39e82c50be86cf905090565b60006101726103a9565b905060005481116101b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101af90610a9d565b60405180910390fd5b60008054826101c79190610c6b565b9050806101d2610528565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610a1c565b60206040518083038186803b15801561022257600080fd5b505afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610896565b101561029b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029290610abd565b60405180910390fd5b816000819055506102f47f000000000000000000000000a50f38e4e19a8fe65a3131de0d39e82c50be86cf826102cf610528565b73ffffffffffffffffffffffffffffffffffffffff166105509092919063ffffffff16565b7f000000000000000000000000a50f38e4e19a8fe65a3131de0d39e82c50be86cf73ffffffffffffffffffffffffffffffffffffffff167f26b111a6f79cb1f14e797207bb7f2095963c467ca641399e15f7b2a02fb44cf98260405161035a9190610b3d565b60405180910390a25050565b60006103706103a9565b7f0000000000000000000000000000000000000000000422ca8b0a00a42500000061039b9190610c6b565b905090565b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000612ec28042116103db57600090506104fd565b7f00000000000000000000000000000000000000000000000000000000000004486201518061040a9190610c11565b7f00000000000000000000000000000000000000000000000000000000612ec2806104359190610b8a565b421115610464577f0000000000000000000000000000000000000000000422ca8b0a00a42500000090506104fd565b6000620151807f00000000000000000000000000000000000000000000000000000000612ec280426104969190610c6b565b6104a09190610be0565b90507f0000000000000000000000000000000000000000000000000000000000000448817f0000000000000000000000000000000000000000000422ca8b0a00a4250000006104ef9190610c11565b6104f99190610be0565b9150505b90565b60007f0000000000000000000000000000000000000000000422ca8b0a00a425000000905090565b60007f000000000000000000000000f5cfbc74057c610c8ef151a439252680ac68c6dc905090565b6105d18363a9059cbb60e01b848460405160240161056f929190610a37565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506105d6565b505050565b6000610638826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661069d9092919063ffffffff16565b90506000815111156106985780806020019051810190610658919061086d565b610697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068e90610b1d565b60405180910390fd5b5b505050565b60606106ac84846000856106b5565b90509392505050565b6060824710156106fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f190610add565b60405180910390fd5b610703856107c9565b610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990610afd565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161076b9190610a05565b60006040518083038185875af1925050503d80600081146107a8576040519150601f19603f3d011682016040523d82523d6000602084013e6107ad565b606091505b50915091506107bd8282866107dc565b92505050949350505050565b600080823b905060008111915050919050565b606083156107ec5782905061083c565b6000835111156107ff5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108339190610a7b565b60405180910390fd5b9392505050565b60008151905061085281610f12565b92915050565b60008151905061086781610f29565b92915050565b60006020828403121561087f57600080fd5b600061088d84828501610843565b91505092915050565b6000602082840312156108a857600080fd5b60006108b684828501610858565b91505092915050565b6108c881610c9f565b82525050565b60006108d982610b58565b6108e38185610b6e565b93506108f3818560208601610d0b565b80840191505092915050565b61090881610ce7565b82525050565b600061091982610b63565b6109238185610b79565b9350610933818560208601610d0b565b61093c81610d9c565b840191505092915050565b6000610954603b83610b79565b915061095f82610dad565b604082019050919050565b6000610977603583610b79565b915061098282610dfc565b604082019050919050565b600061099a602683610b79565b91506109a582610e4b565b604082019050919050565b60006109bd601d83610b79565b91506109c882610e9a565b602082019050919050565b60006109e0602a83610b79565b91506109eb82610ec3565b604082019050919050565b6109ff81610cdd565b82525050565b6000610a1182846108ce565b915081905092915050565b6000602082019050610a3160008301846108bf565b92915050565b6000604082019050610a4c60008301856108bf565b610a5960208301846109f6565b9392505050565b6000602082019050610a7560008301846108ff565b92915050565b60006020820190508181036000830152610a95818461090e565b905092915050565b60006020820190508181036000830152610ab681610947565b9050919050565b60006020820190508181036000830152610ad68161096a565b9050919050565b60006020820190508181036000830152610af68161098d565b9050919050565b60006020820190508181036000830152610b16816109b0565b9050919050565b60006020820190508181036000830152610b36816109d3565b9050919050565b6000602082019050610b5260008301846109f6565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610b9582610cdd565b9150610ba083610cdd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610bd557610bd4610d3e565b5b828201905092915050565b6000610beb82610cdd565b9150610bf683610cdd565b925082610c0657610c05610d6d565b5b828204905092915050565b6000610c1c82610cdd565b9150610c2783610cdd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610c6057610c5f610d3e565b5b828202905092915050565b6000610c7682610cdd565b9150610c8183610cdd565b925082821015610c9457610c93610d3e565b5b828203905092915050565b6000610caa82610cbd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cf282610cf9565b9050919050565b6000610d0482610cbd565b9050919050565b60005b83811015610d29578082015181840152602081019050610d0e565b83811115610d38576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f556e7375706572766973656454696d656c6f636b3a206e6f206d6f726520626560008201527f6e656669742063616e2062652077697468647261776564206e6f770000000000602082015250565b7f556e7375706572766973656454696d656c6f636b3a206465706f73697465642060008201527f62616c616e6365206973206e6f7420656e6f7567680000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b610f1b81610cb1565b8114610f2657600080fd5b50565b610f3281610cdd565b8114610f3d57600080fd5b5056fea2646970667358221220d64301bb2e01bd50ccf6f1b3e32ab3dd016930675ceb384fec7a4cb0beb8076064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,937 |
0x7d430c7354cf3441e22ecf9979b5fec8bb500911
|
/**
*Submitted for verification at Etherscan.io on 2021-10-28
*/
/**
*Submitted
*/
/**
* Halloween scariest token
* Telegram: https://t.me/PumpkinInuToken
* Website: https://www.pumpkininu.co
* Zombie Game available after launch
* No buy Tax, only Sell for marketing & Game prizes
*/
/**
*/
/**
*
*/
/**
*
*/
/**
*
*/
/**
*/
/**
*
*/
/**
*/
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 PumpkinInu 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 = "PumpkinInu";
string private constant _symbol = "PumpkinInuToken";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600a81526020017f50756d706b696e496e7500000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600f81526020017f50756d706b696e496e75546f6b656e0000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6001600a819055506009600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576001600a819055506009600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220736d250cb63d68992ec09b3d26f281ceab9b15374c8b4b651b35d65f6b40d1b964736f6c63430008030033
|
{"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"}]}}
| 2,938 |
0x5890ed5a9686220d5df3ead7de314255480d50b8
|
/**
*Submitted for verification at Etherscan.io on 2020-11-16
*/
// 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 LOG_10_2 = 3010299957;
uint private constant LOG_E_2 = 6931471806;
uint private constant BASE = 1e10;
IKeep3rV1Oracle public constant KV1O = IKeep3rV1Oracle(0x73353801921417F465377c8d898c6f4C0270282C);
function floorLog2(uint256 _n) internal 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) internal 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) internal 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 = KV1O.current(tokenIn, uint(10)**IERC20(tokenIn).decimals(), tokenOut);
return quotePrice(tokenIn, tokenOut, t, price, price);
}
function quotePrice(address tokenIn, address tokenOut, uint t, uint sp, uint st) public view returns (uint call, uint put) {
uint v = rVol(tokenIn, tokenOut, 48, 2);
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) {
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 = ncdf(FIXED_1 * d2 / 1e18);
return sp * cdfD1 / 1e14 - st * cdfD2 / 1e14;
}
function ncdf(uint x) internal 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;
}
function generalLog(uint256 x) internal 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) internal 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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80637f8290d01161008c578063c6a5153511610066578063c6a515351461055f578063c801e067146105e1578063d3442edf14610663578063e031d453146106c3576100cf565b80637f8290d0146103d6578063892f82f01461040a578063b6466384146104d6576100cf565b80630969e8db146100d45780630e755974146101715780632b9432a8146101e95780633394f9ed146102505780633a6fdf47146102d257806365c3c2b41461035e575b600080fd5b610154600480360360a08110156100ea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919050505061073b565b604051808381526020018281526020019250505060405180910390f35b6101d36004803603604081101561018757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061076b565b6040518082815260200191505060405180910390f35b610233600480360360808110156101ff57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610784565b604051808381526020018281526020019250505060405180910390f35b6102bc6004803603606081101561026657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107d3565b6040518082815260200191505060405180910390f35b610348600480360360808110156102e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506107eb565b6040518082815260200191505060405180910390f35b6103c06004803603604081101561037457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a08565b6040518082815260200191505060405180910390f35b6103de610a1f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c06004803603602081101561042057600080fd5b810190808035906020019064010000000081111561043d57600080fd5b82018360208201111561044f57600080fd5b8035906020019184602083028401116401000000008311171561047157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610a37565b6040518082815260200191505060405180910390f35b610542600480360360608110156104ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b0e565b604051808381526020018281526020019250505060405180910390f35b6105cb6004803603606081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c8e565b6040518082815260200191505060405180910390f35b61064d600480360360608110156105f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ca6565b6040518082815260200191505060405180910390f35b6106ad6004803603608081101561067957600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610cbf565b6040518082815260200191505060405180910390f35b610725600480360360408110156106d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e3c565b6040518082815260200191505060405180910390f35b600080600061074e8888603060026107eb565b905061075c86828787610784565b92509250509550959350505050565b600061077c838360026101506107eb565b905092915050565b600080600080848611156107ac5761079e88888888610cbf565b9150818686030190506107c2565b6107b888888789610cbf565b9050808686030191505b818193509350505094509492505050565b60006107e284848460026107eb565b90509392505050565b60006109fe7373353801921417f465377c8d898c6f4c0270282c73ffffffffffffffffffffffffffffffffffffffff16630a793398878873ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561086757600080fd5b505afa15801561087b573d6000803e3d6000fd5b505050506040513d602081101561089157600080fd5b8101908080519060200190929190505050600a0a8888886040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060006040518083038186803b15801561092457600080fd5b505afa158015610938573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561096257600080fd5b810190808051604051939291908464010000000082111561098257600080fd5b8382019150602082018581111561099857600080fd5b82518660208202830111640100000000821117156109b557600080fd5b8083526020830192505050908051906020019060200280838360005b838110156109ec5780820151818401526020810190506109d1565b50505050905001604052505050610a37565b9050949350505050565b6000610a1783836002806107eb565b905092915050565b7373353801921417f465377c8d898c6f4c0270282c81565b600080600190505b60018351038160ff1611610ac7576002610a836f80000000000000000000000000000000856001850360ff1681518110610a7557fe5b602002602001015102610e54565b610ab46f80000000000000000000000000000000868560ff1681518110610aa657fe5b602002602001015102610e54565b030a820191508080600101915050610a3f565b50610ae9610ae160018451038381610adb57fe5b04610f5f565b60fc02610f5f565b905067b504f333f9de648481670de0b6b3a76400000281610b0657fe5b049050919050565b60008060007373353801921417f465377c8d898c6f4c0270282c73ffffffffffffffffffffffffffffffffffffffff1663a75d39c2878873ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8a57600080fd5b505afa158015610b9e573d6000803e3d6000fd5b505050506040513d6020811015610bb457600080fd5b8101908080519060200190929190505050600a0a886040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060206040518083038186803b158015610c3757600080fd5b505afa158015610c4b573d6000803e3d6000fd5b505050506040513d6020811015610c6157600080fd5b81019080805190602001909291905050509050610c81868686848561073b565b9250925050935093915050565b6000610c9d84848460306107eb565b90509392505050565b6000610cb68484846101506107eb565b90509392505050565b600080600280860a81610cce57fe5b04905060006ec097ce7bc90715b34b9f10000000009050600061016d888385670de0b6b3a76400000281610cfe57fe5b040281610d0757fe5b0490506000633b9aca00610d2f61016d8b670de0b6b3a76400000281610d2957fe5b04610f5f565b890281610d3857fe5b04905060006f80000000000000000000000000000000610d72888a6f800000000000000000000000000000000281610d6c57fe5b04610fa4565b670de0b6b3a76400000281610d8357fe5b04905081670de0b6b3a76400008483010281610d9b57fe5b049050600082820390506000610dd3670de0b6b3a7640000846f800000000000000000000000000000000281610dcd57fe5b046110b0565b90506000610e03670de0b6b3a7640000846f800000000000000000000000000000000281610dfd57fe5b046110b0565b9050655af3107a4000818b0281610e1657fe5b04655af3107a4000838d0281610e2857fe5b040398505050505050505050949350505050565b6000610e4c8383600260306107eb565b905092915050565b600080600090507001000000000000000000000000000000008310610ebc576000610e976f800000000000000000000000000000008581610e9157fe5b046111ec565b90508060ff1684901c93506f800000000000000000000000000000008160ff16029150505b6f80000000000000000000000000000000831115610f42576000607f90505b60008160ff161115610f40576f8000000000000000000000000000000084850281610f0257fe5b0493507001000000000000000000000000000000008410610f3457600184901c93506001810360ff166001901b820191505b80600190039050610edb565b505b6402540be40063b36d8835820281610f5657fe5b04915050919050565b60008060026001840181610f6f57fe5b0490508291505b81811015610f9e57809150600281828581610f8d57fe5b040181610f9657fe5b049050610f76565b50919050565b60008060009050700100000000000000000000000000000000831061100c576000610fe76f800000000000000000000000000000008581610fe157fe5b046111ec565b90508060ff1684901c93506f800000000000000000000000000000008160ff16029150505b6f80000000000000000000000000000000831115611092576000607f90505b60008160ff161115611090576f800000000000000000000000000000008485028161105257fe5b049350700100000000000000000000000000000000841061108457600184901c93506001810360ff166001901b820191505b8060019003905061102b565b505b6402540be40064019d25ddbe8202816110a757fe5b04915050919050565b6000806f80000000000000000000000000000000836223549b02816110d157fe5b046298968001905060006f8000000000000000000000000000000084600286816110f757fe5b04028161110057fe5b049050600061110e82611268565b6f80000000000000000000000000000000623cdfaf028161112b57fe5b049050600083629896808562989680876298968089629896808b6578fcdaec22008161115357fe5b057ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeea193001028161117e57fe5b0563010fd4fc01028161118d57fe5b057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc997ba0102816111b857fe5b056230bbd701840202816111c857fe5b05905060008611156111e05780655af3107a40000390505b80945050505050919050565b6000806000905061010083101561121e575b600183111561121957600183901c92506001810190506111fe565b61125f565b6000608090505b60008160ff16111561125d578060ff166001901b841061124e578060ff1684901c935080821791505b60018160ff16901c9050611225565b505b80915050919050565b600080600090506000806f10000000000000000000000000000000858161128b57fe5b0691508190506f80000000000000000000000000000000828202816112ac57fe5b0490506710e1b3be415a00008102830192506f80000000000000000000000000000000828202816112d957fe5b0490506705a0913f6b1e00008102830192506f800000000000000000000000000000008282028161130657fe5b049050670168244fdac780008102830192506f800000000000000000000000000000008282028161133357fe5b049050664807432bc180008102830192506f800000000000000000000000000000008282028161135f57fe5b049050660c0135dca040008102830192506f800000000000000000000000000000008282028161138b57fe5b0490506601b707b1cdc0008102830192506f80000000000000000000000000000000828202816113b757fe5b0490506536e0f639b8008102830192506f80000000000000000000000000000000828202816113e257fe5b049050650618fee9f8008102830192506f800000000000000000000000000000008282028161140d57fe5b049050649c197dcc008102830192506f800000000000000000000000000000008282028161143757fe5b049050640e30dce4008102830192506f800000000000000000000000000000008282028161146157fe5b04905064012ebd13008102830192506f800000000000000000000000000000008282028161148b57fe5b0490506317499f008102830192506f80000000000000000000000000000000828202816114b457fe5b0490506301a9d4808102830192506f80000000000000000000000000000000828202816114dd57fe5b049050621c63808102830192506f800000000000000000000000000000008282028161150557fe5b0490506201c6388102830192506f800000000000000000000000000000008282028161152d57fe5b049050611ab88102830192506f800000000000000000000000000000008282028161155457fe5b04905061017c8102830192506f800000000000000000000000000000008282028161157b57fe5b04905060148102830192506f80000000000000000000000000000000828202816115a157fe5b04905060018102830192506f80000000000000000000000000000000826721c3677c82b4000085816115cf57fe5b040101925060006f1000000000000000000000000000000086161461161f5770018ebef9eac820ae8682b9793ac6d1e7767001c3d6a24ed82218787d624d3e5eba95f984028161161b57fe5b0492505b60006f2000000000000000000000000000000086161461166a577001368b2fc6f9609fe7aceb46aa619baed470018ebef9eac820ae8682b9793ac6d1e77884028161166657fe5b0492505b60006f400000000000000000000000000000008616146116b4576fbc5ab1b16779be3575bd8f0520a9f21f7001368b2fc6f9609fe7aceb46aa619baed58402816116b057fe5b0492505b60006f800000000000000000000000000000008616146116fd576f454aaa8efe072e7f6ddbab84b40a55c96fbc5ab1b16779be3575bd8f0520a9f21e8402816116f957fe5b0492505b6000700100000000000000000000000000000000861614611747576f0960aadc109e7a3bf4578099615711ea6f454aaa8efe072e7f6ddbab84b40a55c584028161174357fe5b0492505b6000700200000000000000000000000000000000861614611790576e2bf84208204f5977f9a8cf01fdce3d6f0960aadc109e7a3bf4578099615711d784028161178c57fe5b0492505b60007004000000000000000000000000000000008616146117d7576d03c6ab775dd0b95b4cbee7e65d116e2bf84208204f5977f9a8cf01fdc3078402816117d357fe5b0492505b82935050505091905056fea2646970667358221220aa0436b6f41e7037fb554b60c1b868c2bc2ffaf311b4fc433d1626986f8f37f664736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,939 |
0x646601f2b404806f75104f9905b31dff129c5555
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// SPDX-License-Identifier: Unlicensed
/*
Telegram:
https://t.me/shibmail
Website:
https://shibmail.services/
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SHIBMAIL is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SHIBMAIL";
string private constant _symbol = "SHIBMAIL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 3;
uint256 private _taxFeeJeets = 8;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 8;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xAe622e81e19cef5dDF8EC5E95D8618F963D5e6cf);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 1e10 * 10**9;
uint256 public _maxWalletSize = 1e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 1e10 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to]);
require(!_isSniper[from]);
require(!_isSniper[_msgSender()]);
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 2 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function startContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0);
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e6 * 10**9);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e14610630578063e0f9f6a014610676578063ea1644d514610696578063f2fde38b146106b6578063fe72c3c1146106d657600080fd5b806395d89b41146102355780639ec350ed146105b05780639f131571146105d0578063a9059cbb146105f0578063c55284901461061057600080fd5b80637c519ffb116100f25780637c519ffb146105315780637d1db4a514610546578063881dce601461055c5780638da5cb5b1461057c5780638f9a55c01461059a57600080fd5b806370a08231146104c6578063715018a6146104e657806374010ece146104fb578063790ca4131461051b57600080fd5b8063313ce567116101b15780635d098b38116101755780635d098b38146104465780635fb02f4d146104665780636b9cf5341461047b5780636d8aa8f8146104915780636fc3eaec146104b157600080fd5b8063313ce567146103aa57806333251a0b146103c657806338eea22d146103e657806349bd5a5e146104065780634bf2c7c91461042657600080fd5b806318160ddd116101f857806318160ddd1461031657806323b872dd1461033c57806327c8f8351461035c57806328bb665a146103725780632fd689e31461039457600080fd5b806306fdde0314610235578063095ea7b3146102755780630f3a325f146102a55780631694505e146102de57600080fd5b3661023057005b600080fd5b34801561024157600080fd5b50604080518082018252600881526714d212509350525360c21b6020820152905161026c9190612126565b60405180910390f35b34801561028157600080fd5b50610295610290366004611fd1565b6106ec565b604051901515815260200161026c565b3480156102b157600080fd5b506102956102c0366004611f1d565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ea57600080fd5b506019546102fe906001600160a01b031681565b6040516001600160a01b03909116815260200161026c565b34801561032257600080fd5b50683635c9adc5dea000005b60405190815260200161026c565b34801561034857600080fd5b50610295610357366004611f90565b610703565b34801561036857600080fd5b506102fe61dead81565b34801561037e57600080fd5b5061039261038d366004611ffd565b61076c565b005b3480156103a057600080fd5b5061032e601d5481565b3480156103b657600080fd5b506040516009815260200161026c565b3480156103d257600080fd5b506103926103e1366004611f1d565b61080b565b3480156103f257600080fd5b50610392610401366004612104565b61087a565b34801561041257600080fd5b50601a546102fe906001600160a01b031681565b34801561043257600080fd5b506103926104413660046120eb565b6108cb565b34801561045257600080fd5b50610392610461366004611f1d565b610908565b34801561047257600080fd5b50610392610962565b34801561048757600080fd5b5061032e601e5481565b34801561049d57600080fd5b506103926104ac3660046120c9565b610b47565b3480156104bd57600080fd5b50610392610b8f565b3480156104d257600080fd5b5061032e6104e1366004611f1d565b610bb9565b3480156104f257600080fd5b50610392610bdb565b34801561050757600080fd5b506103926105163660046120eb565b610c4f565b34801561052757600080fd5b5061032e600a5481565b34801561053d57600080fd5b50610392610c92565b34801561055257600080fd5b5061032e601b5481565b34801561056857600080fd5b506103926105773660046120eb565b610cec565b34801561058857600080fd5b506000546001600160a01b03166102fe565b3480156105a657600080fd5b5061032e601c5481565b3480156105bc57600080fd5b506103926105cb366004612104565b610d36565b3480156105dc57600080fd5b506103926105eb3660046120c9565b610d87565b3480156105fc57600080fd5b5061029561060b366004611fd1565b610dcf565b34801561061c57600080fd5b5061039261062b366004612104565b610ddc565b34801561063c57600080fd5b5061032e61064b366004611f57565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561068257600080fd5b506103926106913660046120eb565b610e2d565b3480156106a257600080fd5b506103926106b13660046120eb565b610e77565b3480156106c257600080fd5b506103926106d1366004611f1d565b610eb5565b3480156106e257600080fd5b5061032e60185481565b60006106f9338484610f9f565b5060015b92915050565b60006107108484846110c3565b610762843361075d85604051806060016040528060288152602001612304602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906117b0565b610f9f565b5060019392505050565b6000546001600160a01b0316331461079f5760405162461bcd60e51b81526004016107969061217b565b60405180910390fd5b60005b8151811015610807576001600960008484815181106107c3576107c36122c2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107ff81612291565b9150506107a2565b5050565b6000546001600160a01b031633146108355760405162461bcd60e51b81526004016107969061217b565b6001600160a01b03811660009081526009602052604090205460ff1615610877576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108a45760405162461bcd60e51b81526004016107969061217b565b60018211156108b257600080fd5b60018111156108c057600080fd5b600d91909155600f55565b6000546001600160a01b031633146108f55760405162461bcd60e51b81526004016107969061217b565b600181111561090357600080fd5b601355565b6017546001600160a01b0316336001600160a01b03161461092857600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b0316331461098c5760405162461bcd60e51b81526004016107969061217b565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156109ec57600080fd5b505afa158015610a00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a249190611f3a565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6c57600080fd5b505afa158015610a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa49190611f3a565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610aec57600080fd5b505af1158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b249190611f3a565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610b715760405162461bcd60e51b81526004016107969061217b565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b031614610baf57600080fd5b47610877816117ea565b6001600160a01b0381166000908152600260205260408120546106fd90611824565b6000546001600160a01b03163314610c055760405162461bcd60e51b81526004016107969061217b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610c795760405162461bcd60e51b81526004016107969061217b565b6611c37937e08000811015610c8d57600080fd5b601b55565b6000546001600160a01b03163314610cbc5760405162461bcd60e51b81526004016107969061217b565b601a54600160a01b900460ff1615610cd357600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610d0c57600080fd5b610d1530610bb9565b8111158015610d245750600081115b610d2d57600080fd5b610877816118a8565b6000546001600160a01b03163314610d605760405162461bcd60e51b81526004016107969061217b565b6001821115610d6e57600080fd5b6013811115610d7c57600080fd5b600b91909155600c55565b6000546001600160a01b03163314610db15760405162461bcd60e51b81526004016107969061217b565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b60006106f93384846110c3565b6000546001600160a01b03163314610e065760405162461bcd60e51b81526004016107969061217b565b600d821115610e1457600080fd5b600d811115610e2257600080fd5b600e91909155601055565b6000546001600160a01b03163314610e575760405162461bcd60e51b81526004016107969061217b565b6004811115610e6557600080fd5b610e7181610e1061225b565b60185550565b6000546001600160a01b03163314610ea15760405162461bcd60e51b81526004016107969061217b565b601c54811015610eb057600080fd5b601c55565b6000546001600160a01b03163314610edf5760405162461bcd60e51b81526004016107969061217b565b6001600160a01b038116610f445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610796565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166110015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610796565b6001600160a01b0382166110625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610796565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111275760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610796565b6001600160a01b0382166111895760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610796565b600081116111eb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610796565b6001600160a01b03821660009081526009602052604090205460ff161561121157600080fd5b6001600160a01b03831660009081526009602052604090205460ff161561123757600080fd5b3360009081526009602052604090205460ff161561125457600080fd5b6000546001600160a01b0384811691161480159061128057506000546001600160a01b03838116911614155b156115f857601a54600160a01b900460ff166112de5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610796565b601a546001600160a01b03838116911614801561130957506019546001600160a01b03848116911614155b156113bb576001600160a01b038216301480159061133057506001600160a01b0383163014155b801561134a57506017546001600160a01b03838116911614155b801561136457506017546001600160a01b03848116911614155b156113bb57601b548111156113bb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610796565b601a546001600160a01b038381169116148015906113e757506017546001600160a01b03838116911614155b80156113fc57506001600160a01b0382163014155b801561141357506001600160a01b03821661dead14155b156114f257601c548161142584610bb9565b61142f9190612221565b106114885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610796565b601a54600160b81b900460ff16156114f257600a546114a8906078612221565b42116114f257601e548111156114f25760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b6044820152606401610796565b60006114fd30610bb9565b601d54909150811180801561151c5750601a54600160a81b900460ff16155b80156115365750601a546001600160a01b03868116911614155b801561154b5750601a54600160b01b900460ff165b801561157057506001600160a01b03851660009081526006602052604090205460ff16155b801561159557506001600160a01b03841660009081526006602052604090205460ff16155b156115f557601354600090156115d0576115c560646115bf60135486611a3190919063ffffffff16565b90611ab0565b90506115d081611af2565b6115e26115dd828561227a565b6118a8565b4780156115f2576115f2476117ea565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061163a57506001600160a01b03831660009081526006602052604090205460ff165b8061166c5750601a546001600160a01b0385811691161480159061166c5750601a546001600160a01b03848116911614155b156116795750600061179e565b601a546001600160a01b0385811691161480156116a457506019546001600160a01b03848116911614155b156116ff576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5414156116ff576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561172a57506019546001600160a01b03858116911614155b1561179e576001600160a01b0384166000908152600460205260409020541580159061177b57506018546001600160a01b038516600090815260046020526040902054429161177891612221565b10155b1561179157600b54601155600c5460125561179e565b600f546011556010546012555b6117aa84848484611aff565b50505050565b600081848411156117d45760405162461bcd60e51b81526004016107969190612126565b5060006117e1848661227a565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610807573d6000803e3d6000fd5b600060075482111561188b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610796565b6000611895611b33565b90506118a18382611ab0565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118f0576118f06122c2565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561194457600080fd5b505afa158015611958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197c9190611f3a565b8160018151811061198f5761198f6122c2565b6001600160a01b0392831660209182029290920101526019546119b59130911684610f9f565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac947906119ee9085906000908690309042906004016121b0565b600060405180830381600087803b158015611a0857600080fd5b505af1158015611a1c573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611a40575060006106fd565b6000611a4c838561225b565b905082611a598583612239565b146118a15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610796565b60006118a183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b56565b6108773061dead836110c3565b80611b0c57611b0c611b84565b611b17848484611bc9565b806117aa576117aa601454601155601554601255601654601355565b6000806000611b40611cc0565b9092509050611b4f8282611ab0565b9250505090565b60008183611b775760405162461bcd60e51b81526004016107969190612126565b5060006117e18486612239565b601154158015611b945750601254155b8015611ba05750601354155b15611ba757565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611bdb87611d02565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c0d9087611d5f565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c3c9086611da1565b6001600160a01b038916600090815260026020526040902055611c5e81611e00565b611c688483611e4a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611cad91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611cdc8282611ab0565b821015611cf957505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611d1f8a601154601254611e6e565b9250925092506000611d2f611b33565b90506000806000611d428e878787611ebd565b919e509c509a509598509396509194505050505091939550919395565b60006118a183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117b0565b600080611dae8385612221565b9050838110156118a15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610796565b6000611e0a611b33565b90506000611e188383611a31565b30600090815260026020526040902054909150611e359082611da1565b30600090815260026020526040902055505050565b600754611e579083611d5f565b600755600854611e679082611da1565b6008555050565b6000808080611e8260646115bf8989611a31565b90506000611e9560646115bf8a89611a31565b90506000611ead82611ea78b86611d5f565b90611d5f565b9992985090965090945050505050565b6000808080611ecc8886611a31565b90506000611eda8887611a31565b90506000611ee88888611a31565b90506000611efa82611ea78686611d5f565b939b939a50919850919650505050505050565b8035611f18816122ee565b919050565b600060208284031215611f2f57600080fd5b81356118a1816122ee565b600060208284031215611f4c57600080fd5b81516118a1816122ee565b60008060408385031215611f6a57600080fd5b8235611f75816122ee565b91506020830135611f85816122ee565b809150509250929050565b600080600060608486031215611fa557600080fd5b8335611fb0816122ee565b92506020840135611fc0816122ee565b929592945050506040919091013590565b60008060408385031215611fe457600080fd5b8235611fef816122ee565b946020939093013593505050565b6000602080838503121561201057600080fd5b823567ffffffffffffffff8082111561202857600080fd5b818501915085601f83011261203c57600080fd5b81358181111561204e5761204e6122d8565b8060051b604051601f19603f83011681018181108582111715612073576120736122d8565b604052828152858101935084860182860187018a101561209257600080fd5b600095505b838610156120bc576120a881611f0d565b855260019590950194938601938601612097565b5098975050505050505050565b6000602082840312156120db57600080fd5b813580151581146118a157600080fd5b6000602082840312156120fd57600080fd5b5035919050565b6000806040838503121561211757600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561215357858101830151858201604001528201612137565b81811115612165576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156122005784516001600160a01b0316835293830193918301916001016121db565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612234576122346122ac565b500190565b60008261225657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612275576122756122ac565b500290565b60008282101561228c5761228c6122ac565b500390565b60006000198214156122a5576122a56122ac565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461087757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b7fcabc57824830d728c09064ae60c8e92ee6069b45d0f0ab8874b124d375c6264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,940 |
0x311f9b375960837eB11A8F8CE770b02BE30faF79
|
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// Inspired by Solmate: https://github.com/Rari-Capital/solmate
/// Developed originally by 0xBasset
/// Upgraded by <redacted>
/// Additions by Tsuki Labs: https://tsukiyomigroup.com/ :)
contract Oil {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
/*///////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
address public impl_;
address public ruler;
address public treasury;
address public uniPair;
address public weth;
uint256 public totalSupply;
uint256 public startingTime;
uint256 public baseTax;
uint256 public minSwap;
bool public paused;
bool public swapping;
ERC721Like public habibi;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => bool) public isMinter;
mapping(uint256 => uint256) public claims;
mapping(address => Staker) internal stakers;
uint256 public sellFee;
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
uint256 public doubleBaseTimestamp;
struct Habibi {
uint256 stakedTimestamp;
uint256 tokenId;
}
struct Staker {
Habibi[] habibiz;
uint256 lastClaim;
}
struct Rescueable {
address revoker;
bool adminAllowedAsRevoker;
}
mapping(address => Rescueable) private rescueable;
address public sushiswapPair;
IUniswapV2Router02 public uniswapV2Router;
IUniswapV2Router02 public sushiswapV2Router;
mapping(address => bool) public excludedFromFees;
mapping(address => bool) public blockList;
/*///////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
function name() external pure returns (string memory) {
return "OIL";
}
function symbol() external pure returns (string memory) {
return "OIL";
}
function decimals() external pure returns (uint8) {
return 18;
}
/*///////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function initialize(address habibi_, address treasury_) external {
require(msg.sender == ruler, "NOT ALLOWED TO RULE");
ruler = msg.sender;
treasury = treasury_;
habibi = ERC721Like(habibi_);
sellFee = 15000;
_status = _NOT_ENTERED;
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external whenNotPaused returns (bool) {
require(!blockList[msg.sender], "Address Blocked");
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
) external whenNotPaused returns (bool) {
require(!blockList[msg.sender], "Address Blocked");
if (allowance[from][msg.sender] != type(uint256).max) {
allowance[from][msg.sender] -= value;
}
_transfer(from, to, value);
return true;
}
/*///////////////////////////////////////////////////////////////
STAKING
//////////////////////////////////////////////////////////////*/
function habibizOfStaker(address _staker) public view returns (uint256[] memory) {
uint256[] memory tokenIds = new uint256[](stakers[_staker].habibiz.length);
for (uint256 i = 0; i < stakers[_staker].habibiz.length; i++) {
tokenIds[i] = stakers[_staker].habibiz[i].tokenId;
}
return tokenIds;
}
function stakeAll() external whenNotPaused {
uint256[] memory habibiz = ERC721Like(habibi).walletOfOwner(msg.sender);
require(habibiz.length > 0, "Sender has no staked Habibiz");
stake(habibiz);
}
function stake(uint256[] memory _habibiz) public nonReentrant whenNotPaused {
for (uint256 i = 0; i < _habibiz.length; i++) {
require(ERC721Like(habibi).ownerOf(_habibiz[i]) == msg.sender, "At least one Habibi is not owned by you.");
ERC721Like(habibi).transferFrom(msg.sender, address(this), _habibiz[i]);
stakers[msg.sender].habibiz.push(Habibi(block.timestamp, _habibiz[i]));
}
}
function unstakeAll() external nonReentrant whenNotPaused {
require(!blockList[msg.sender], "Address Blocked");
uint256 oilRewards = calculateOilRewards(msg.sender);
uint256[] memory tokenIds = habibizOfStaker(msg.sender);
require(tokenIds.length > 0, "Sender has no staked Habibiz");
require(oilRewards > 0, "No claimable Oil");
for (uint256 i = 0; i < tokenIds.length; i++) {
ERC721Like(habibi).transferFrom(address(this), msg.sender, tokenIds[i]);
tokenIds[i] = stakers[msg.sender].habibiz[i].tokenId;
}
removeHabibiIdsFromStaker(msg.sender, tokenIds);
stakers[msg.sender].lastClaim = block.timestamp;
_mint(msg.sender, oilRewards);
}
function removeHabibiIdsFromStaker(address _staker, uint256[] memory _tokenIds) internal {
for (uint256 i = 0; i < _tokenIds.length; i++) {
for (uint256 j = 0; j < stakers[_staker].habibiz.length; j++) {
if (_tokenIds[i] == stakers[_staker].habibiz[j].tokenId) {
stakers[_staker].habibiz[j] = stakers[_staker].habibiz[stakers[_staker].habibiz.length - 1];
stakers[_staker].habibiz.pop();
}
}
}
}
function unstakeByIds(uint256[] calldata _tokenIds) external nonReentrant whenNotPaused {
require(!blockList[msg.sender], "Address Blocked");
uint256 oilRewards = calculateOilRewards(msg.sender);
for (uint256 i = 0; i < _tokenIds.length; i++) {
bool owned = false;
for (uint256 j = 0; j < stakers[msg.sender].habibiz.length; j++) {
if (stakers[msg.sender].habibiz[j].tokenId == _tokenIds[i]) {
owned = true;
}
}
require(owned, "TOKEN NOT OWNED BY SENDER");
ERC721Like(habibi).transferFrom(address(this), msg.sender, _tokenIds[i]);
}
removeHabibiIdsFromStaker(msg.sender, _tokenIds);
stakers[msg.sender].lastClaim = block.timestamp;
_mint(msg.sender, oilRewards);
}
function approveRescue(
address revoker_,
bool confirm_,
bool rescueableByAdmin_
) external {
require(confirm_, "Did not confirm");
require(revoker_ != address(0), "Revoker cannot be null address");
rescueable[msg.sender] = Rescueable(revoker_, rescueableByAdmin_);
}
function revokeRescue(address rescueable_, bool confirm_) external {
if (msg.sender == ruler) {
require(rescueable[rescueable_].adminAllowedAsRevoker, "Admin is not allowed to revoke");
} else {
require(rescueable[rescueable_].revoker == msg.sender, "Sender is not revoker");
}
require(confirm_, "Did not confirm");
delete rescueable[rescueable_];
}
/*///////////////////////////////////////////////////////////////
CLAIMING
//////////////////////////////////////////////////////////////*/
function claim() external nonReentrant whenNotPaused {
require(!blockList[msg.sender], "Address Blocked");
uint256 oil = calculateOilRewards(msg.sender);
if (oil > 0) {
stakers[msg.sender].lastClaim = block.timestamp;
_mint(msg.sender, oil);
} else {
revert("Not enough oil");
}
}
/*///////////////////////////////////////////////////////////////
OIL REWARDS
//////////////////////////////////////////////////////////////*/
function calculateOilRewards(address _staker) public view returns (uint256 oilAmount) {
uint256 balanceBonus = holderBonusPercentage(_staker);
for (uint256 i = 0; i < stakers[_staker].habibiz.length; i++) {
uint256 habibiId = stakers[_staker].habibiz[i].tokenId;
oilAmount =
oilAmount +
calculateOilOfHabibi(
habibiId,
stakers[_staker].lastClaim,
stakers[_staker].habibiz[i].stakedTimestamp,
block.timestamp,
balanceBonus,
doubleBaseTimestamp
);
}
}
function calculateOilOfHabibi(
uint256 _habibiId,
uint256 _lastClaimedTimestamp,
uint256 _stakedTimestamp,
uint256 _currentTimestamp,
uint256 _balanceBonus,
uint256 _doubleBaseTimestamp
) internal pure returns (uint256 oil) {
uint256 bonusPercentage;
uint256 baseOilMultiplier = 1;
uint256 unclaimedTime;
uint256 stakedTime = _currentTimestamp - _stakedTimestamp;
if (_lastClaimedTimestamp < _stakedTimestamp) {
_lastClaimedTimestamp = _stakedTimestamp;
}
unclaimedTime = _currentTimestamp - _lastClaimedTimestamp;
if (stakedTime >= 15 days || _stakedTimestamp <= _doubleBaseTimestamp) {
baseOilMultiplier = 2;
}
if (stakedTime >= 90 days) {
bonusPercentage = 100;
} else {
for (uint256 i = 2; i < 4; i++) {
uint256 timeRequirement = 15 days * i;
if (timeRequirement > 0 && timeRequirement <= stakedTime) {
bonusPercentage = bonusPercentage + 15;
} else {
break;
}
}
}
if (_isAnimated(_habibiId)) {
oil = (unclaimedTime * 2500 ether * baseOilMultiplier) / 1 days;
} else {
bonusPercentage = bonusPercentage + _balanceBonus;
oil = (unclaimedTime * 500 ether * baseOilMultiplier) / 1 days;
}
oil = oil + ((oil * bonusPercentage) / 100);
}
function staker(address staker_) public view returns (Staker memory) {
return stakers[staker_];
}
/*///////////////////////////////////////////////////////////////
OIL PRIVILEGE
//////////////////////////////////////////////////////////////*/
function mint(address to, uint256 value) external onlyMinter {
_mint(to, value);
}
function burn(address from, uint256 value) external onlyMinter {
_burn(from, value);
}
/*///////////////////////////////////////////////////////////////
Ruler Function
//////////////////////////////////////////////////////////////*/
function setDoubleBaseTimestamp(uint256 _doubleBaseTimestamp) external onlyRuler {
doubleBaseTimestamp = _doubleBaseTimestamp;
}
function setMinter(address _minter, bool _canMint) external onlyRuler {
isMinter[_minter] = _canMint;
}
function setRuler(address _ruler) external onlyRuler {
ruler = _ruler;
}
function setPaused(bool _paused) external onlyRuler {
paused = _paused;
}
function setHabibiAddress(address _habibiAddress) external onlyRuler {
habibi = ERC721Like(_habibiAddress);
}
function setSellFee(uint256 _fee) external onlyRuler {
sellFee = _fee;
}
function setUniswapV2Router(address router_) external onlyRuler {
uniswapV2Router = IUniswapV2Router02(router_);
}
function setSushiswapV2Router(address router_) external onlyRuler {
sushiswapV2Router = IUniswapV2Router02(router_);
}
function setV2Routers(address uniswapRouter_, address sushiswapRouter_) external onlyRuler {
uniswapV2Router = IUniswapV2Router02(uniswapRouter_);
sushiswapV2Router = IUniswapV2Router02(sushiswapRouter_);
}
function setUniPair(address uniPair_) external onlyRuler {
uniPair = uniPair_;
}
function setSushiswapPair(address sushiswapPair_) external onlyRuler {
sushiswapPair = sushiswapPair_;
}
function setPairs(address uniPair_, address sushiswapPair_) external onlyRuler {
uniPair = uniPair_;
sushiswapPair = sushiswapPair_;
}
function excludeFromFees(address[] calldata addresses_, bool[] calldata excluded_) external onlyRuler {
for (uint256 i = 0; i < addresses_.length; i++) {
excludedFromFees[addresses_[i]] = excluded_[i];
}
}
function blockOrUnblockAddresses(address[] calldata addresses_, bool[] calldata blocked_) external onlyRuler {
for (uint256 i = 0; i < addresses_.length; i++) {
blockList[addresses_[i]] = blocked_[i];
}
}
/// emergency
function rescue(
address staker_,
address to_,
uint256[] calldata tokenIds_
) external onlyRuler {
require(rescueable[staker_].revoker != address(0), "User has not opted-in for rescue");
uint256[] memory fromHabibiz = habibizOfStaker(staker_);
for (uint256 i = 0; i < tokenIds_.length; i++) {
bool found;
for (uint256 j = 0; j < fromHabibiz.length; j++) {
if (tokenIds_[i] == fromHabibiz[j]) {
found = true;
break;
}
}
require(found, "TokenID not found");
}
removeHabibiIdsFromStaker(staker_, tokenIds_);
for (uint256 i = 0; i < tokenIds_.length; i++) {
stakers[to_].habibiz.push(Habibi(block.timestamp, tokenIds_[i]));
}
}
/*///////////////////////////////////////////////////////////////
INTERNAL UTILS
//////////////////////////////////////////////////////////////*/
function _getRouterFromPair(address pairAddress_) internal view returns (IUniswapV2Router02) {
return pairAddress_ == address(uniPair) ? uniswapV2Router : sushiswapV2Router;
}
function _transfer(
address from,
address to,
uint256 value
) internal {
require(balanceOf[from] >= value, "ERC20: transfer amount exceeds balance");
uint256 tax;
bool shouldTax = ((to == uniPair && balanceOf[to] != 0) || (to == sushiswapPair && balanceOf[to] != 0)) &&
!swapping;
if (shouldTax && !excludedFromFees[from]) {
tax = (value * sellFee) / 100_000;
if (tax > 0) {
balanceOf[address(this)] += tax;
swapTokensForEth(to, tax, treasury);
}
}
uint256 taxedAmount = value - tax;
balanceOf[from] -= value;
balanceOf[to] += taxedAmount;
emit Transfer(from, to, taxedAmount);
}
function swapTokensForEth(
address pairAddress_,
uint256 _amountIn,
address _to
) private lockTheSwap {
IUniswapV2Router02 router = _getRouterFromPair(pairAddress_);
IERC20(address(this)).approve(address(router), _amountIn);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH(); // or router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(_amountIn, 1, path, _to, block.timestamp);
}
function _mint(address to, uint256 value) internal {
totalSupply += value;
// This is safe because the sum of all user
// balances can't exceed type(uint256).max!
unchecked {
balanceOf[to] += value;
}
emit Transfer(address(0), to, value);
}
function _burn(address from, uint256 value) internal {
balanceOf[from] -= value;
// This is safe because a user won't ever
// have a balance larger than totalSupply!
unchecked {
totalSupply -= value;
}
emit Transfer(from, address(0), value);
}
function holderBonusPercentage(address staker_) public view returns (uint256) {
uint256 balance = stakers[staker_].habibiz.length;
if (balance < 5) return 0;
if (balance < 10) return 15;
if (balance < 20) return 25;
return 35;
}
function _isAnimated(uint256 _id) internal pure returns (bool animated) {
return
_id == 40 ||
_id == 108 ||
_id == 169 ||
_id == 191 ||
_id == 246 ||
_id == 257 ||
_id == 319 ||
_id == 386 ||
_id == 496 ||
_id == 562 ||
_id == 637 ||
_id == 692 ||
_id == 832 ||
_id == 942 ||
_id == 943 ||
_id == 957 ||
_id == 1100 ||
_id == 1108 ||
_id == 1169 ||
_id == 1178 ||
_id == 1627 ||
_id == 1706 ||
_id == 1843 ||
_id == 1884 ||
_id == 2137 ||
_id == 2158 ||
_id == 2165 ||
_id == 2214 ||
_id == 2232 ||
_id == 2238 ||
_id == 2508 ||
_id == 2629 ||
_id == 2863 ||
_id == 3055 ||
_id == 3073 ||
_id == 3280 ||
_id == 3297 ||
_id == 3322 ||
_id == 3327 ||
_id == 3361 ||
_id == 3411 ||
_id == 3605 ||
_id == 3639 ||
_id == 3774 ||
_id == 4250 ||
_id == 4267 ||
_id == 4302 ||
_id == 4362 ||
_id == 4382 ||
_id == 4397 ||
_id == 4675 ||
_id == 4707 ||
_id == 4863;
}
/*///////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////*/
modifier onlyMinter() {
require(isMinter[msg.sender], "FORBIDDEN TO MINT OR BURN");
_;
}
modifier onlyRuler() {
require(msg.sender == ruler, "NOT ALLOWED TO RULE");
_;
}
modifier whenNotPaused() {
require(!paused, "Pausable: paused");
_;
}
modifier lockTheSwap() {
swapping = true;
_;
swapping = false;
}
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;
}
}
interface ERC721Like {
function balanceOf(address holder_) external view returns (uint256);
function ownerOf(uint256 id_) external view returns (address);
function walletOfOwner(address _owner) external view returns (uint256[] calldata);
function isApprovedForAll(address operator_, address address_) external view returns (bool);
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
}
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 IUniswapV2Router02 {
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface UniPairLike {
function token0() external returns (address);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
}
|
0x608060405234801561001057600080fd5b506004361061038e5760003560e01c8063598c9a1a116101de578063a3306dc31161010f578063cf456ae7116100ad578063dd62ed3e1161007c578063dd62ed3e14610805578063ed51277714610830578063fb46ac4414610839578063fcdbc2c61461084c57600080fd5b8063cf456ae7146107a9578063d3e8b400146107bc578063dbe66ca0146107cf578063dca1f674146107f257600080fd5b8063a9059cbb116100e9578063a9059cbb1461073d578063aa271e1a14610750578063b539928314610773578063cf06ab011461079657600080fd5b8063a3306dc3146106f7578063a51dd75d1461070a578063a888c2cd1461071d57600080fd5b80637a36e76c1161017c5780638dcb4061116101565780638dcb4061146106c957806395d89b41146103935780639dc29fac146106d1578063a258d99e146106e457600080fd5b80637a36e76c1461067657806382e4eda4146106965780638b4cee08146106b657600080fd5b806361d027b3116101b857806361d027b31461061d5780636ddacd6d146106305780636f99f3971461064357806370a082311461065657600080fd5b8063598c9a1a146105f457806359cd9031146106075780635c975abb1461061057600080fd5b80632b14ca56116102c35780633fc8cef311610261578063485cc95511610230578063485cc955146105b357806348aa1936146105c65780634e71d92d146105d95780634fa4c5d7146105e157600080fd5b80633fc8cef31461056157806340c10f1914610574578063435bb2f914610587578063456a1cf4146105a057600080fd5b806335322f371161029d57806335322f371461052a57806338c6cdd51461053257806339518b5e146105455780633f356ba71461054e57600080fd5b80632b14ca56146104ff578063313ce5671461050857806332972e461461051757600080fd5b80631694505e1161033057806318160ddd1161030a57806318160ddd146104af57806318503b2a146104c65780631ffa3021146104d957806323b872dd146104ec57600080fd5b80631694505e1461047757806316c38b3c1461048a5780631732cded1461049d57600080fd5b80630d290aee1161036c5780630d290aee146104135780630fbf0a931461043e57806312480abe146104515780631419841d1461046457600080fd5b806306fdde0314610393578063095ea7b3146103db5780630cc96e1a146103fe575b600080fd5b604080518082018252600381527f4f494c0000000000000000000000000000000000000000000000000000000000602082015290516103d29190613744565b60405180910390f35b6103ee6103e93660046134b6565b610855565b60405190151581526020016103d2565b61041161040c3660046134e2565b6108c1565b005b600054610426906001600160a01b031681565b6040516001600160a01b0390911681526020016103d2565b61041161044c366004613584565b6109b4565b61041161045f36600461331d565b610cd9565b61041161047236600461331d565b610d58565b601454610426906001600160a01b031681565b6104116104983660046136ad565b610dd7565b6009546103ee90610100900460ff1681565b6104b860055481565b6040519081526020016103d2565b6104116104d436600461335e565b610e3a565b6104116104e736600461331d565b610ec5565b6103ee6104fa3660046133fc565b610f44565b6104b8600f5481565b604051601281526020016103d2565b600354610426906001600160a01b031681565b610411611059565b601554610426906001600160a01b031681565b6104b860065481565b6104b861055c36600461331d565b611361565b600454610426906001600160a01b031681565b6104116105823660046134b6565b61144a565b600954610426906201000090046001600160a01b031681565b6104116105ae36600461331d565b6114b7565b6104116105c136600461335e565b611547565b6104116105d4366004613542565b611611565b610411611931565b6104116105ef36600461331d565b611aa9565b61041161060236600461331d565b611b28565b6104b860085481565b6009546103ee9060ff1681565b600254610426906001600160a01b031681565b6104b861063e36600461331d565b611ba7565b61041161065136600461343d565b611bff565b6104b861066436600461331d565b600a6020526000908152604090205481565b61068961068436600461331d565b611d8d565b6040516103d29190613700565b6106a96106a436600461331d565b611e83565b6040516103d29190613799565b6104116106c43660046136e7565b611f30565b610411611f85565b6104116106df3660046134b6565b6120c9565b6104116106f23660046136e7565b612132565b601354610426906001600160a01b031681565b600154610426906001600160a01b031681565b6104b861072b3660046136e7565b600d6020526000908152604090205481565b6103ee61074b3660046134b6565b612187565b6103ee61075e36600461331d565b600c6020526000908152604090205460ff1681565b6103ee61078136600461331d565b60176020526000908152604090205460ff1681565b6104116107a436600461335e565b612236565b6104116107b736600461343d565b6122c1565b6104116107ca366004613397565b61233c565b6103ee6107dd36600461331d565b60166020526000908152604090205460ff1681565b61041161080036600461346b565b6125a0565b6104b861081336600461335e565b600b60209081526000928352604080842090915290825290205481565b6104b860115481565b6104116108473660046134e2565b6126c6565b6104b860075481565b336000818152600b602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906108b09086815260200190565b60405180910390a350600192915050565b6001546001600160a01b031633146109165760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b60448201526064015b60405180910390fd5b60005b838110156109ad578282828181106109335761093361397b565b905060200201602081019061094891906136ad565b6016600087878581811061095e5761095e61397b565b9050602002016020810190610973919061331d565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806109a581613934565b915050610919565b5050505050565b60026010541415610a075760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161090d565b600260105560095460ff1615610a525760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b60005b8151811015610cd057600954825133916201000090046001600160a01b031690636352211e90859085908110610a8d57610a8d61397b565b60200260200101516040518263ffffffff1660e01b8152600401610ab391815260200190565b60206040518083038186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190613341565b6001600160a01b031614610b7f5760405162461bcd60e51b815260206004820152602860248201527f4174206c65617374206f6e6520486162696269206973206e6f74206f776e656460448201527f20627920796f752e000000000000000000000000000000000000000000000000606482015260840161090d565b600960029054906101000a90046001600160a01b03166001600160a01b03166323b872dd3330858581518110610bb757610bb761397b565b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610c2957600080fd5b505af1158015610c3d573d6000803e3d6000fd5b50505050600e6000336001600160a01b03166001600160a01b031681526020019081526020016000206000016040518060400160405280428152602001848481518110610c8c57610c8c61397b565b602090810291909101810151909152825460018181018555600094855293829020835160029092020190815591015191015580610cc881613934565b915050610a55565b50506001601055565b6001546001600160a01b03163314610d295760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6013805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610da85760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6014805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610e275760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6009805460ff1916911515919091179055565b6001546001600160a01b03163314610e8a5760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b601480546001600160a01b0393841673ffffffffffffffffffffffffffffffffffffffff199182161790915560158054929093169116179055565b6001546001600160a01b03163314610f155760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60095460009060ff1615610f8d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b3360009081526017602052604090205460ff1615610fdf5760405162461bcd60e51b815260206004820152600f60248201526e1059191c995cdcc8109b1bd8dad959608a1b604482015260640161090d565b6001600160a01b0384166000908152600b6020908152604080832033845290915290205460001914611044576001600160a01b0384166000908152600b602090815260408083203384529091528120805484929061103e90849061391d565b90915550505b61104f8484846127ad565b5060019392505050565b600260105414156110ac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161090d565b600260105560095460ff16156110f75760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b3360009081526017602052604090205460ff16156111495760405162461bcd60e51b815260206004820152600f60248201526e1059191c995cdcc8109b1bd8dad959608a1b604482015260640161090d565b600061115433611361565b9050600061116133611d8d565b905060008151116111b45760405162461bcd60e51b815260206004820152601c60248201527f53656e64657220686173206e6f207374616b6564204861626962697a00000000604482015260640161090d565b600082116112045760405162461bcd60e51b815260206004820152601060248201527f4e6f20636c61696d61626c65204f696c00000000000000000000000000000000604482015260640161090d565b60005b815181101561133657600960029054906101000a90046001600160a01b03166001600160a01b03166323b872dd30338585815181106112485761124861397b565b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b1580156112ba57600080fd5b505af11580156112ce573d6000803e3d6000fd5b5050336000908152600e60205260409020805490925083915081106112f5576112f561397b565b9060005260206000209060020201600101548282815181106113195761131961397b565b60209081029190910101528061132e81613934565b915050611207565b506113413382612a12565b336000818152600e6020526040902042600190910155610cd09083612baa565b60008061136d83611ba7565b905060005b6001600160a01b0384166000908152600e6020526040902054811015611443576001600160a01b0384166000908152600e602052604081208054839081106113bc576113bc61397b565b6000918252602080832060016002909302018201546001600160a01b0389168452600e909152604090922090810154815492935061142392849290869081106114075761140761397b565b9060005260206000209060020201600001544287601154612c16565b61142d90856138c4565b935050808061143b90613934565b915050611372565b5050919050565b336000908152600c602052604090205460ff166114a95760405162461bcd60e51b815260206004820152601960248201527f464f5242494444454e20544f204d494e54204f52204255524e00000000000000604482015260640161090d565b6114b38282612baa565b5050565b6001546001600160a01b031633146115075760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b600980546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6001546001600160a01b031633146115975760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6001805473ffffffffffffffffffffffffffffffffffffffff1990811633178255600280546001600160a01b039485169216919091179055600980549390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909316929092179055613a98600f55601055565b600260105414156116645760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161090d565b600260105560095460ff16156116af5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b3360009081526017602052604090205460ff16156117015760405162461bcd60e51b815260206004820152600f60248201526e1059191c995cdcc8109b1bd8dad959608a1b604482015260640161090d565b600061170c33611361565b905060005b828110156118c9576000805b336000908152600e60205260409020548110156117b5578585848181106117465761174661397b565b90506020020135600e6000336001600160a01b03166001600160a01b0316815260200190815260200160002060000182815481106117865761178661397b565b90600052602060002090600202016001015414156117a357600191505b806117ad81613934565b91505061171d565b50806118035760405162461bcd60e51b815260206004820152601960248201527f544f4b454e204e4f54204f574e45442042592053454e44455200000000000000604482015260640161090d565b6009546201000090046001600160a01b03166323b872dd303388888781811061182e5761182e61397b565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b15801561189d57600080fd5b505af11580156118b1573d6000803e3d6000fd5b505050505080806118c190613934565b915050611711565b5061190733848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612a1292505050565b336000818152600e60205260409020426001909101556119279082612baa565b5050600160105550565b600260105414156119845760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161090d565b600260105560095460ff16156119cf5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b3360009081526017602052604090205460ff1615611a215760405162461bcd60e51b815260206004820152600f60248201526e1059191c995cdcc8109b1bd8dad959608a1b604482015260640161090d565b6000611a2c33611361565b90508015611a5957336000818152600e6020526040902042600190910155611a549082612baa565b611aa1565b60405162461bcd60e51b815260206004820152600e60248201527f4e6f7420656e6f756768206f696c000000000000000000000000000000000000604482015260640161090d565b506001601055565b6001546001600160a01b03163314611af95760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b03163314611b785760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6015805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600e60205260408120546005811015611bd25750600092915050565b600a811015611be45750600f92915050565b6014811015611bf65750601992915050565b50602392915050565b6001546001600160a01b0316331415611c97576001600160a01b03821660009081526012602052604090205474010000000000000000000000000000000000000000900460ff16611c925760405162461bcd60e51b815260206004820152601e60248201527f41646d696e206973206e6f7420616c6c6f77656420746f207265766f6b650000604482015260640161090d565b611d00565b6001600160a01b03828116600090815260126020526040902054163314611d005760405162461bcd60e51b815260206004820152601560248201527f53656e646572206973206e6f74207265766f6b65720000000000000000000000604482015260640161090d565b80611d4d5760405162461bcd60e51b815260206004820152600f60248201527f446964206e6f7420636f6e6669726d0000000000000000000000000000000000604482015260640161090d565b506001600160a01b0316600090815260126020526040902080547fffffffffffffffffffffff000000000000000000000000000000000000000000169055565b6001600160a01b0381166000908152600e60205260408120546060919067ffffffffffffffff811115611dc257611dc2613991565b604051908082528060200260200182016040528015611deb578160200160208202803683370190505b50905060005b6001600160a01b0384166000908152600e6020526040902054811015611e7c576001600160a01b0384166000908152600e60205260409020805482908110611e3b57611e3b61397b565b906000526020600020906002020160010154828281518110611e5f57611e5f61397b565b602090810291909101015280611e7481613934565b915050611df1565b5092915050565b6040805180820182526060808252600060208084018290526001600160a01b0386168252600e8152848220855181549283028101850187529586018281529495949093859391928592909185015b82821015611f1757838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611ed1565b5050505081526020016001820154815250509050919050565b6001546001600160a01b03163314611f805760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b600f55565b60095460ff1615611fcb5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b6009546040517f438b63000000000000000000000000000000000000000000000000000000000081523360048201526000916201000090046001600160a01b03169063438b63009060240160006040518083038186803b15801561202e57600080fd5b505afa158015612042573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261206a9190810190613621565b905060008151116120bd5760405162461bcd60e51b815260206004820152601c60248201527f53656e64657220686173206e6f207374616b6564204861626962697a00000000604482015260640161090d565b6120c6816109b4565b50565b336000908152600c602052604090205460ff166121285760405162461bcd60e51b815260206004820152601960248201527f464f5242494444454e20544f204d494e54204f52204255524e00000000000000604482015260640161090d565b6114b38282612d7a565b6001546001600160a01b031633146121825760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b601155565b60095460009060ff16156121d05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161090d565b3360009081526017602052604090205460ff16156122225760405162461bcd60e51b815260206004820152600f60248201526e1059191c995cdcc8109b1bd8dad959608a1b604482015260640161090d565b61222d3384846127ad565b50600192915050565b6001546001600160a01b031633146122865760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b600380546001600160a01b0393841673ffffffffffffffffffffffffffffffffffffffff199182161790915560138054929093169116179055565b6001546001600160a01b031633146123115760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b6001546001600160a01b0316331461238c5760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b6001600160a01b03848116600090815260126020526040902054166123f35760405162461bcd60e51b815260206004820181905260248201527f5573657220686173206e6f74206f707465642d696e20666f7220726573637565604482015260640161090d565b60006123fe85611d8d565b905060005b828110156124cd576000805b835181101561246c5783818151811061242a5761242a61397b565b60200260200101518686858181106124445761244461397b565b90506020020135141561245a576001915061246c565b8061246481613934565b91505061240f565b50806124ba5760405162461bcd60e51b815260206004820152601160248201527f546f6b656e4944206e6f7420666f756e64000000000000000000000000000000604482015260640161090d565b50806124c581613934565b915050612403565b5061250b85848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612a1292505050565b60005b82811015612598576001600160a01b0385166000908152600e60209081526040918290208251808401909352428352919081018686858181106125535761255361397b565b6020908102929092013590925283546001818101865560009586529482902084516002909202019081559201519190920155508061259081613934565b91505061250e565b505050505050565b816125ed5760405162461bcd60e51b815260206004820152600f60248201527f446964206e6f7420636f6e6669726d0000000000000000000000000000000000604482015260640161090d565b6001600160a01b0383166126435760405162461bcd60e51b815260206004820152601e60248201527f5265766f6b65722063616e6e6f74206265206e756c6c20616464726573730000604482015260640161090d565b6040805180820182526001600160a01b0394851681529115156020808401918252336000908152601290915291909120915182549151151574010000000000000000000000000000000000000000027fffffffffffffffffffffff0000000000000000000000000000000000000000009092169416939093179290921790915550565b6001546001600160a01b031633146127165760405162461bcd60e51b81526020600482015260136024820152724e4f5420414c4c4f57454420544f2052554c4560681b604482015260640161090d565b60005b838110156109ad578282828181106127335761273361397b565b905060200201602081019061274891906136ad565b6017600087878581811061275e5761275e61397b565b9050602002016020810190612773919061331d565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806127a581613934565b915050612719565b6001600160a01b0383166000908152600a602052604090205481111561283b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161090d565b60035460009081906001600160a01b03858116911614801561287457506001600160a01b0384166000908152600a602052604090205415155b806128ae57506013546001600160a01b0385811691161480156128ae57506001600160a01b0384166000908152600a602052604090205415155b80156128c25750600954610100900460ff16155b90508080156128ea57506001600160a01b03851660009081526016602052604090205460ff16155b1561295057620186a0600f548461290191906138fe565b61290b91906138dc565b9150811561295057306000908152600a6020526040812080548492906129329084906138c4565b909155505060025461295090859084906001600160a01b0316612dee565b600061295c838561391d565b6001600160a01b0387166000908152600a602052604081208054929350869290919061298990849061391d565b90915550506001600160a01b0385166000908152600a6020526040812080548392906129b69084906138c4565b92505081905550846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612a0291815260200190565b60405180910390a3505050505050565b60005b8151811015612ba55760005b6001600160a01b0384166000908152600e6020526040902054811015612b92576001600160a01b0384166000908152600e60205260409020805482908110612a6b57612a6b61397b565b906000526020600020906002020160010154838381518110612a8f57612a8f61397b565b60200260200101511415612b80576001600160a01b0384166000908152600e602052604090208054612ac39060019061391d565b81548110612ad357612ad361397b565b9060005260206000209060020201600e6000866001600160a01b03166001600160a01b031681526020019081526020016000206000018281548110612b1a57612b1a61397b565b60009182526020808320845460029093020191825560019384015493909101929092556001600160a01b0386168152600e90915260409020805480612b6157612b61613965565b6000828152602081206002600019909301928302018181556001015590555b80612b8a81613934565b915050612a21565b5080612b9d81613934565b915050612a15565b505050565b8060056000828254612bbc91906138c4565b90915550506001600160a01b0382166000818152600a60209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35050565b60008060018180612c27898961391d565b9050888a1015612c35578899505b612c3f8a8961391d565b91506213c68081101580612c535750858911155b15612c5d57600292505b6276a7008110612c705760649350612ccf565b60025b6004811015612ccd576000612c8b826213c6806138fe565b9050600081118015612c9d5750828111155b15612cb457612cad86600f6138c4565b9550612cba565b50612ccd565b5080612cc581613934565b915050612c73565b505b612cd88b61301f565b15612d10576201518083612cf58468878678326eac9000006138fe565b612cff91906138fe565b612d0991906138dc565b9450612d4b565b612d1a87856138c4565b93506201518083612d3484681b1ae4d6e2ef5000006138fe565b612d3e91906138fe565b612d4891906138dc565b94505b6064612d5785876138fe565b612d6191906138dc565b612d6b90866138c4565b9b9a5050505050505050505050565b6001600160a01b0382166000908152600a602052604081208054839290612da290849061391d565b90915550506005805482900390556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001612c0a565b6009805461ff0019166101001790556000612e0884613297565b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101859052909150309063095ea7b390604401602060405180830381600087803b158015612e6c57600080fd5b505af1158015612e80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ea491906136ca565b506040805160028082526060820183526000926020830190803683370190505090503081600081518110612eda57612eda61397b565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612f3357600080fd5b505afa158015612f47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6b9190613341565b81600181518110612f7e57612f7e61397b565b6001600160a01b0392831660209182029290920101526040517f791ac9470000000000000000000000000000000000000000000000000000000081529083169063791ac94790612fdb9087906001908690899042906004016137fe565b600060405180830381600087803b158015612ff557600080fd5b505af1158015613009573d6000803e3d6000fd5b50506009805461ff001916905550505050505050565b60008160281480613030575081606c145b8061303b57508160a9145b8061304657508160bf145b8061305157508160f6145b8061305d575081610101145b8061306957508161013f145b80613075575081610182145b806130815750816101f0145b8061308d575081610232145b8061309957508161027d145b806130a55750816102b4145b806130b1575081610340145b806130bd5750816103ae145b806130c95750816103af145b806130d55750816103bd145b806130e157508161044c145b806130ed575081610454145b806130f9575081610491145b8061310557508161049a145b8061311157508161065b145b8061311d5750816106aa145b80613129575081610733145b8061313557508161075c145b80613141575081610859145b8061314d57508161086e145b80613159575081610875145b806131655750816108a6145b806131715750816108b8145b8061317d5750816108be145b806131895750816109cc145b80613195575081610a45145b806131a1575081610b2f145b806131ad575081610bef145b806131b9575081610c01145b806131c5575081610cd0145b806131d1575081610ce1145b806131dd575081610cfa145b806131e9575081610cff145b806131f5575081610d21145b80613201575081610d53145b8061320d575081610e15145b80613219575081610e37145b80613225575081610ebe145b8061323157508161109a145b8061323d5750816110ab145b806132495750816110ce145b8061325557508161110a145b8061326157508161111e145b8061326d57508161112d145b80613279575081611243145b80613285575081611263145b806132915750816112ff145b92915050565b6003546000906001600160a01b038381169116146132c0576015546001600160a01b0316613291565b50506014546001600160a01b031690565b60008083601f8401126132e357600080fd5b50813567ffffffffffffffff8111156132fb57600080fd5b6020830191508360208260051b850101111561331657600080fd5b9250929050565b60006020828403121561332f57600080fd5b813561333a816139a7565b9392505050565b60006020828403121561335357600080fd5b815161333a816139a7565b6000806040838503121561337157600080fd5b823561337c816139a7565b9150602083013561338c816139a7565b809150509250929050565b600080600080606085870312156133ad57600080fd5b84356133b8816139a7565b935060208501356133c8816139a7565b9250604085013567ffffffffffffffff8111156133e457600080fd5b6133f0878288016132d1565b95989497509550505050565b60008060006060848603121561341157600080fd5b833561341c816139a7565b9250602084013561342c816139a7565b929592945050506040919091013590565b6000806040838503121561345057600080fd5b823561345b816139a7565b9150602083013561338c816139bc565b60008060006060848603121561348057600080fd5b833561348b816139a7565b9250602084013561349b816139bc565b915060408401356134ab816139bc565b809150509250925092565b600080604083850312156134c957600080fd5b82356134d4816139a7565b946020939093013593505050565b600080600080604085870312156134f857600080fd5b843567ffffffffffffffff8082111561351057600080fd5b61351c888389016132d1565b9096509450602087013591508082111561353557600080fd5b506133f0878288016132d1565b6000806020838503121561355557600080fd5b823567ffffffffffffffff81111561356c57600080fd5b613578858286016132d1565b90969095509350505050565b6000602080838503121561359757600080fd5b823567ffffffffffffffff8111156135ae57600080fd5b8301601f810185136135bf57600080fd5b80356135d26135cd826138a0565b61386f565b80828252848201915084840188868560051b87010111156135f257600080fd5b600094505b838510156136155780358352600194909401939185019185016135f7565b50979650505050505050565b6000602080838503121561363457600080fd5b825167ffffffffffffffff81111561364b57600080fd5b8301601f8101851361365c57600080fd5b805161366a6135cd826138a0565b80828252848201915084840188868560051b870101111561368a57600080fd5b600094505b8385101561361557805183526001949094019391850191850161368f565b6000602082840312156136bf57600080fd5b813561333a816139bc565b6000602082840312156136dc57600080fd5b815161333a816139bc565b6000602082840312156136f957600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156137385783518352928401929184019160010161371c565b50909695505050505050565b600060208083528351808285015260005b8181101561377157858101830151858201604001528201613755565b81811115613783576000604083870101525b50601f01601f1916929092016040019392505050565b60208082528251604083830181905281516060850181905260009392830191849160808701905b808410156137e957845180518352860151868301529385019360019390930192908201906137c0565b50939096015194909501939093529392505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561384e5784516001600160a01b031683529383019391830191600101613829565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561389857613898613991565b604052919050565b600067ffffffffffffffff8211156138ba576138ba613991565b5060051b60200190565b600082198211156138d7576138d761394f565b500190565b6000826138f957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156139185761391861394f565b500290565b60008282101561392f5761392f61394f565b500390565b60006000198214156139485761394861394f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146120c657600080fd5b80151581146120c657600080fdfea2646970667358221220a0139d0b4aedba2fe85e93076306d8f29b9bc620757fade0dcdead9e10f47fb764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,941 |
0x8a788378157e4b2b926b4bb12b04b9087b65a14b
|
pragma solidity 0.5.17;
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);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "permission denied");
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "invalid address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20 {
using SafeMath for uint256;
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);
uint256 internal _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 A 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 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) {
_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) {
_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) {
if (from != msg.sender && _allowed[from][msg.sender] != uint256(-1))
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
contract ERC20Mintable is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function _mint(address to, uint256 amount) internal {
_balances[to] = _balances[to].add(amount);
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal {
_balances[from] = _balances[from].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(from, address(0), amount);
}
}
contract BIXb is ERC20Mintable, Ownable {
using SafeMath for uint256;
mapping (address => bool) public isMinter;
constructor() public {
name = "bixbite.finance";
symbol = "BIXb";
decimals = 18;
}
function setMinter(address minter, bool flag) external onlyOwner {
isMinter[minter] = flag;
}
function mint(address to, uint256 amount) external {
require(isMinter[msg.sender], "Not Minter");
_mint(to, amount);
}
function burn(address from, uint256 amount) external {
if (from != msg.sender && _allowed[from][msg.sender] != uint256(-1))
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(amount);
require(_balances[from] >= amount, "insufficient-balance");
_burn(from, amount);
}
}
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;
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
contract BixbiteFarming is Ownable {
using SafeMath for uint256;
BIXb public bixb; //white bixb
IUniswapV2Pair public cBIXb; //colored bixb
ERC20 public token; //token
uint256 public today;
uint256 public spawnRate;
uint256 public withdrawRate;
uint256 public timeLock;
uint256 internal _totalSupply;
mapping(address => uint256) internal _balances;
mapping(address => uint256) public depositTimeStamp;
constructor(uint256 _spawnRate, uint256 _withdrawRate, uint256 _timeLock, address _bixb, address _cBIXb, address _token) public {
today = now / 1 days;
spawnRate = _spawnRate;
withdrawRate = _withdrawRate;
timeLock = _timeLock;
bixb = BIXb(_bixb);
cBIXb = IUniswapV2Pair(_cBIXb);
token = ERC20(_token);
}
function setParams(uint256 _spawnRate, uint256 _withdrawRate, uint256 _timeLock) external onlyOwner {
require(_spawnRate <= 0.1e18);
require(_withdrawRate >= 0.85e18 && _withdrawRate <= 1e18);
require(_timeLock <= 15 days);
spawnRate = _spawnRate;
withdrawRate = _withdrawRate;
timeLock = _timeLock;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function totalValue() public view returns(uint256) {
return cBIXb.balanceOf(address(this));
}
function deposit(uint256 amount) external returns (uint256 share) {
if(totalSupply() > 0)
share = totalSupply().mul(amount).div(totalValue());
else
share = amount;
_balances[msg.sender] = _balances[msg.sender].add(share);
depositTimeStamp[msg.sender] = now;
_totalSupply = _totalSupply.add(share);
require(cBIXb.transferFrom(msg.sender, address(this), amount));
}
function withdraw(address to, uint256 share) external returns (uint256 amount) {
require(depositTimeStamp[msg.sender].add(timeLock) <= now, "locked");
amount = share.mul(totalValue()).div(totalSupply());
if(share < _totalSupply)
amount = amount.mul(withdrawRate).div(1e18);
_balances[msg.sender] = _balances[msg.sender].sub(share);
_totalSupply = _totalSupply.sub(share);
require(cBIXb.transfer(to, amount));
}
function rescueToken(ERC20 _token, uint256 _amount) onlyOwner public {
require(_token != ERC20(address(cBIXb)));
_token.transfer(msg.sender, _amount);
}
function farming() external {
require(now / 1 days > today);
today += 1;
uint256 bixbPairAmount = bixb.balanceOf(address(cBIXb));
uint256 tokenPairAmount = token.balanceOf(address(cBIXb));
uint256 newBIXb = bixbPairAmount.mul(spawnRate).div(1e18);
uint256 amount = UniswapV2Library.getAmountOut(newBIXb, bixbPairAmount, tokenPairAmount);
bixb.mint(address(cBIXb), newBIXb);
if(address(bixb) < address(token))
cBIXb.swap(0, amount, address(this), "");
else
cBIXb.swap(amount, 0, address(this), "");
token.transfer(address(cBIXb), amount);
bixb.mint(address(cBIXb), newBIXb);
cBIXb.mint(address(this));
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063d4c3eea011610071578063d4c3eea0146103c3578063dff05f82146103e1578063f2fde38b14610439578063f3fef3a31461047d578063fc0c546a146104df57610116565b80638da5cb5b146102fb578063b6b55f2514610345578063b74e452b14610387578063d085835a146103a557610116565b80633db18f4d116100e95780633db18f4d146101ef5780634e3ad80f1461020d5780635a0ce6761461021757806370a0823114610259578063820490a1146102b157610116565b80630dcf14171461011b57806318160ddd1461013957806333f3d6281461015757806336e2ca4e146101a5575b600080fd5b610123610529565b6040518082815260200191505060405180910390f35b61014161052f565b6040518082815260200191505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610539565b005b6101ad61071d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101f7610743565b6040518082815260200191505060405180910390f35b610215610749565b005b6102576004803603606081101561022d57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610fa0565b005b61029b6004803603602081101561026f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110ca565b6040518082815260200191505060405180910390f35b6102b9611113565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610303611139565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103716004803603602081101561035b57600080fd5b810190808035906020019092919050505061115e565b6040518082815260200191505060405180910390f35b61038f6113c7565b6040518082815260200191505060405180910390f35b6103ad6113cd565b6040518082815260200191505060405180910390f35b6103cb6113d3565b6040518082815260200191505060405180910390f35b610423600480360360208110156103f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b4565b6040518082815260200191505060405180910390f35b61047b6004803603602081101561044f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114cc565b005b6104c96004803603604081101561049357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116ef565b6040518082815260200191505060405180910390f35b6104e76119ce565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60065481565b6000600854905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f7065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561065657600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156106dd57600080fd5b505af11580156106f1573d6000803e3d6000fd5b505050506040513d602081101561070757600080fd5b8101908080519060200190929190505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60045462015180428161075857fe5b041161076357600080fd5b60016004600082825401925050819055506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561083757600080fd5b505afa15801561084b573d6000803e3d6000fd5b505050506040513d602081101561086157600080fd5b810190808051906020019092919050505090506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561093757600080fd5b505afa15801561094b573d6000803e3d6000fd5b505050506040513d602081101561096157600080fd5b8101908080519060200190929190505050905060006109a5670de0b6b3a7640000610997600554866119f490919063ffffffff16565b611a2e90919063ffffffff16565b905060006109b4828585611a54565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610a8157600080fd5b505af1158015610a95573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161015610bf457600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663022c0d9f600083306040518463ffffffff1660e01b8152600401808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825260008152602001602001945050505050600060405180830381600087803b158015610bd757600080fd5b505af1158015610beb573d6000803e3d6000fd5b50505050610cd3565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663022c0d9f826000306040518463ffffffff1660e01b8152600401808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825260008152602001602001945050505050600060405180830381600087803b158015610cba57600080fd5b505af1158015610cce573d6000803e3d6000fd5b505050505b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d9e57600080fd5b505af1158015610db2573d6000803e3d6000fd5b505050506040513d6020811015610dc857600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ea557600080fd5b505af1158015610eb9573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636a627842306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610f5e57600080fd5b505af1158015610f72573d6000803e3d6000fd5b505050506040513d6020811015610f8857600080fd5b81019080805190602001909291905050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611062576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f7065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b67016345785d8a000083111561107757600080fd5b670bcbce7f1b15000082101580156110975750670de0b6b3a76400008211155b6110a057600080fd5b6213c6808111156110b057600080fd5b826005819055508160068190555080600781905550505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008061116961052f565b11156111a9576111a261117a6113d3565b6111948461118661052f565b6119f490919063ffffffff16565b611a2e90919063ffffffff16565b90506111ad565b8190505b6111ff81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061129b81600854611b8490919063ffffffff16565b600881905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561137e57600080fd5b505af1158015611392573d6000803e3d6000fd5b505050506040513d60208110156113a857600080fd5b81019080805190602001909291905050506113c257600080fd5b919050565b60045481565b60075481565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561147457600080fd5b505afa158015611488573d6000803e3d6000fd5b505050506040513d602081101561149e57600080fd5b8101908080519060200190929190505050905090565b600a6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461158e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f7065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f696e76616c69642061646472657373000000000000000000000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600042611746600754600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8490919063ffffffff16565b11156117ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f6c6f636b6564000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6117ed6117c561052f565b6117df6117d06113d3565b856119f490919063ffffffff16565b611a2e90919063ffffffff16565b905060085482101561182b57611828670de0b6b3a764000061181a600654846119f490919063ffffffff16565b611a2e90919063ffffffff16565b90505b61187d82600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ba390919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118d582600854611ba390919063ffffffff16565b600881905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561198457600080fd5b505af1158015611998573d6000803e3d6000fd5b505050506040513d60208110156119ae57600080fd5b81019080805190602001909291905050506119c857600080fd5b92915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080831415611a075760009050611a28565b6000828402905082848281611a1857fe5b0414611a2357600080fd5b809150505b92915050565b6000808211611a3c57600080fd5b6000828481611a4757fe5b0490508091505092915050565b6000808411611aae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611bec602b913960400191505060405180910390fd5b600083118015611abe5750600082115b611b13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180611bc46028913960400191505060405180910390fd5b6000611b2a6103e5866119f490919063ffffffff16565b90506000611b4184836119f490919063ffffffff16565b90506000611b6c83611b5e6103e8896119f490919063ffffffff16565b611b8490919063ffffffff16565b9050808281611b7757fe5b0493505050509392505050565b600080828401905083811015611b9957600080fd5b8091505092915050565b600082821115611bb257600080fd5b60008284039050809150509291505056fe556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a265627a7a72315820b9b616d682ca00deb1154c7c28912b510807707b54b22a63c16a65651d94cd7a64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,942 |
0x3C17302A5208A3600AAD76115f9A22B2F7AcE702
|
// GLAUBER INU ($GLAUBER)
//Glauber is the first dogecoin millionarie. Why can't you be like that?
//Buy $GLAUBER and you are the next Glauber.
//Telegram: https://t.me/glauberinutoken
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract GlauberInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Glauber Inu - t.me/glauberinutoken";
string private constant _symbol = "GLAUBER";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (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 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 = 4000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102be578063a9059cbb146102ee578063c3c8cd801461030e578063d543dbeb14610323578063dd62ed3e1461034357600080fd5b80636fc3eaec1461024c57806370a0823114610261578063715018a6146102815780638da5cb5b1461029657600080fd5b806323b872dd116100dc57806323b872dd146101bb578063293230b8146101db578063313ce567146101f05780635932ead11461020c5780636b9990531461022c57600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461016557806318160ddd1461019557600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118b3565b610389565b005b34801561014657600080fd5b5061014f610436565b60405161015c91906119f7565b60405180910390f35b34801561017157600080fd5b50610185610180366004611888565b610456565b604051901515815260200161015c565b3480156101a157600080fd5b50683635c9adc5dea000005b60405190815260200161015c565b3480156101c757600080fd5b506101856101d6366004611848565b61046d565b3480156101e757600080fd5b506101386104d6565b3480156101fc57600080fd5b506040516009815260200161015c565b34801561021857600080fd5b5061013861022736600461197a565b610899565b34801561023857600080fd5b506101386102473660046117d8565b6108e1565b34801561025857600080fd5b5061013861092c565b34801561026d57600080fd5b506101ad61027c3660046117d8565b610959565b34801561028d57600080fd5b5061013861097b565b3480156102a257600080fd5b506000546040516001600160a01b03909116815260200161015c565b3480156102ca57600080fd5b5060408051808201909152600781526623a620aaa122a960c91b602082015261014f565b3480156102fa57600080fd5b50610185610309366004611888565b6109ef565b34801561031a57600080fd5b506101386109fc565b34801561032f57600080fd5b5061013861033e3660046119b2565b610a32565b34801561034f57600080fd5b506101ad61035e366004611810565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103bc5760405162461bcd60e51b81526004016103b390611a4a565b60405180910390fd5b60005b8151811015610432576001600a60008484815181106103ee57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061042a81611b5d565b9150506103bf565b5050565b6060604051806060016040528060228152602001611bf060229139905090565b6000610463338484610b05565b5060015b92915050565b600061047a848484610c29565b6104cc84336104c785604051806060016040528060288152602001611bc8602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061103b565b610b05565b5060019392505050565b6000546001600160a01b031633146105005760405162461bcd60e51b81526004016103b390611a4a565b600f54600160a01b900460ff161561055a5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103b3565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105973082683635c9adc5dea00000610b05565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d057600080fd5b505afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060891906117f4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561065057600080fd5b505afa158015610664573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068891906117f4565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106d057600080fd5b505af11580156106e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070891906117f4565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061073881610959565b60008061074d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107b057600080fd5b505af11580156107c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107e991906119ca565b5050600f8054673782dace9d90000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561086157600080fd5b505af1158015610875573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104329190611996565b6000546001600160a01b031633146108c35760405162461bcd60e51b81526004016103b390611a4a565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461090b5760405162461bcd60e51b81526004016103b390611a4a565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461094c57600080fd5b4761095681611075565b50565b6001600160a01b038116600090815260026020526040812054610467906110fa565b6000546001600160a01b031633146109a55760405162461bcd60e51b81526004016103b390611a4a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610463338484610c29565b600c546001600160a01b0316336001600160a01b031614610a1c57600080fd5b6000610a2730610959565b90506109568161117e565b6000546001600160a01b03163314610a5c5760405162461bcd60e51b81526004016103b390611a4a565b60008111610aac5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103b3565b610aca6064610ac4683635c9adc5dea0000084611323565b906113a2565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b675760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b3565b6001600160a01b038216610bc85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c8d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103b3565b6001600160a01b038216610cef5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103b3565b60008111610d515760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103b3565b6000546001600160a01b03848116911614801590610d7d57506000546001600160a01b03838116911614155b15610fde57600f54600160b81b900460ff1615610e64576001600160a01b0383163014801590610db657506001600160a01b0382163014155b8015610dd05750600e546001600160a01b03848116911614155b8015610dea5750600e546001600160a01b03838116911614155b15610e6457600e546001600160a01b0316336001600160a01b03161480610e245750600f546001600160a01b0316336001600160a01b0316145b610e645760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103b3565b601054811115610e7357600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eb557506001600160a01b0382166000908152600a602052604090205460ff16155b610ebe57600080fd5b600f546001600160a01b038481169116148015610ee95750600e546001600160a01b03838116911614155b8015610f0e57506001600160a01b03821660009081526005602052604090205460ff16155b8015610f235750600f54600160b81b900460ff165b15610f71576001600160a01b0382166000908152600b60205260409020544211610f4c57600080fd5b610f5742603c611aef565b6001600160a01b0383166000908152600b60205260409020555b6000610f7c30610959565b600f54909150600160a81b900460ff16158015610fa75750600f546001600160a01b03858116911614155b8015610fbc5750600f54600160b01b900460ff165b15610fdc57610fca8161117e565b478015610fda57610fda47611075565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061102057506001600160a01b03831660009081526005602052604090205460ff165b15611029575060005b611035848484846113e4565b50505050565b6000818484111561105f5760405162461bcd60e51b81526004016103b391906119f7565b50600061106c8486611b46565b95945050505050565b600c546001600160a01b03166108fc61108f8360026113a2565b6040518115909202916000818181858888f193505050501580156110b7573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110d28360026113a2565b6040518115909202916000818181858888f19350505050158015610432573d6000803e3d6000fd5b60006006548211156111615760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103b3565b600061116b611410565b905061117783826113a2565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111d457634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122857600080fd5b505afa15801561123c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126091906117f4565b8160018151811061128157634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a79130911684610b05565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112e0908590600090869030904290600401611a7f565b600060405180830381600087803b1580156112fa57600080fd5b505af115801561130e573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261133257506000610467565b600061133e8385611b27565b90508261134b8583611b07565b146111775760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103b3565b600061117783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611433565b806113f1576113f1611461565b6113fc848484611484565b80611035576110356005600855600a600955565b600080600061141d61157b565b909250905061142c82826113a2565b9250505090565b600081836114545760405162461bcd60e51b81526004016103b391906119f7565b50600061106c8486611b07565b6008541580156114715750600954155b1561147857565b60006008819055600955565b600080600080600080611496876115bd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c8908761161a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f7908661165c565b6001600160a01b038916600090815260026020526040902055611519816116bb565b6115238483611705565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156891815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061159782826113a2565b8210156115b457505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115da8a600854600954611729565b92509250925060006115ea611410565b905060008060006115fd8e878787611778565b919e509c509a509598509396509194505050505091939550919395565b600061117783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061103b565b6000806116698385611aef565b9050838110156111775760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103b3565b60006116c5611410565b905060006116d38383611323565b306000908152600260205260409020549091506116f0908261165c565b30600090815260026020526040902055505050565b600654611712908361161a565b600655600754611722908261165c565b6007555050565b600080808061173d6064610ac48989611323565b905060006117506064610ac48a89611323565b90506000611768826117628b8661161a565b9061161a565b9992985090965090945050505050565b60008080806117878886611323565b905060006117958887611323565b905060006117a38888611323565b905060006117b582611762868661161a565b939b939a50919850919650505050505050565b80356117d381611ba4565b919050565b6000602082840312156117e9578081fd5b813561117781611ba4565b600060208284031215611805578081fd5b815161117781611ba4565b60008060408385031215611822578081fd5b823561182d81611ba4565b9150602083013561183d81611ba4565b809150509250929050565b60008060006060848603121561185c578081fd5b833561186781611ba4565b9250602084013561187781611ba4565b929592945050506040919091013590565b6000806040838503121561189a578182fd5b82356118a581611ba4565b946020939093013593505050565b600060208083850312156118c5578182fd5b823567ffffffffffffffff808211156118dc578384fd5b818501915085601f8301126118ef578384fd5b81358181111561190157611901611b8e565b8060051b604051601f19603f8301168101818110858211171561192657611926611b8e565b604052828152858101935084860182860187018a1015611944578788fd5b8795505b8386101561196d57611959816117c8565b855260019590950194938601938601611948565b5098975050505050505050565b60006020828403121561198b578081fd5b813561117781611bb9565b6000602082840312156119a7578081fd5b815161117781611bb9565b6000602082840312156119c3578081fd5b5035919050565b6000806000606084860312156119de578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a2357858101830151858201604001528201611a07565b81811115611a345783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ace5784516001600160a01b031683529383019391830191600101611aa9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0257611b02611b78565b500190565b600082611b2257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4157611b41611b78565b500290565b600082821015611b5857611b58611b78565b500390565b6000600019821415611b7157611b71611b78565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461095657600080fd5b801515811461095657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365476c617562657220496e75202d20742e6d652f676c6175626572696e75746f6b656ea2646970667358221220a41cb50711d84d41dd7888516c8deb34068cb65afd643a5d31d19759201746bd64736f6c63430008040033
|
{"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"}]}}
| 2,943 |
0x16f5E8ad38cf676a0a78436ED8F5C8c19dA3be3d
|
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
/**
* @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 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;
}
}
contract Governance is ReentrancyGuard {
uint constant public governance_challenging_period = 10 days;
uint constant public governance_freeze_period = 30 days;
address public votingTokenAddress;
address public governedContractAddress;
mapping(address => uint) public balances;
VotedValue[] public votedValues;
mapping(string => VotedValue) public votedValuesMap;
constructor(address _governedContractAddress, address _votingTokenAddress){
init(_governedContractAddress, _votingTokenAddress);
}
function init(address _governedContractAddress, address _votingTokenAddress) public {
require(governedContractAddress == address(0), "governance already initialized");
governedContractAddress = _governedContractAddress;
votingTokenAddress = _votingTokenAddress;
}
function addressBelongsToGovernance(address addr) public view returns (bool) {
for (uint i = 0; i < votedValues.length; i++)
if (address(votedValues[i]) == addr)
return true;
return false;
}
function isUntiedFromAllVotes(address addr) public view returns (bool) {
for (uint i = 0; i < votedValues.length; i++)
if (votedValues[i].hasVote(addr))
return false;
return true;
}
function addVotedValue(string memory name, VotedValue votedValue) external {
require(msg.sender == governedContractAddress, "not authorized");
votedValues.push(votedValue);
votedValuesMap[name] = votedValue;
}
// deposit
function deposit(uint amount) payable external {
deposit(msg.sender, amount);
}
function deposit(address from, uint amount) nonReentrant payable public {
require(from == msg.sender || addressBelongsToGovernance(msg.sender), "not allowed");
if (votingTokenAddress == address(0))
require(msg.value == amount, "wrong amount received");
else {
require(msg.value == 0, "don't send ETH");
require(IERC20(votingTokenAddress).transferFrom(from, address(this), amount), "failed to pull gov deposit");
}
balances[from] += amount;
}
// withdrawal functions
function withdraw() external {
withdraw(balances[msg.sender]);
}
function withdraw(uint amount) nonReentrant public {
require(amount > 0, "zero withdrawal requested");
require(amount <= balances[msg.sender], "not enough balance");
require(isUntiedFromAllVotes(msg.sender), "some votes not removed yet");
balances[msg.sender] -= amount;
if (votingTokenAddress == address(0))
payable(msg.sender).transfer(amount);
else
require(IERC20(votingTokenAddress).transfer(msg.sender, amount), "failed to withdraw gov deposit");
}
}
abstract contract VotedValue is ReentrancyGuard {
Governance public governance;
uint public challenging_period_start_ts;
mapping(address => bool) public hasVote;
constructor(Governance _governance){
governance = _governance;
}
function checkVoteChangeLock() view public {
require(challenging_period_start_ts + governance.governance_challenging_period() + governance.governance_freeze_period() < block.timestamp, "you cannot change your vote yet");
}
function checkChallengingPeriodExpiry() view public {
require(block.timestamp > challenging_period_start_ts + governance.governance_challenging_period(), "challenging period not expired yet");
}
}
contract VotedValueUint is VotedValue {
function(uint) external validationCallback;
function(uint) external commitCallback;
uint public leader;
uint public current_value;
mapping(address => uint) public choices;
mapping(uint => uint) public votesByValue;
mapping(uint => mapping(address => uint)) public votesByValueAddress;
constructor() VotedValue(Governance(address(0))) {}
// constructor(Governance _governance, uint initial_value, function(uint) external _validationCallback, function(uint) external _commitCallback) VotedValue(_governance) {
// leader = initial_value;
// current_value = initial_value;
// validationCallback = _validationCallback;
// commitCallback = _commitCallback;
// }
function init(Governance _governance, uint initial_value, function(uint) external _validationCallback, function(uint) external _commitCallback) external {
require(address(governance) == address(0), "already initialized");
governance = _governance;
leader = initial_value;
current_value = initial_value;
validationCallback = _validationCallback;
commitCallback = _commitCallback;
}
function vote(uint value) nonReentrant external {
_vote(value);
}
function voteAndDeposit(uint value, uint amount) nonReentrant payable external {
governance.deposit{value: msg.value}(msg.sender, amount);
_vote(value);
}
function _vote(uint value) private {
validationCallback(value);
uint prev_choice = choices[msg.sender];
bool hadVote = hasVote[msg.sender];
if (prev_choice == leader)
checkVoteChangeLock();
// first, remove votes from the previous choice
if (hadVote)
removeVote(prev_choice);
// then, add them to the new choice
uint balance = governance.balances(msg.sender);
require(balance > 0, "no balance");
votesByValue[value] += balance;
votesByValueAddress[value][msg.sender] = balance;
choices[msg.sender] = value;
hasVote[msg.sender] = true;
// check if the leader has just changed
if (votesByValue[value] > votesByValue[leader]){
leader = value;
challenging_period_start_ts = block.timestamp;
}
}
function unvote() external {
if (!hasVote[msg.sender])
return;
uint prev_choice = choices[msg.sender];
if (prev_choice == leader)
checkVoteChangeLock();
removeVote(prev_choice);
delete choices[msg.sender];
delete hasVote[msg.sender];
}
function removeVote(uint value) internal {
votesByValue[value] -= votesByValueAddress[value][msg.sender];
votesByValueAddress[value][msg.sender] = 0;
}
function commit() nonReentrant external {
require(leader != current_value, "already equal to leader");
checkChallengingPeriodExpiry();
current_value = leader;
commitCallback(leader);
}
}
|
0x6080604052600436106100e85760003560e01c8063410346b31161008a5780639e69a874116100595780639e69a87414610268578063bc17a493146102a0578063bfb723b6146102b3578063e224f753146102c857600080fd5b8063410346b3146101ce57806350246b75146101fb5780635aa6e6751461021b57806362df40ea1461025357600080fd5b80633174b689116100c65780633174b68914610178578063345f2ffc1461018d5780633c7a3aff146101a357806340eedabb146101b857600080fd5b80630121b93f146100ed5780632243b09a1461010f57806327efa0aa14610154575b600080fd5b3480156100f957600080fd5b5061010d610108366004610b57565b6102f5565b005b34801561011b57600080fd5b5061013f61012a366004610aa6565b60036020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561016057600080fd5b5061016a60025481565b60405190815260200161014b565b34801561018457600080fd5b5061010d610337565b34801561019957600080fd5b5061016a60075481565b3480156101af57600080fd5b5061010d6103a2565b3480156101c457600080fd5b5061016a60065481565b3480156101da57600080fd5b5061016a6101e9366004610aa6565b60086020526000908152604090205481565b34801561020757600080fd5b5061010d610216366004610aca565b6104a6565b34801561022757600080fd5b5060015461023b906001600160a01b031681565b6040516001600160a01b03909116815260200161014b565b34801561025f57600080fd5b5061010d61056e565b34801561027457600080fd5b5061016a610283366004610b89565b600a60209081526000928352604080842090915290825290205481565b61010d6102ae366004610bb9565b6106d6565b3480156102bf57600080fd5b5061010d610776565b3480156102d457600080fd5b5061016a6102e3366004610b57565b60096020526000908152604090205481565b600260005414156103215760405162461bcd60e51b815260040161031890610bdb565b60405180910390fd5b600260005561032f81610862565b506001600055565b3360009081526003602052604090205460ff1661035057565b336000908152600860205260409020546006548114156103725761037261056e565b61037b81610a50565b5033600090815260086020908152604080832083905560039091529020805460ff19169055565b600260005414156103c55760405162461bcd60e51b815260040161031890610bdb565b6002600055600754600654141561041e5760405162461bcd60e51b815260206004820152601760248201527f616c726561647920657175616c20746f206c65616465720000000000000000006044820152606401610318565b610426610776565b60065460078190556005546040516001600160e01b031960e083901b1681526001600160a01b03602083901c169263ffffffff9092169161046d9160040190815260200190565b600060405180830381600087803b15801561048757600080fd5b505af115801561049b573d6000803e3d6000fd5b505060016000555050565b6001546001600160a01b0316156104f55760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610318565b600180546001600160a01b039097166001600160a01b031990971696909617909555600684905560079390935560048054640100000000600160c01b03602094851b811663ffffffff948516176001600160c01b031992831617909255600580549590941b909116949091169390931791909216179055565b6001546040805163055a4e9160e51b8152905142926001600160a01b03169163ab49d220916004808301926020929190829003018186803b1580156105b257600080fd5b505afa1580156105c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ea9190610b70565b600160009054906101000a90046001600160a01b03166001600160a01b031663623148336040518163ffffffff1660e01b815260040160206040518083038186803b15801561063857600080fd5b505afa15801561064c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106709190610b70565b60025461067d9190610c12565b6106879190610c12565b106106d45760405162461bcd60e51b815260206004820152601f60248201527f796f752063616e6e6f74206368616e676520796f757220766f746520796574006044820152606401610318565b565b600260005414156106f95760405162461bcd60e51b815260040161031890610bdb565b60026000556001546040516311f9fbc960e21b8152336004820152602481018390526001600160a01b03909116906347e7ef249034906044016000604051808303818588803b15801561074b57600080fd5b505af115801561075f573d6000803e3d6000fd5b505050505061076d82610862565b50506001600055565b600160009054906101000a90046001600160a01b03166001600160a01b031663623148336040518163ffffffff1660e01b815260040160206040518083038186803b1580156107c457600080fd5b505afa1580156107d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc9190610b70565b6002546108099190610c12565b42116106d45760405162461bcd60e51b815260206004820152602260248201527f6368616c6c656e67696e6720706572696f64206e6f7420657870697265642079604482015261195d60f21b6064820152608401610318565b6004805460405160e082901b6001600160e01b0319168152918201839052602081901c6001600160a01b03169163ffffffff90911690602401600060405180830381600087803b1580156108b557600080fd5b505af11580156108c9573d6000803e3d6000fd5b50503360009081526008602090815260408083205460039092529091205460065491935060ff1691508214156109015761090161056e565b80156109105761091082610a50565b6001546040516327e235e360e01b81523360048201526000916001600160a01b0316906327e235e39060240160206040518083038186803b15801561095457600080fd5b505afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190610b70565b9050600081116109cb5760405162461bcd60e51b815260206004820152600a6024820152696e6f2062616c616e636560b01b6044820152606401610318565b600084815260096020526040812080548392906109e9908490610c12565b90915550506000848152600a6020908152604080832033845282528083208490556008825280832087905560038252808320805460ff1916600117905560065483526009909152808220548683529120541115610a4a576006849055426002555b50505050565b6000818152600a6020908152604080832033845282528083205484845260099092528220805491929091610a85908490610c2a565b90915550506000908152600a60209081526040808320338452909152812055565b600060208284031215610ab857600080fd5b8135610ac381610c57565b9392505050565b60008060008060008060808789031215610ae357600080fd5b8635610aee81610c57565b955060208701359450604087013567ffffffffffffffff198082168214610b1457600080fd5b63ffffffff8260601c9650808360401c16955060608a013592508183168314610b3c57600080fd5b8260601c9450808360401c1693505050509295509295509295565b600060208284031215610b6957600080fd5b5035919050565b600060208284031215610b8257600080fd5b5051919050565b60008060408385031215610b9c57600080fd5b823591506020830135610bae81610c57565b809150509250929050565b60008060408385031215610bcc57600080fd5b50508035926020909101359150565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115610c2557610c25610c41565b500190565b600082821015610c3c57610c3c610c41565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610c6c57600080fd5b5056fea26469706673582212202e6f0958a8b372b77d30adc4c161030c9aaa9857b99b20f348897c4a4c50892d64736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 2,944 |
0x26755e612335b5c52eb80703a1abdf10a4fc069f
|
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
// SPDX-License-Identifier: UNLICENSED
/**
https://t.me/MoonKnightETH
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MoonKnight is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MoonKnight";
string private constant _symbol = "MK";
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;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xf25715dE76A4cf5a6b5aD1c0b309d539dbE298CE);
address payable private _marketingAddress = payable(0xf25715dE76A4cf5a6b5aD1c0b309d539dbE298CE);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000 * 10**9; //.5%
uint256 public _maxWalletSize = 30000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 4000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051a578063dd62ed3e1461053a578063ea1644d514610580578063f2fde38b146105a057600080fd5b8063a2a957bb14610495578063a9059cbb146104b5578063bfd79284146104d5578063c3c8cd801461050557600080fd5b80638f70ccf7116100d15780638f70ccf7146104145780638f9a55c01461043457806395d89b411461044a57806398a5c3151461047557600080fd5b806374010ece146103c05780637d1db4a5146103e05780638da5cb5b146103f657600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103565780636fc3eaec1461037657806370a082311461038b578063715018a6146103ab57600080fd5b8063313ce567146102fa57806349bd5a5e146103165780636b9990531461033657600080fd5b80631694505e116101a05780631694505e1461026857806318160ddd146102a057806323b872dd146102c45780632fd689e3146102e457600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023857600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611961565b6105c0565b005b3480156101ff57600080fd5b5060408051808201909152600a815269135bdbdb92db9a59da1d60b21b60208201525b60405161022f9190611a26565b60405180910390f35b34801561024457600080fd5b50610258610253366004611a7b565b61065f565b604051901515815260200161022f565b34801561027457600080fd5b50601454610288906001600160a01b031681565b6040516001600160a01b03909116815260200161022f565b3480156102ac57600080fd5b5066038d7ea4c680005b60405190815260200161022f565b3480156102d057600080fd5b506102586102df366004611aa7565b610676565b3480156102f057600080fd5b506102b660185481565b34801561030657600080fd5b506040516009815260200161022f565b34801561032257600080fd5b50601554610288906001600160a01b031681565b34801561034257600080fd5b506101f1610351366004611ae8565b6106df565b34801561036257600080fd5b506101f1610371366004611b15565b61072a565b34801561038257600080fd5b506101f1610772565b34801561039757600080fd5b506102b66103a6366004611ae8565b6107bd565b3480156103b757600080fd5b506101f16107df565b3480156103cc57600080fd5b506101f16103db366004611b30565b610853565b3480156103ec57600080fd5b506102b660165481565b34801561040257600080fd5b506000546001600160a01b0316610288565b34801561042057600080fd5b506101f161042f366004611b15565b610882565b34801561044057600080fd5b506102b660175481565b34801561045657600080fd5b506040805180820190915260028152614d4b60f01b6020820152610222565b34801561048157600080fd5b506101f1610490366004611b30565b6108ca565b3480156104a157600080fd5b506101f16104b0366004611b49565b6108f9565b3480156104c157600080fd5b506102586104d0366004611a7b565b610937565b3480156104e157600080fd5b506102586104f0366004611ae8565b60106020526000908152604090205460ff1681565b34801561051157600080fd5b506101f1610944565b34801561052657600080fd5b506101f1610535366004611b7b565b610998565b34801561054657600080fd5b506102b6610555366004611bff565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058c57600080fd5b506101f161059b366004611b30565b610a39565b3480156105ac57600080fd5b506101f16105bb366004611ae8565b610a68565b6000546001600160a01b031633146105f35760405162461bcd60e51b81526004016105ea90611c38565b60405180910390fd5b60005b815181101561065b5760016010600084848151811061061757610617611c6d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065381611c99565b9150506105f6565b5050565b600061066c338484610b52565b5060015b92915050565b6000610683848484610c76565b6106d584336106d085604051806060016040528060288152602001611db1602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b2565b610b52565b5060019392505050565b6000546001600160a01b031633146107095760405162461bcd60e51b81526004016105ea90611c38565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107545760405162461bcd60e51b81526004016105ea90611c38565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107a757506013546001600160a01b0316336001600160a01b0316145b6107b057600080fd5b476107ba816111ec565b50565b6001600160a01b03811660009081526002602052604081205461067090611271565b6000546001600160a01b031633146108095760405162461bcd60e51b81526004016105ea90611c38565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461087d5760405162461bcd60e51b81526004016105ea90611c38565b601655565b6000546001600160a01b031633146108ac5760405162461bcd60e51b81526004016105ea90611c38565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108f45760405162461bcd60e51b81526004016105ea90611c38565b601855565b6000546001600160a01b031633146109235760405162461bcd60e51b81526004016105ea90611c38565b600893909355600a91909155600955600b55565b600061066c338484610c76565b6012546001600160a01b0316336001600160a01b0316148061097957506013546001600160a01b0316336001600160a01b0316145b61098257600080fd5b600061098d306107bd565b90506107ba816112f5565b6000546001600160a01b031633146109c25760405162461bcd60e51b81526004016105ea90611c38565b60005b82811015610a335781600560008686858181106109e4576109e4611c6d565b90506020020160208101906109f99190611ae8565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2b81611c99565b9150506109c5565b50505050565b6000546001600160a01b03163314610a635760405162461bcd60e51b81526004016105ea90611c38565b601755565b6000546001600160a01b03163314610a925760405162461bcd60e51b81526004016105ea90611c38565b6001600160a01b038116610af75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ea565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bb45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ea565b6001600160a01b038216610c155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ea565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cda5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ea565b6001600160a01b038216610d3c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ea565b60008111610d9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ea565b6000546001600160a01b03848116911614801590610dca57506000546001600160a01b03838116911614155b156110ab57601554600160a01b900460ff16610e63576000546001600160a01b03848116911614610e635760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ea565b601654811115610eb55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ea565b6001600160a01b03831660009081526010602052604090205460ff16158015610ef757506001600160a01b03821660009081526010602052604090205460ff16155b610f4f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ea565b6015546001600160a01b03838116911614610fd45760175481610f71846107bd565b610f7b9190611cb2565b10610fd45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ea565b6000610fdf306107bd565b601854601654919250821015908210610ff85760165491505b80801561100f5750601554600160a81b900460ff16155b801561102957506015546001600160a01b03868116911614155b801561103e5750601554600160b01b900460ff165b801561106357506001600160a01b03851660009081526005602052604090205460ff16155b801561108857506001600160a01b03841660009081526005602052604090205460ff16155b156110a857611096826112f5565b4780156110a6576110a6476111ec565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110ed57506001600160a01b03831660009081526005602052604090205460ff165b8061111f57506015546001600160a01b0385811691161480159061111f57506015546001600160a01b03848116911614155b1561112c575060006111a6565b6015546001600160a01b03858116911614801561115757506014546001600160a01b03848116911614155b1561116957600854600c55600954600d555b6015546001600160a01b03848116911614801561119457506014546001600160a01b03858116911614155b156111a657600a54600c55600b54600d555b610a338484848461146f565b600081848411156111d65760405162461bcd60e51b81526004016105ea9190611a26565b5060006111e38486611cca565b95945050505050565b6012546001600160a01b03166108fc61120683600261149d565b6040518115909202916000818181858888f1935050505015801561122e573d6000803e3d6000fd5b506013546001600160a01b03166108fc61124983600261149d565b6040518115909202916000818181858888f1935050505015801561065b573d6000803e3d6000fd5b60006006548211156112d85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ea565b60006112e26114df565b90506112ee838261149d565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133d5761133d611c6d565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce1565b816001815181106113cd576113cd611c6d565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b52565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cfe565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a3357610a33600e54600c55600f54600d55565b60006112ee83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611627565b60008060006114ec611655565b90925090506114fb828261149d565b9250505090565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611693565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f0565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611732565b6001600160a01b0389166000908152600260205260409020556115c581611791565b6115cf84836117db565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b600081836116485760405162461bcd60e51b81526004016105ea9190611a26565b5060006111e38486611d6f565b600654600090819066038d7ea4c6800061166f828261149d565b82101561168a5750506006549266038d7ea4c6800092509050565b90939092509050565b60008060008060008060008060006116b08a600c54600d546117ff565b92509250925060006116c06114df565b905060008060006116d38e878787611854565b919e509c509a509598509396509194505050505091939550919395565b60006112ee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b2565b60008061173f8385611cb2565b9050838110156112ee5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ea565b600061179b6114df565b905060006117a983836118a4565b306000908152600260205260409020549091506117c69082611732565b30600090815260026020526040902055505050565b6006546117e890836116f0565b6006556007546117f89082611732565b6007555050565b6000808080611819606461181389896118a4565b9061149d565b9050600061182c60646118138a896118a4565b905060006118448261183e8b866116f0565b906116f0565b9992985090965090945050505050565b600080808061186388866118a4565b9050600061187188876118a4565b9050600061187f88886118a4565b905060006118918261183e86866116f0565b939b939a50919850919650505050505050565b6000826000036118b657506000610670565b60006118c28385611d91565b9050826118cf8583611d6f565b146112ee5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ea565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ba57600080fd5b803561195c8161193c565b919050565b6000602080838503121561197457600080fd5b823567ffffffffffffffff8082111561198c57600080fd5b818501915085601f8301126119a057600080fd5b8135818111156119b2576119b2611926565b8060051b604051601f19603f830116810181811085821117156119d7576119d7611926565b6040529182528482019250838101850191888311156119f557600080fd5b938501935b82851015611a1a57611a0b85611951565b845293850193928501926119fa565b98975050505050505050565b600060208083528351808285015260005b81811015611a5357858101830151858201604001528201611a37565b81811115611a65576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8e57600080fd5b8235611a998161193c565b946020939093013593505050565b600080600060608486031215611abc57600080fd5b8335611ac78161193c565b92506020840135611ad78161193c565b929592945050506040919091013590565b600060208284031215611afa57600080fd5b81356112ee8161193c565b8035801515811461195c57600080fd5b600060208284031215611b2757600080fd5b6112ee82611b05565b600060208284031215611b4257600080fd5b5035919050565b60008060008060808587031215611b5f57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9057600080fd5b833567ffffffffffffffff80821115611ba857600080fd5b818601915086601f830112611bbc57600080fd5b813581811115611bcb57600080fd5b8760208260051b8501011115611be057600080fd5b602092830195509350611bf69186019050611b05565b90509250925092565b60008060408385031215611c1257600080fd5b8235611c1d8161193c565b91506020830135611c2d8161193c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611cab57611cab611c83565b5060010190565b60008219821115611cc557611cc5611c83565b500190565b600082821015611cdc57611cdc611c83565b500390565b600060208284031215611cf357600080fd5b81516112ee8161193c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4e5784516001600160a01b031683529383019391830191600101611d29565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dab57611dab611c83565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200a93749fea820076d3c22164318fd2cff571e9f769e120278549ff3bbb2bb56a64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,945 |
0x4ebb74ae37a0fcfc6700b251124ce2f0c452d440
|
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
/**
* https://t.me/chocoboinu
* https://chocoboinu.com/
* チョコボ 🐥🐥🐥
* Chocobo, also called Chocob, is a recurring animal in the series of Final Fantasy. Large avian creatures, chocobos roughly act as the equivalent of horses, being domesticated for use as mounts, for pulling carts and carriages and for racing. Chocobos are known to be intelligent and to understand human language.
* Chocobos can usually be found in chocobo forests situated throughout the world. They come in several varieties. The regular chocobos can be used to travel around the world, but they flee when dismounted. In several series, a chocobo eats a chili pepper, it runs wildly due to the burning of the tongue.
* Chocobo Inu is the “proof of stake token” for CAW and SQUAWK. When you stake your Chocobo Inu token into the DAO, you are given CAW and SQUAWK. This can be swapped back at any time into the amount of Chocobo Inu you staked originally, plus any rewards that were given to the DAO in the time period you owned Chocobo Inu.
*/
// 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 CHOCOBO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Chocobo Inu";
string private constant _symbol = "CHOCOBO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610579578063dd62ed3e14610599578063ea1644d5146105df578063f2fde38b146105ff57600080fd5b8063a2a957bb146104f4578063a9059cbb14610514578063bfd7928414610534578063c3c8cd801461056457600080fd5b80638f70ccf7116100d15780638f70ccf71461046e5780638f9a55c01461048e57806395d89b41146104a457806398a5c315146104d457600080fd5b80637d1db4a5146103f85780637f2feddc1461040e5780638203f5fe1461043b5780638da5cb5b1461045057600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038e57806370a08231146103a3578063715018a6146103c357806374010ece146103d857600080fd5b8063313ce5671461031257806349bd5a5e1461032e5780636b9990531461034e5780636d8aa8f81461036e57600080fd5b80631694505e116101b65780631694505e1461027f57806318160ddd146102b757806323b872dd146102dc5780632fd689e3146102fc57600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024f57600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b72565b61061f565b005b34801561021557600080fd5b5060408051808201909152600b81526a43686f636f626f20496e7560a81b60208201525b6040516102469190611c37565b60405180910390f35b34801561025b57600080fd5b5061026f61026a366004611c8c565b6106be565b6040519015158152602001610246565b34801561028b57600080fd5b5060135461029f906001600160a01b031681565b6040516001600160a01b039091168152602001610246565b3480156102c357600080fd5b50670de0b6b3a76400005b604051908152602001610246565b3480156102e857600080fd5b5061026f6102f7366004611cb8565b6106d5565b34801561030857600080fd5b506102ce60175481565b34801561031e57600080fd5b5060405160098152602001610246565b34801561033a57600080fd5b5060145461029f906001600160a01b031681565b34801561035a57600080fd5b50610207610369366004611cf9565b61073e565b34801561037a57600080fd5b50610207610389366004611d26565b610789565b34801561039a57600080fd5b506102076107d1565b3480156103af57600080fd5b506102ce6103be366004611cf9565b6107fe565b3480156103cf57600080fd5b50610207610820565b3480156103e457600080fd5b506102076103f3366004611d41565b610894565b34801561040457600080fd5b506102ce60155481565b34801561041a57600080fd5b506102ce610429366004611cf9565b60116020526000908152604090205481565b34801561044757600080fd5b506102076108d6565b34801561045c57600080fd5b506000546001600160a01b031661029f565b34801561047a57600080fd5b50610207610489366004611d26565b610abb565b34801561049a57600080fd5b506102ce60165481565b3480156104b057600080fd5b5060408051808201909152600781526643484f434f424f60c81b6020820152610239565b3480156104e057600080fd5b506102076104ef366004611d41565b610b1a565b34801561050057600080fd5b5061020761050f366004611d5a565b610b49565b34801561052057600080fd5b5061026f61052f366004611c8c565b610ba3565b34801561054057600080fd5b5061026f61054f366004611cf9565b60106020526000908152604090205460ff1681565b34801561057057600080fd5b50610207610bb0565b34801561058557600080fd5b50610207610594366004611d8c565b610be6565b3480156105a557600080fd5b506102ce6105b4366004611e10565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105eb57600080fd5b506102076105fa366004611d41565b610c87565b34801561060b57600080fd5b5061020761061a366004611cf9565b610cb6565b6000546001600160a01b031633146106525760405162461bcd60e51b815260040161064990611e49565b60405180910390fd5b60005b81518110156106ba5760016010600084848151811061067657610676611e7e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b281611eaa565b915050610655565b5050565b60006106cb338484610da0565b5060015b92915050565b60006106e2848484610ec4565b610734843361072f85604051806060016040528060288152602001611fc4602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611400565b610da0565b5060019392505050565b6000546001600160a01b031633146107685760405162461bcd60e51b815260040161064990611e49565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b35760405162461bcd60e51b815260040161064990611e49565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f157600080fd5b476107fb8161143a565b50565b6001600160a01b0381166000908152600260205260408120546106cf90611474565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161064990611e49565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161064990611e49565b6611c37937e0800081116108d157600080fd5b601555565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161064990611e49565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561096057600080fd5b505afa158015610974573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109989190611ec5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109e057600080fd5b505afa1580156109f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a189190611ec5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a6057600080fd5b505af1158015610a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a989190611ec5565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ae55760405162461bcd60e51b815260040161064990611e49565b601454600160a01b900460ff1615610afc57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b445760405162461bcd60e51b815260040161064990611e49565b601755565b6000546001600160a01b03163314610b735760405162461bcd60e51b815260040161064990611e49565b60095482111580610b865750600b548111155b610b8f57600080fd5b600893909355600a91909155600955600b55565b60006106cb338484610ec4565b6012546001600160a01b0316336001600160a01b031614610bd057600080fd5b6000610bdb306107fe565b90506107fb816114f8565b6000546001600160a01b03163314610c105760405162461bcd60e51b815260040161064990611e49565b60005b82811015610c81578160056000868685818110610c3257610c32611e7e565b9050602002016020810190610c479190611cf9565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c7981611eaa565b915050610c13565b50505050565b6000546001600160a01b03163314610cb15760405162461bcd60e51b815260040161064990611e49565b601655565b6000546001600160a01b03163314610ce05760405162461bcd60e51b815260040161064990611e49565b6001600160a01b038116610d455760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610649565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e025760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610649565b6001600160a01b038216610e635760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610649565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f285760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610649565b6001600160a01b038216610f8a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610649565b60008111610fec5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610649565b6000546001600160a01b0384811691161480159061101857506000546001600160a01b03838116911614155b156112f957601454600160a01b900460ff166110b1576000546001600160a01b038481169116146110b15760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610649565b6015548111156111035760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610649565b6001600160a01b03831660009081526010602052604090205460ff1615801561114557506001600160a01b03821660009081526010602052604090205460ff16155b61119d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610649565b6014546001600160a01b0383811691161461122257601654816111bf846107fe565b6111c99190611ee2565b106112225760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610649565b600061122d306107fe565b6017546015549192508210159082106112465760155491505b80801561125d5750601454600160a81b900460ff16155b801561127757506014546001600160a01b03868116911614155b801561128c5750601454600160b01b900460ff165b80156112b157506001600160a01b03851660009081526005602052604090205460ff16155b80156112d657506001600160a01b03841660009081526005602052604090205460ff16155b156112f6576112e4826114f8565b4780156112f4576112f44761143a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061133b57506001600160a01b03831660009081526005602052604090205460ff165b8061136d57506014546001600160a01b0385811691161480159061136d57506014546001600160a01b03848116911614155b1561137a575060006113f4565b6014546001600160a01b0385811691161480156113a557506013546001600160a01b03848116911614155b156113b757600854600c55600954600d555b6014546001600160a01b0384811691161480156113e257506013546001600160a01b03858116911614155b156113f457600a54600c55600b54600d555b610c8184848484611681565b600081848411156114245760405162461bcd60e51b81526004016106499190611c37565b5060006114318486611efa565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ba573d6000803e3d6000fd5b60006006548211156114db5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610649565b60006114e56116af565b90506114f183826116d2565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061154057611540611e7e565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561159457600080fd5b505afa1580156115a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115cc9190611ec5565b816001815181106115df576115df611e7e565b6001600160a01b0392831660209182029290920101526013546116059130911684610da0565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac9479061163e908590600090869030904290600401611f11565b600060405180830381600087803b15801561165857600080fd5b505af115801561166c573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061168e5761168e611714565b611699848484611742565b80610c8157610c81600e54600c55600f54600d55565b60008060006116bc611839565b90925090506116cb82826116d2565b9250505090565b60006114f183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611879565b600c541580156117245750600d54155b1561172b57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611754876118a7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117869087611904565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117b59086611946565b6001600160a01b0389166000908152600260205260409020556117d7816119a5565b6117e184836119ef565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161182691815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061185482826116d2565b82101561187057505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361189a5760405162461bcd60e51b81526004016106499190611c37565b5060006114318486611f82565b60008060008060008060008060006118c48a600c54600d54611a13565b92509250925060006118d46116af565b905060008060006118e78e878787611a68565b919e509c509a509598509396509194505050505091939550919395565b60006114f183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611400565b6000806119538385611ee2565b9050838110156114f15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610649565b60006119af6116af565b905060006119bd8383611ab8565b306000908152600260205260409020549091506119da9082611946565b30600090815260026020526040902055505050565b6006546119fc9083611904565b600655600754611a0c9082611946565b6007555050565b6000808080611a2d6064611a278989611ab8565b906116d2565b90506000611a406064611a278a89611ab8565b90506000611a5882611a528b86611904565b90611904565b9992985090965090945050505050565b6000808080611a778886611ab8565b90506000611a858887611ab8565b90506000611a938888611ab8565b90506000611aa582611a528686611904565b939b939a50919850919650505050505050565b600082611ac7575060006106cf565b6000611ad38385611fa4565b905082611ae08583611f82565b146114f15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610649565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b8035611b6d81611b4d565b919050565b60006020808385031215611b8557600080fd5b823567ffffffffffffffff80821115611b9d57600080fd5b818501915085601f830112611bb157600080fd5b813581811115611bc357611bc3611b37565b8060051b604051601f19603f83011681018181108582111715611be857611be8611b37565b604052918252848201925083810185019188831115611c0657600080fd5b938501935b82851015611c2b57611c1c85611b62565b84529385019392850192611c0b565b98975050505050505050565b600060208083528351808285015260005b81811015611c6457858101830151858201604001528201611c48565b81811115611c76576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c9f57600080fd5b8235611caa81611b4d565b946020939093013593505050565b600080600060608486031215611ccd57600080fd5b8335611cd881611b4d565b92506020840135611ce881611b4d565b929592945050506040919091013590565b600060208284031215611d0b57600080fd5b81356114f181611b4d565b80358015158114611b6d57600080fd5b600060208284031215611d3857600080fd5b6114f182611d16565b600060208284031215611d5357600080fd5b5035919050565b60008060008060808587031215611d7057600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611da157600080fd5b833567ffffffffffffffff80821115611db957600080fd5b818601915086601f830112611dcd57600080fd5b813581811115611ddc57600080fd5b8760208260051b8501011115611df157600080fd5b602092830195509350611e079186019050611d16565b90509250925092565b60008060408385031215611e2357600080fd5b8235611e2e81611b4d565b91506020830135611e3e81611b4d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ebe57611ebe611e94565b5060010190565b600060208284031215611ed757600080fd5b81516114f181611b4d565b60008219821115611ef557611ef5611e94565b500190565b600082821015611f0c57611f0c611e94565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f615784516001600160a01b031683529383019391830191600101611f3c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f9f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611fbe57611fbe611e94565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e07f815cf757511beb0e15203f273e0c30c8e9a67134dd0c602f5254164038d564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,946 |
0xafffa077b42aea1e4c94da21eab227eab2edc0c4
|
/**
*Submitted for verification at Etherscan.io on 2020-08-18
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.10;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev 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);
}
/**
* @title A simple smart contract which only records everyone’s voting on each proposal.
*/
contract VoteBox {
using SafeMath for uint256;
// Meta data
struct Meta {
uint256 beginBlock;
uint256 endBlock;
}
// Vote content
enum Content { INVALID, FOR, AGAINST }
// Min MCB rate of totalSupply for creating a new proposal
uint256 public constant MIN_PROPOSAL_RATE = 10**16; // 1% according to https://github.com/mcdexio/documents/blob/master/en/Mai-Protocol-v3.pdf
// Min voting period in blocks. 1 day for 15s/block
uint256 public constant MIN_PERIOD = 5760;
// MCB address
IERC20 public mcb;
// All proposal meta data
Meta[] public proposals;
// Compatible with the old VoteBox
uint256 public constant PROPOSAL_ID_OFFSET = 20;
/**
* @dev The new proposal is created
*/
event Proposal(uint256 indexed id, string link, uint256 beginBlock, uint256 endBlock);
/**
* @dev Someone changes his/her vote on the proposal
*/
event Vote(address indexed voter, uint256 indexed id, Content voteContent);
/**
* @dev Constructor
* @param mcbAddress MCB address
*/
constructor(address mcbAddress)
public
{
mcb = IERC20(mcbAddress);
for (uint i = 0; i < PROPOSAL_ID_OFFSET; i++) {
proposals.push(Meta({
beginBlock: 0,
endBlock: 0
}));
}
}
/**
* @dev Accessor to the total number of proposal
*/
function totalProposals()
external view returns (uint256)
{
return proposals.length;
}
/**
* @dev Create a new proposal, need a proposal privilege
* @param link The forum link of the proposal
* @param beginBlock Voting is enabled between [begin block, end block]
* @param endBlock Voting is enabled between [begin block, end block]
*/
function propose(string calldata link, uint256 beginBlock, uint256 endBlock)
external
{
uint256 minProposalMCB = mcb.totalSupply().mul(MIN_PROPOSAL_RATE).div(10**18);
require(mcb.balanceOf(msg.sender) >= minProposalMCB, "proposal privilege required");
require(bytes(link).length > 0, "empty link");
require(block.number <= beginBlock, "old proposal");
require(beginBlock.add(MIN_PERIOD) <= endBlock, "period is too short");
proposals.push(Meta({
beginBlock: beginBlock,
endBlock: endBlock
}));
emit Proposal(proposals.length - 1, link, beginBlock, endBlock);
}
/**
* @notice Vote for/against the proposal with id
* @param id Proposal id
* @param voteContent Vote content
*/
function vote(uint256 id, Content voteContent)
external
{
require(id < proposals.length, "invalid id");
require(voteContent != Content.INVALID, "invalid content");
require(proposals[id].beginBlock <= block.number, "< begin");
require(block.number <= proposals[id].endBlock, "> end");
emit Vote(msg.sender, id, voteContent);
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063943e82161161005b578063943e8216146101795780639dd57aea1461019f578063a78d80fc146101a7578063bbccf154146101af57610088565b8063013cf08b1461008d5780632aa77c4c146100c35780635043a3031461013b57806381192eb714610155575b600080fd5b6100aa600480360360208110156100a357600080fd5b50356101b7565b6040805192835260208301919091528051918290030190f35b610139600480360360608110156100d957600080fd5b8101906020810181356401000000008111156100f457600080fd5b82018360208201111561010657600080fd5b8035906020019184600183028401116401000000008311171561012857600080fd5b9193509150803590602001356101e2565b005b610143610533565b60408051918252519081900360200190f35b61015d610538565b604080516001600160a01b039092168252519081900360200190f35b6101396004803603604081101561018f57600080fd5b508035906020013560ff16610547565b6101436106e9565b6101436106f4565b6101436106fa565b600181815481106101c457fe5b60009182526020909120600290910201805460019091015490915082565b600061028c670de0b6b3a7640000610280662386f26fc100006000809054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561024857600080fd5b505afa15801561025c573d6000803e3d6000fd5b505050506040513d602081101561027257600080fd5b50519063ffffffff61070016565b9063ffffffff61076216565b600054604080516370a0823160e01b8152336004820152905192935083926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156102dc57600080fd5b505afa1580156102f0573d6000803e3d6000fd5b505050506040513d602081101561030657600080fd5b5051101561035b576040805162461bcd60e51b815260206004820152601b60248201527f70726f706f73616c2070726976696c6567652072657175697265640000000000604482015290519081900360640190fd5b8361039a576040805162461bcd60e51b815260206004820152600a602482015269656d707479206c696e6b60b01b604482015290519081900360640190fd5b824311156103de576040805162461bcd60e51b815260206004820152600c60248201526b1bdb19081c1c9bdc1bdcd85b60a21b604482015290519081900360640190fd5b816103f18461168063ffffffff6107a416565b111561043a576040805162461bcd60e51b81526020600482015260136024820152721c195c9a5bd9081a5cc81d1bdbc81cda1bdc9d606a1b604482015290519081900360640190fd5b6040805180820182528481526020808201858152600180548082018255600082905293517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660029095029485015590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf790930192909255905482519182018690529181018490526060808252810186905260001991909101907f60889d4da53649cd6c3e5b75075c9436fbb04154400e5f9a94d57c99f267fc309087908790879087908060808101868680828437600083820152604051601f909101601f191690920182900397509095505050505050a25050505050565b601481565b6000546001600160a01b031681565b600154821061058a576040805162461bcd60e51b815260206004820152600a6024820152691a5b9d985b1a59081a5960b21b604482015290519081900360640190fd5b600081600281111561059857fe5b14156105dd576040805162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a590818dbdb9d195b9d608a1b604482015290519081900360640190fd5b43600183815481106105eb57fe5b906000526020600020906002020160000154111561063a576040805162461bcd60e51b81526020600482015260076024820152661e103132b3b4b760c91b604482015290519081900360640190fd5b6001828154811061064757fe5b906000526020600020906002020160010154431115610695576040805162461bcd60e51b81526020600482015260056024820152640f88195b9960da1b604482015290519081900360640190fd5b81336001600160a01b03167fea646db319bf204816f80359be35bfd60d0daea88ac98b858a99323eb80681bc83604051808260028111156106d257fe5b60ff16815260200191505060405180910390a35050565b662386f26fc1000081565b60015490565b61168081565b60008261070f5750600061075c565b8282028284828161071c57fe5b04146107595760405162461bcd60e51b81526004018080602001828103825260218152602001806108a16021913960400191505060405180910390fd5b90505b92915050565b600061075983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506107fe565b600082820183811015610759576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818361088a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561084f578181015183820152602001610837565b50505050905090810190601f16801561087c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161089657fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212201f9b536eb1cb8496b23acf0bee43b32024b0e2d4b99533c5709508782f67bc2164736f6c634300060a0033
|
{"success": true, "error": null, "results": {}}
| 2,947 |
0x9990c406bcdd8164d6ca539f547099eceb1f64ef
|
/*
https://t.me/raichuinutoken
*/
//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 Raichu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _maxTxAmount = _tTotal;
uint256 private openBlock;
uint256 private _swapTokensAtAmount = 100 * 10**9; // 100 tokens
uint256 private _maxWalletAmount = _tTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Raichu Inu";
string private constant _symbol = "RAICHU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2, address payable addr3, address payable addr4, address payable addr5) {
_feeAddrWallet1 = addr1;
_feeAddrWallet2 = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[addr4] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[addr5] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[addr3] = 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 = 1;
_feeAddr2 = 12;
if (from != owner() && to != owner() && from != address(this) && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
// Not over max tx amount
require(amount <= _maxTxAmount, "Over max transaction amount.");
// Cooldown
require(cooldown[to] < block.timestamp, "Cooldown enforced.");
// Max wallet
require(balanceOf(to) + amount <= _maxWalletAmount, "Over max wallet amount.");
cooldown[to] = block.timestamp + (30 seconds);
}
if (
to == uniswapV2Pair &&
from != address(uniswapV2Router) &&
!_isExcludedFromFee[from]
) {
_feeAddr1 = 1;
_feeAddr2 = 12;
}
if (openBlock + 3 >= block.number && from == uniswapV2Pair) {
_feeAddr1 = 1;
_feeAddr2 = 99;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
} else {
// Only if it's not from or to owner or from contract address.
_feeAddr1 = 0;
_feeAddr2 = 0;
}
_tokenTransfer(from, to, amount);
}
function swapAndLiquifyEnabled(bool enabled) public onlyOwner {
inSwap = enabled;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function setMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount * 10**9;
}
function setMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount * 10**9;
}
function whitelist(address payable adr1) external onlyOwner {
_isExcludedFromFee[adr1] = true;
}
function unwhitelist(address payable adr2) external onlyOwner {
_isExcludedFromFee[adr2] = false;
}
function openTrading() external onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
// .5%
_maxTxAmount = 1000000000000 * 10**9;
_maxWalletAmount = 2000000000000 * 10**9;
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function addBot(address theBot) public onlyOwner {
bots[theBot] = true;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setSwapTokens(uint256 swaptokens) public onlyOwner {
_swapTokensAtAmount = swaptokens;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount
) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_feeAddr1,
_feeAddr2
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101445760003560e01c80638da5cb5b116100b6578063c9567bf91161006f578063c9567bf9146103ab578063dd62ed3e146103c0578063e98391ff14610406578063ec28438a14610426578063f429389014610446578063ffecf5161461045b57600080fd5b80638da5cb5b146102d457806395d89b41146102fc5780639a5904271461032b5780639b19251a1461034b578063a9059cbb1461036b578063bf6642e71461038b57600080fd5b806327a14fc21161010857806327a14fc21461022e578063313ce5671461024e57806351bc3c851461026a5780635932ead11461027f57806370a082311461029f578063715018a6146102bf57600080fd5b806306fdde0314610150578063095ea7b31461019557806318160ddd146101c557806323b872dd146101ec578063273123b71461020c57600080fd5b3661014b57005b600080fd5b34801561015c57600080fd5b5060408051808201909152600a81526952616963687520496e7560b01b60208201525b60405161018c9190611ab2565b60405180910390f35b3480156101a157600080fd5b506101b56101b0366004611a05565b61047b565b604051901515815260200161018c565b3480156101d157600080fd5b5069152d02c7e14af68000005b60405190815260200161018c565b3480156101f857600080fd5b506101b56102073660046119c4565b610492565b34801561021857600080fd5b5061022c610227366004611951565b6104fb565b005b34801561023a57600080fd5b5061022c610249366004611a6b565b61054f565b34801561025a57600080fd5b506040516009815260200161018c565b34801561027657600080fd5b5061022c61058d565b34801561028b57600080fd5b5061022c61029a366004611a31565b6105a6565b3480156102ab57600080fd5b506101de6102ba366004611951565b6105ee565b3480156102cb57600080fd5b5061022c610610565b3480156102e057600080fd5b506000546040516001600160a01b03909116815260200161018c565b34801561030857600080fd5b5060408051808201909152600681526552414943485560d01b602082015261017f565b34801561033757600080fd5b5061022c610346366004611951565b610684565b34801561035757600080fd5b5061022c610366366004611951565b6106cf565b34801561037757600080fd5b506101b5610386366004611a05565b61071d565b34801561039757600080fd5b5061022c6103a6366004611a6b565b61072a565b3480156103b757600080fd5b5061022c610759565b3480156103cc57600080fd5b506101de6103db36600461198b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561041257600080fd5b5061022c610421366004611a31565b610b33565b34801561043257600080fd5b5061022c610441366004611a6b565b610b7b565b34801561045257600080fd5b5061022c610bb9565b34801561046757600080fd5b5061022c610476366004611951565b610bc3565b6000610488338484610c11565b5060015b92915050565b600061049f848484610d35565b6104f184336104ec85604051806060016040528060288152602001611c6d602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061121c565b610c11565b5060019392505050565b6000546001600160a01b0316331461052e5760405162461bcd60e51b815260040161052590611b07565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105795760405162461bcd60e51b815260040161052590611b07565b61058781633b9aca00611be7565b600d5550565b6000610598306105ee565b90506105a381611256565b50565b6000546001600160a01b031633146105d05760405162461bcd60e51b815260040161052590611b07565b60138054911515600160b81b0260ff60b81b19909216919091179055565b6001600160a01b03811660009081526002602052604081205461048c906113df565b6000546001600160a01b0316331461063a5760405162461bcd60e51b815260040161052590611b07565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106ae5760405162461bcd60e51b815260040161052590611b07565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146106f95760405162461bcd60e51b815260040161052590611b07565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000610488338484610d35565b6000546001600160a01b031633146107545760405162461bcd60e51b815260040161052590611b07565b600c55565b6000546001600160a01b031633146107835760405162461bcd60e51b815260040161052590611b07565b601354600160a01b900460ff16156107dd5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610525565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561081b308269152d02c7e14af6800000610c11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561085457600080fd5b505afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c919061196e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108d457600080fd5b505afa1580156108e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090c919061196e565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561095457600080fd5b505af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c919061196e565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d71947306109bc816105ee565b6000806109d16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a3457600080fd5b505af1158015610a48573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a6d9190611a84565b505060138054683635c9adc5dea00000600a55686c6b935b8bbd400000600d5563ffff00ff60a01b198116630101000160a01b1790915543600b5560125460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af757600080fd5b505af1158015610b0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2f9190611a4e565b5050565b6000546001600160a01b03163314610b5d5760405162461bcd60e51b815260040161052590611b07565b60138054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314610ba55760405162461bcd60e51b815260040161052590611b07565b610bb381633b9aca00611be7565b600a5550565b476105a381611463565b6000546001600160a01b03163314610bed5760405162461bcd60e51b815260040161052590611b07565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610c735760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610525565b6001600160a01b038216610cd45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610525565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d995760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610525565b6001600160a01b038216610dfb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610525565b60008111610e5d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610525565b6001600e55600c600f556000546001600160a01b03848116911614801590610e9357506000546001600160a01b03838116911614155b8015610ea857506001600160a01b0383163014155b8015610ecd57506001600160a01b03831660009081526005602052604090205460ff16155b8015610ef257506001600160a01b03821660009081526005602052604090205460ff16155b15611201576001600160a01b03831660009081526006602052604090205460ff16158015610f3957506001600160a01b03821660009081526006602052604090205460ff16155b610f4257600080fd5b6013546001600160a01b038481169116148015610f6d57506012546001600160a01b03838116911614155b8015610f9257506001600160a01b03821660009081526005602052604090205460ff16155b8015610fa75750601354600160b81b900460ff165b156110e457600a54811115610ffe5760405162461bcd60e51b815260206004820152601c60248201527f4f766572206d6178207472616e73616374696f6e20616d6f756e742e000000006044820152606401610525565b6001600160a01b038216600090815260076020526040902054421161105a5760405162461bcd60e51b815260206004820152601260248201527121b7b7b63237bbb71032b73337b931b2b21760711b6044820152606401610525565b600d5481611067846105ee565b6110719190611bad565b11156110bf5760405162461bcd60e51b815260206004820152601760248201527f4f766572206d61782077616c6c657420616d6f756e742e0000000000000000006044820152606401610525565b6110ca42601e611bad565b6001600160a01b0383166000908152600760205260409020555b6013546001600160a01b03838116911614801561110f57506012546001600160a01b03848116911614155b801561113457506001600160a01b03831660009081526005602052604090205460ff16155b15611144576001600e55600c600f555b43600b5460036111549190611bad565b1015801561116f57506013546001600160a01b038481169116145b1561117f576001600e556063600f555b600061118a306105ee565b600c54909150811080159081906111ab5750601354600160a81b900460ff16155b80156111c557506013546001600160a01b03868116911614155b80156111da5750601354600160b01b900460ff165b156111fa576111e882611256565b4780156111f8576111f847611463565b505b505061120c565b6000600e819055600f555b6112178383836114e8565b505050565b600081848411156112405760405162461bcd60e51b81526004016105259190611ab2565b50600061124d8486611c06565b95945050505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061129e5761129e611c33565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112f257600080fd5b505afa158015611306573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132a919061196e565b8160018151811061133d5761133d611c33565b6001600160a01b0392831660209182029290920101526012546113639130911684610c11565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061139c908590600090869030904290600401611b3c565b600060405180830381600087803b1580156113b657600080fd5b505af11580156113ca573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60006008548211156114465760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610525565b60006114506114f3565b905061145c8382611516565b9392505050565b6010546001600160a01b03166108fc61147d836002611516565b6040518115909202916000818181858888f193505050501580156114a5573d6000803e3d6000fd5b506011546001600160a01b03166108fc6114c0836002611516565b6040518115909202916000818181858888f19350505050158015610b2f573d6000803e3d6000fd5b611217838383611558565b600080600061150061164f565b909250905061150f8282611516565b9250505090565b600061145c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611693565b60008060008060008061156a876116c1565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061159c908761171e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115cb9086611760565b6001600160a01b0389166000908152600260205260409020556115ed816117bf565b6115f78483611809565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161163c91815260200190565b60405180910390a3505050505050505050565b600854600090819069152d02c7e14af680000061166c8282611516565b82101561168a5750506008549269152d02c7e14af680000092509050565b90939092509050565b600081836116b45760405162461bcd60e51b81526004016105259190611ab2565b50600061124d8486611bc5565b60008060008060008060008060006116de8a600e54600f5461182d565b92509250925060006116ee6114f3565b905060008060006117018e878787611882565b919e509c509a509598509396509194505050505091939550919395565b600061145c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061121c565b60008061176d8385611bad565b90508381101561145c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610525565b60006117c96114f3565b905060006117d783836118d2565b306000908152600260205260409020549091506117f49082611760565b30600090815260026020526040902055505050565b600854611816908361171e565b6008556009546118269082611760565b6009555050565b6000808080611847606461184189896118d2565b90611516565b9050600061185a60646118418a896118d2565b905060006118728261186c8b8661171e565b9061171e565b9992985090965090945050505050565b600080808061189188866118d2565b9050600061189f88876118d2565b905060006118ad88886118d2565b905060006118bf8261186c868661171e565b939b939a50919850919650505050505050565b6000826118e15750600061048c565b60006118ed8385611be7565b9050826118fa8583611bc5565b1461145c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610525565b60006020828403121561196357600080fd5b813561145c81611c49565b60006020828403121561198057600080fd5b815161145c81611c49565b6000806040838503121561199e57600080fd5b82356119a981611c49565b915060208301356119b981611c49565b809150509250929050565b6000806000606084860312156119d957600080fd5b83356119e481611c49565b925060208401356119f481611c49565b929592945050506040919091013590565b60008060408385031215611a1857600080fd5b8235611a2381611c49565b946020939093013593505050565b600060208284031215611a4357600080fd5b813561145c81611c5e565b600060208284031215611a6057600080fd5b815161145c81611c5e565b600060208284031215611a7d57600080fd5b5035919050565b600080600060608486031215611a9957600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611adf57858101830151858201604001528201611ac3565b81811115611af1576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b8c5784516001600160a01b031683529383019391830191600101611b67565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611bc057611bc0611c1d565b500190565b600082611be257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611c0157611c01611c1d565b500290565b600082821015611c1857611c18611c1d565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146105a357600080fd5b80151581146105a357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209781adffd9245052ecfe910447499f97412d1185ee903028600cde17655310fd64736f6c63430008070033
|
{"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"}]}}
| 2,948 |
0xe92fa4e3447a58753154364b329d2361b3b4cae4
|
pragma solidity ^0.4.13;
library ECRecovery {
/**
* @dev Recover signer address from a message by using their signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig)
internal
pure
returns (address)
{
bytes32 r;
bytes32 s;
uint8 v;
// Check the signature length
if (sig.length != 65) {
return (address(0));
}
// Divide the signature in r, s and v variables
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
if (v < 27) {
v += 27;
}
// If the version is correct return the signer address
if (v != 27 && v != 28) {
return (address(0));
} else {
// solium-disable-next-line arg-overflow
return ecrecover(hash, v, r, s);
}
}
/**
* toEthSignedMessageHash
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* @dev and hash the result
*/
function toEthSignedMessageHash(bytes32 hash)
internal
pure
returns (bytes32)
{
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(
"\x19Ethereum Signed Message:\n32",
hash
);
}
}
contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x);
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x);
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x);
}
function min(uint x, uint y) internal pure returns (uint z) {
return x <= y ? x : y;
}
function max(uint x, uint y) internal pure returns (uint z) {
return x >= y ? x : y;
}
function imin(int x, int y) internal pure returns (int z) {
return x <= y ? x : y;
}
function imax(int x, int y) internal pure returns (int z) {
return x >= y ? x : y;
}
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function rmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), RAY / 2) / RAY;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, RAY), y / 2) / y;
}
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
//
function rpow(uint x, uint n) internal pure returns (uint z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
}
contract Htlc is DSMath {
using ECRecovery for bytes32;
// TYPES
// ATL Authority timelocked contract
struct Multisig { // Locked by authority approval (earlyResolve), time (timoutResolve) or conversion into an atomic swap
address owner; // Owns ether deposited in multisig
address authority; // Can approve earlyResolve of funds out of multisig
uint deposit; // Amount deposited by owner in this multisig
uint unlockTime; // Multisig expiration timestamp in seconds
}
struct AtomicSwap { // Locked by secret (regularTransfer) or time (reclaimExpiredSwaps)
bytes32 msigId; // Corresponding multisigId
address initiator; // Initiated this swap
address beneficiary; // Beneficiary of this swap
uint amount; // If zero then swap not active anymore
uint fee; // Fee amount to be paid to multisig authority
uint expirationTime; // Swap expiration timestamp in seconds
bytes32 hashedSecret; // sha256(secret), hashed secret of swap initiator
}
// FIELDS
address constant FEE_RECIPIENT = 0x478189a0aF876598C8a70Ce8896960500455A949;
uint constant MAX_BATCH_ITERATIONS = 25; // Assumption block.gaslimit around 7500000
mapping (bytes32 => Multisig) public multisigs;
mapping (bytes32 => AtomicSwap) public atomicswaps;
mapping (bytes32 => bool) public isAntecedentHashedSecret;
// EVENTS
event MultisigInitialised(bytes32 msigId);
event MultisigReparametrized(bytes32 msigId);
event AtomicSwapInitialised(bytes32 swapId);
// MODIFIERS
// METHODS
/**
@notice Send ether out of this contract to multisig owner and update or delete entry in multisig mapping
@param msigId Unique (owner, authority, balance != 0) multisig identifier
@param amount Spend this amount of ether
*/
function spendFromMultisig(bytes32 msigId, uint amount, address recipient)
internal
{
multisigs[msigId].deposit = sub(multisigs[msigId].deposit, amount);
if (multisigs[msigId].deposit == 0)
delete multisigs[msigId];
recipient.transfer(amount);
}
// PUBLIC METHODS
/**
@notice Initialise and reparametrize Multisig
@dev Uses msg.value to fund Multisig
@param authority Second multisig Authority. Usually this is the Exchange.
@param unlockTime Lock Ether until unlockTime in seconds.
@return msigId Unique (owner, authority, balance != 0) multisig identifier
*/
function initialiseMultisig(address authority, uint unlockTime)
public
payable
returns (bytes32 msigId)
{
// Require not own authority and non-zero ether amount are sent
require(msg.sender != authority);
require(msg.value > 0);
// Create unique multisig identifier
msigId = keccak256(
msg.sender,
authority,
msg.value,
unlockTime
);
emit MultisigInitialised(msigId);
// Create multisig
Multisig storage multisig = multisigs[msigId];
if (multisig.deposit == 0) { // New or empty multisig
// Create new multisig
multisig.owner = msg.sender;
multisig.authority = authority;
}
// Adjust balance and locktime
reparametrizeMultisig(msigId, unlockTime);
}
/**
@notice Inititate/extend multisig unlockTime and/or initiate/refund multisig deposit
@dev Can increase deposit and/or unlockTime but not owner or authority
@param msigId Unique (owner, authority, balance != 0) multisig identifier
@param unlockTime Lock Ether until unlockTime in seconds.
*/
function reparametrizeMultisig(bytes32 msigId, uint unlockTime)
public
payable
{
require(multisigs[msigId].owner == msg.sender);
Multisig storage multisig = multisigs[msigId];
multisig.deposit = add(multisig.deposit, msg.value);
assert(multisig.unlockTime <= unlockTime); // Can only increase unlockTime
multisig.unlockTime = unlockTime;
emit MultisigReparametrized(msigId);
}
/**
@notice Withdraw ether from the multisig. Equivalent to EARLY_RESOLVE in Nimiq
@dev the signature is generated using web3.eth.sign() over the unique msigId
@param msigId Unique (owner, authority, balance != 0) multisig identifier
@param amount Return this amount from this contract to owner
@param sig bytes signature of the not transaction sending Authority
*/
function earlyResolve(bytes32 msigId, uint amount, bytes sig)
public
{
// Require: msg.sender == (owner or authority)
require(
multisigs[msigId].owner == msg.sender ||
multisigs[msigId].authority == msg.sender
);
// Require: valid signature from not msg.sending authority
address otherAuthority = multisigs[msigId].owner == msg.sender ?
multisigs[msigId].authority :
multisigs[msigId].owner;
require(otherAuthority == msigId.toEthSignedMessageHash().recover(sig));
// Return to owner
spendFromMultisig(msigId, amount, multisigs[msigId].owner);
}
/**
@notice Withdraw ether and delete the htlc swap. Equivalent to TIMEOUT_RESOLVE in Nimiq
@param msigId Unique (owner, authority, balance != 0) multisig identifier
@dev Only refunds owned multisig deposits
*/
function timeoutResolve(bytes32 msigId, uint amount)
public
{
// Require time has passed
require(now >= multisigs[msigId].unlockTime);
// Return to owner
spendFromMultisig(msigId, amount, multisigs[msigId].owner);
}
/**
@notice First or second stage of atomic swap.
@param msigId Unique (owner, authority, balance != 0) multisig identifier
@param beneficiary Beneficiary of this swap
@param amount Convert this amount from multisig into swap
@param fee Fee amount to be paid to multisig authority
@param expirationTime Swap expiration timestamp in seconds; not more than 1 day from now
@param hashedSecret sha256(secret), hashed secret of swap initiator
@return swapId Unique (initiator, beneficiary, amount, fee, expirationTime, hashedSecret) swap identifier
*/
function convertIntoHtlc(bytes32 msigId, address beneficiary, uint amount, uint fee, uint expirationTime, bytes32 hashedSecret)
public
returns (bytes32 swapId)
{
// Require owner with sufficient deposit
require(multisigs[msigId].owner == msg.sender);
require(multisigs[msigId].deposit >= amount + fee); // Checks for underflow
require(
now <= expirationTime &&
expirationTime <= min(now + 1 days, multisigs[msigId].unlockTime)
); // Not more than 1 day or unlockTime
require(amount > 0); // Non-empty amount as definition for active swap
require(!isAntecedentHashedSecret[hashedSecret]);
isAntecedentHashedSecret[hashedSecret] = true;
// Account in multisig balance
multisigs[msigId].deposit = sub(multisigs[msigId].deposit, add(amount, fee));
// Create swap identifier
swapId = keccak256(
msigId,
msg.sender,
beneficiary,
amount,
fee,
expirationTime,
hashedSecret
);
emit AtomicSwapInitialised(swapId);
// Create swap
AtomicSwap storage swap = atomicswaps[swapId];
swap.msigId = msigId;
swap.initiator = msg.sender;
swap.beneficiary = beneficiary;
swap.amount = amount;
swap.fee = fee;
swap.expirationTime = expirationTime;
swap.hashedSecret = hashedSecret;
// Transfer fee to fee recipient
FEE_RECIPIENT.transfer(fee);
}
/**
@notice Batch execution of convertIntoHtlc() function
*/
function batchConvertIntoHtlc(
bytes32[] msigIds,
address[] beneficiaries,
uint[] amounts,
uint[] fees,
uint[] expirationTimes,
bytes32[] hashedSecrets
)
public
returns (bytes32[] swapId)
{
require(msigIds.length <= MAX_BATCH_ITERATIONS);
for (uint i = 0; i < msigIds.length; ++i)
convertIntoHtlc(
msigIds[i],
beneficiaries[i],
amounts[i],
fees[i],
expirationTimes[i],
hashedSecrets[i]
); // Gas estimate `infinite`
}
/**
@notice Withdraw ether and delete the htlc swap. Equivalent to REGULAR_TRANSFER in Nimiq
@dev Transfer swap amount to beneficiary of swap and fee to authority
@param swapId Unique (initiator, beneficiary, amount, fee, expirationTime, hashedSecret) swap identifier
@param secret Hashed secret of htlc swap
*/
function regularTransfer(bytes32 swapId, bytes32 secret)
public
{
// Require valid secret provided
require(sha256(secret) == atomicswaps[swapId].hashedSecret);
uint amount = atomicswaps[swapId].amount;
address beneficiary = atomicswaps[swapId].beneficiary;
// Delete swap
delete atomicswaps[swapId];
// Execute swap
beneficiary.transfer(amount);
}
/**
@notice Batch exection of regularTransfer() function
*/
function batchRegularTransfers(bytes32[] swapIds, bytes32[] secrets)
public
{
require(swapIds.length <= MAX_BATCH_ITERATIONS);
for (uint i = 0; i < swapIds.length; ++i)
regularTransfer(swapIds[i], secrets[i]); // Gas estimate `infinite`
}
/**
@notice Reclaim an expired, non-empty swap into a multisig
@dev Transfer swap amount to beneficiary of swap and fee to authority
@param msigId Unique (owner, authority, balance != 0) multisig identifier to which deposit expired swaps
@param swapId Unique (initiator, beneficiary, amount, fee, expirationTime, hashedSecret) swap identifier
*/
function reclaimExpiredSwap(bytes32 msigId, bytes32 swapId)
public
{
// Require: msg.sender == ower or authority
require(
multisigs[msigId].owner == msg.sender ||
multisigs[msigId].authority == msg.sender
);
// Require msigId matches swapId
require(msigId == atomicswaps[swapId].msigId);
// Require: is expired
require(now >= atomicswaps[swapId].expirationTime);
uint amount = atomicswaps[swapId].amount;
delete atomicswaps[swapId];
multisigs[msigId].deposit = add(multisigs[msigId].deposit, amount);
}
/**
@notice Batch exection of reclaimExpiredSwaps() function
*/
function batchReclaimExpiredSwaps(bytes32 msigId, bytes32[] swapIds)
public
{
require(swapIds.length <= MAX_BATCH_ITERATIONS); // << block.gaslimit / 88281
for (uint i = 0; i < swapIds.length; ++i)
reclaimExpiredSwap(msigId, swapIds[i]); // Gas estimate 88281
}
}
|
0x6080604052600436106100c45763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c4f8f6f81146100c957806348e7a100146100e65780634f55f292146100f457806359391a671461013657806377699a061461019657806389b898b8146101b15780638b55578914610373578063b6f9fda5146103bd578063d79c1f7f146103d8578063e56c815514610432578063ee5e415914610449578063f02fc78f146104a5578063f71d066914610533575b600080fd5b3480156100d557600080fd5b506100e460043560243561055f565b005b6100e4600435602435610665565b34801561010057600080fd5b50610124600435600160a060020a036024351660443560643560843560a4356106f8565b60408051918252519081900360200190f35b34801561014257600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526100e494823594602480359536959460649492019190819084018382808284375094975061092c9650505050505050565b3480156101a257600080fd5b506100e4600435602435610a29565b3480156101bd57600080fd5b506040805160206004803580820135838102808601850190965280855261032395369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610b3f9650505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561035f578181015183820152602001610347565b505050509050019250505060405180910390f35b34801561037f57600080fd5b5061038b600435610c0d565b60408051600160a060020a03958616815293909416602084015282840191909152606082015290519081900360800190f35b3480156103c957600080fd5b506100e4600435602435610c41565b3480156103e457600080fd5b506040805160206004602480358281013584810280870186019097528086526100e496843596369660449591949091019291829185019084908082843750949750610c889650505050505050565b610124600160a060020a0360043516602435610cd6565b34801561045557600080fd5b50610461600435610dcf565b60408051978852600160a060020a03968716602089015294909516868501526060860192909252608085015260a084015260c0830191909152519081900360e00190f35b3480156104b157600080fd5b50604080516020600480358082013583810280860185019096528085526100e495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610e189650505050505050565b34801561053f57600080fd5b5061054b600435610e78565b604080519115158252519081900360200190f35b600082815260016020908152604080832060060154815185815291518493919260029281810192909181900382018187865af11580156105a3573d6000803e3d6000fd5b5050506040513d60208110156105b857600080fd5b5051146105c457600080fd5b50506000828152600160208190526040808320600381018054600283018054878555958401805473ffffffffffffffffffffffffffffffffffffffff1990811690915586169055908590556004820185905560058201859055600690910184905590519092600160a060020a0390921691829184156108fc0291859190818181858888f1935050505015801561065e573d6000803e3d6000fd5b5050505050565b600082815260208190526040812054600160a060020a0316331461068857600080fd5b50600082815260208190526040902060028101546106a69034610e8d565b600282015560038101548210156106b957fe5b600381018290556040805184815290517fd38d2e55758d88ddc85725e6f35ada53c5c50d90a4f92140ac2b440b5516162e9181900360200190a1505050565b6000868152602081905260408120548190600160a060020a0316331461071d57600080fd5b600088815260208190526040902060020154868601111561073d57600080fd5b83421115801561076e575060008881526020819052604090206003015461076a9062015180420190610ea3565b8411155b151561077957600080fd5b6000861161078657600080fd5b60008381526002602052604090205460ff16156107a257600080fd5b6000838152600260208181526040808420805460ff191660011790558b84529083905290912001546107dd906107d88888610e8d565b610ebc565b600089815260208181526040918290206002019290925580518a81526c0100000000000000000000000033810282850152600160a060020a038b1602603482015260488101899052606881018890526088810187905260a8810186905281519081900360c801812080825291519194507f234740a705c7294747290e3973b4c8d5810692061dfca7b2ec05344e3244fe3092908290030190a15060008181526001602081905260408083208a815591820180543373ffffffffffffffffffffffffffffffffffffffff1991821617909155600283018054909116600160a060020a038b161790556003820188905560048201879055600582018690556006820185905551909173478189a0af876598c8a70ce8896960500455a949916108fc88150291889190818181858888f19350505050158015610920573d6000803e3d6000fd5b50509695505050505050565b600083815260208190526040812054600160a060020a031633148061096a5750600084815260208190526040902060010154600160a060020a031633145b151561097557600080fd5b600084815260208190526040902054600160a060020a031633146109b057600084815260208190526040902054600160a060020a03166109cc565b600084815260208190526040902060010154600160a060020a03165b90506109e7826109db86610ecc565b9063ffffffff610f0a16565b600160a060020a038281169116146109fe57600080fd5b600084815260208190526040902054610a239085908590600160a060020a0316610fdf565b50505050565b600082815260208190526040812054600160a060020a0316331480610a675750600083815260208190526040902060010154600160a060020a031633145b1515610a7257600080fd5b6000828152600160205260409020548314610a8c57600080fd5b600082815260016020526040902060050154421015610aaa57600080fd5b506000818152600160208181526040808420600381018054868355948201805473ffffffffffffffffffffffffffffffffffffffff199081169091556002808401805490921690915590869055600482018690556005820186905560069091018590558685529184905290922090910154610b259082610e8d565b600093845260208490526040909320600201929092555050565b606060006019885111151515610b5457600080fd5b5060005b8751811015610c0257610bf98882815181101515610b7257fe5b906020019060200201518883815181101515610b8a57fe5b906020019060200201518884815181101515610ba257fe5b906020019060200201518885815181101515610bba57fe5b906020019060200201518886815181101515610bd257fe5b906020019060200201518887815181101515610bea57fe5b906020019060200201516106f8565b50600101610b58565b509695505050505050565b6000602081905290815260409020805460018201546002830154600390930154600160a060020a0392831693919092169184565b600082815260208190526040902060030154421015610c5f57600080fd5b600082815260208190526040902054610c849083908390600160a060020a0316610fdf565b5050565b60006019825111151515610c9b57600080fd5b5060005b8151811015610cd157610cc9838383815181101515610cba57fe5b90602001906020020151610a29565b600101610c9f565b505050565b60008033600160a060020a0385161415610cef57600080fd5b60003411610cfc57600080fd5b604080516c010000000000000000000000003381028252600160a060020a03871602601482015234602882015260488101859052815190819003606801812080825291519193507f542f0adac9864069fdc036596079fadf5b1e3ab50311a5bf9ad6458de05ff80c919081900360200190a150600081815260208190526040902060028101541515610dbe5780543373ffffffffffffffffffffffffffffffffffffffff19918216178255600182018054909116600160a060020a0386161790555b610dc88284610665565b5092915050565b60016020819052600091825260409091208054918101546002820154600383015460048401546005850154600690950154600160a060020a039485169593909416939192909187565b60006019835111151515610e2b57600080fd5b5060005b8251811015610cd157610e708382815181101515610e4957fe5b906020019060200201518383815181101515610e6157fe5b9060200190602002015161055f565b600101610e2f565b60026020526000908152604090205460ff1681565b80820182811015610e9d57600080fd5b92915050565b600081831115610eb35781610eb5565b825b9392505050565b80820382811115610e9d57600080fd5b604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101839052905190819003603c019020919050565b60008060008084516041141515610f245760009350610fd6565b50505060208201516040830151606084015160001a601b60ff82161015610f4957601b015b8060ff16601b14158015610f6157508060ff16601c14155b15610f6f5760009350610fd6565b60408051600080825260208083018085528a905260ff8516838501526060830187905260808301869052925160019360a0808501949193601f19840193928390039091019190865af1158015610fc9573d6000803e3d6000fd5b5050506020604051035193505b50505092915050565b600083815260208190526040902060020154610ffb9083610ebc565b60008481526020819052604090206002018190551515611057576000838152602081905260408120805473ffffffffffffffffffffffffffffffffffffffff199081168255600182018054909116905560028101829055600301555b604051600160a060020a0382169083156108fc029084906000818181858888f19350505050158015610a23573d6000803e3d6000fd00a165627a7a723058202c351600866223ea4628020c094e70a60906db9a5bbbd1419710e1ac049cd4520029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,949 |
0x0e505cBCe59B4036f6fe5C7469AeFA4457521A8e
|
/**
*Submitted for verification at Etherscan.io on 2022-04-10
*/
/**
GoblinInu
Ownership Renounced + LP Locked for 30 days
Telegram: https://t.me/GoblinInu
*/
/**
*/
/**
*/
/**
*/
// 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 GoblinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Goblin Inu";
string private constant _symbol = "GINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x2A2eFad29894c07F984B6890f9a8e32414E39f88);
address payable private _marketingAddress = payable(0x2A2eFad29894c07F984B6890f9a8e32414E39f88);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b057600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195f565b6105fb565b005b34801561020a57600080fd5b5060408051808201909152600a815269476f626c696e20496e7560b01b60208201525b60405161023a9190611a24565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a79565b61069a565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611aa5565b6106b1565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601554610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae6565b61071a565b34801561036e57600080fd5b506101fc61037d366004611b13565b610765565b34801561038e57600080fd5b506101fc6107ad565b3480156103a357600080fd5b506102c26103b2366004611ae6565b6107f8565b3480156103c357600080fd5b506101fc61081a565b3480156103d857600080fd5b506101fc6103e7366004611b2e565b61088e565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae6565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610293565b34801561045957600080fd5b506101fc610468366004611b13565b6108bd565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b5060408051808201909152600481526347494e5560e01b602082015261022d565b3480156104bc57600080fd5b506101fc6104cb366004611b2e565b610905565b3480156104dc57600080fd5b506101fc6104eb366004611b47565b610934565b3480156104fc57600080fd5b5061026361050b366004611a79565b610972565b34801561051c57600080fd5b5061026361052b366004611ae6565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc61097f565b34801561056157600080fd5b506101fc610570366004611b79565b6109d3565b34801561058157600080fd5b506102c2610590366004611bfd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611b2e565b610a74565b3480156105e757600080fd5b506101fc6105f6366004611ae6565b610aa3565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611c36565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611c6b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611c97565b915050610631565b5050565b60006106a7338484610b8d565b5060015b92915050565b60006106be848484610cb1565b610710843361070b85604051806060016040528060288152602001611db1602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ed565b610b8d565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611c36565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611c36565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f581611227565b50565b6001600160a01b0381166000908152600260205260408120546106ab90611261565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611c36565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611c36565b601655565b6000546001600160a01b031633146108e75760405162461bcd60e51b815260040161062590611c36565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092f5760405162461bcd60e51b815260040161062590611c36565b601855565b6000546001600160a01b0316331461095e5760405162461bcd60e51b815260040161062590611c36565b600893909355600a91909155600955600b55565b60006106a7338484610cb1565b6012546001600160a01b0316336001600160a01b031614806109b457506013546001600160a01b0316336001600160a01b0316145b6109bd57600080fd5b60006109c8306107f8565b90506107f5816112e5565b6000546001600160a01b031633146109fd5760405162461bcd60e51b815260040161062590611c36565b60005b82811015610a6e578160056000868685818110610a1f57610a1f611c6b565b9050602002016020810190610a349190611ae6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6681611c97565b915050610a00565b50505050565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b815260040161062590611c36565b601755565b6000546001600160a01b03163314610acd5760405162461bcd60e51b815260040161062590611c36565b6001600160a01b038116610b325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610c505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d155760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610d775760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610dd95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610e0557506000546001600160a01b03838116911614155b156110e657601554600160a01b900460ff16610e9e576000546001600160a01b03848116911614610e9e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b601654811115610ef05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3257506001600160a01b03821660009081526010602052604090205460ff16155b610f8a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b0383811691161461100f5760175481610fac846107f8565b610fb69190611cb2565b1061100f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b600061101a306107f8565b6018546016549192508210159082106110335760165491505b80801561104a5750601554600160a81b900460ff16155b801561106457506015546001600160a01b03868116911614155b80156110795750601554600160b01b900460ff165b801561109e57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c357506001600160a01b03841660009081526005602052604090205460ff16155b156110e3576110d1826112e5565b4780156110e1576110e147611227565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112857506001600160a01b03831660009081526005602052604090205460ff165b8061115a57506015546001600160a01b0385811691161480159061115a57506015546001600160a01b03848116911614155b15611167575060006111e1565b6015546001600160a01b03858116911614801561119257506014546001600160a01b03848116911614155b156111a457600854600c55600954600d555b6015546001600160a01b0384811691161480156111cf57506014546001600160a01b03858116911614155b156111e157600a54600c55600b54600d555b610a6e8484848461146e565b600081848411156112115760405162461bcd60e51b81526004016106259190611a24565b50600061121e8486611cca565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b60006006548211156112c85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b60006112d261149c565b90506112de83826114bf565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132d5761132d611c6b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138157600080fd5b505afa158015611395573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b99190611ce1565b816001815181106113cc576113cc611c6b565b6001600160a01b0392831660209182029290920101526014546113f29130911684610b8d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142b908590600090869030904290600401611cfe565b600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147b5761147b611501565b61148684848461152f565b80610a6e57610a6e600e54600c55600f54600d55565b60008060006114a9611626565b90925090506114b882826114bf565b9250505090565b60006112de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611666565b600c541580156115115750600d54155b1561151857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154187611694565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157390876116f1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a29086611733565b6001600160a01b0389166000908152600260205260409020556115c481611792565b6115ce84836117dc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161391815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164182826114bf565b82101561165d57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116875760405162461bcd60e51b81526004016106259190611a24565b50600061121e8486611d6f565b60008060008060008060008060006116b18a600c54600d54611800565b92509250925060006116c161149c565b905060008060006116d48e878787611855565b919e509c509a509598509396509194505050505091939550919395565b60006112de83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ed565b6000806117408385611cb2565b9050838110156112de5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b600061179c61149c565b905060006117aa83836118a5565b306000908152600260205260409020549091506117c79082611733565b30600090815260026020526040902055505050565b6006546117e990836116f1565b6006556007546117f99082611733565b6007555050565b600080808061181a606461181489896118a5565b906114bf565b9050600061182d60646118148a896118a5565b905060006118458261183f8b866116f1565b906116f1565b9992985090965090945050505050565b600080808061186488866118a5565b9050600061187288876118a5565b9050600061188088886118a5565b905060006118928261183f86866116f1565b939b939a50919850919650505050505050565b6000826118b4575060006106ab565b60006118c08385611d91565b9050826118cd8583611d6f565b146112de5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b803561195a8161193a565b919050565b6000602080838503121561197257600080fd5b823567ffffffffffffffff8082111561198a57600080fd5b818501915085601f83011261199e57600080fd5b8135818111156119b0576119b0611924565b8060051b604051601f19603f830116810181811085821117156119d5576119d5611924565b6040529182528482019250838101850191888311156119f357600080fd5b938501935b82851015611a1857611a098561194f565b845293850193928501926119f8565b98975050505050505050565b600060208083528351808285015260005b81811015611a5157858101830151858201604001528201611a35565b81811115611a63576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8c57600080fd5b8235611a978161193a565b946020939093013593505050565b600080600060608486031215611aba57600080fd5b8335611ac58161193a565b92506020840135611ad58161193a565b929592945050506040919091013590565b600060208284031215611af857600080fd5b81356112de8161193a565b8035801515811461195a57600080fd5b600060208284031215611b2557600080fd5b6112de82611b03565b600060208284031215611b4057600080fd5b5035919050565b60008060008060808587031215611b5d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8e57600080fd5b833567ffffffffffffffff80821115611ba657600080fd5b818601915086601f830112611bba57600080fd5b813581811115611bc957600080fd5b8760208260051b8501011115611bde57600080fd5b602092830195509350611bf49186019050611b03565b90509250925092565b60008060408385031215611c1057600080fd5b8235611c1b8161193a565b91506020830135611c2b8161193a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cab57611cab611c81565b5060010190565b60008219821115611cc557611cc5611c81565b500190565b600082821015611cdc57611cdc611c81565b500390565b600060208284031215611cf357600080fd5b81516112de8161193a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4e5784516001600160a01b031683529383019391830191600101611d29565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dab57611dab611c81565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e6d88d509256a5bbf65befd12be553dac1f02d4e6dfe4d277a4bb5794c05d20f64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,950 |
0x1efee03fd6e0f98dfda025a5f90b52fb5c91e314
|
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, 'FullMath::mulDiv: overflow');
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self) internal pure returns (uint) {
return uint(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns ( address );
function token1() external view returns ( address );
}
interface IBondingCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract TimeBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
address public immutable Time;
constructor( address _Time ) {
require( _Time != address(0) );
Time = _Time;
}
function getKValue( address _pair ) public view returns( uint k_ ) {
uint token0 = IERC20( IUniswapV2Pair( _pair ).token0() ).decimals();
uint token1 = IERC20( IUniswapV2Pair( _pair ).token1() ).decimals();
uint decimals = token0.add( token1 ).sub( IERC20( _pair ).decimals() );
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
k_ = reserve0.mul(reserve1).div( 10 ** decimals );
}
function getTotalValue( address _pair ) public view returns ( uint _value ) {
_value = getKValue( _pair ).sqrrt().mul(2);
}
function valuation( address _pair, uint amount_ ) external view override returns ( uint _value ) {
uint totalValue = getTotalValue( _pair );
uint totalSupply = IUniswapV2Pair( _pair ).totalSupply();
_value = totalValue.mul( FixedPoint.fraction( amount_, totalSupply ).decode112with18() ).div( 1e18 );
}
function markdown( address _pair ) external view returns ( uint ) {
( uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
uint reserve;
if ( IUniswapV2Pair( _pair ).token0() == Time ) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return reserve.mul( 2 * ( 10 ** IERC20( Time ).decimals() ) ).div( getTotalValue( _pair ) );
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c806332da80a31461005c5780634249719f14610094578063490084ef146100c057806368637549146100e6578063f8e157ea1461010c575b600080fd5b6100826004803603602081101561007257600080fd5b50356001600160a01b0316610130565b60408051918252519081900360200190f35b610082600480360360408110156100aa57600080fd5b506001600160a01b038135169060200135610313565b610082600480360360208110156100d657600080fd5b50356001600160a01b03166103bb565b610082600480360360208110156100fc57600080fd5b50356001600160a01b03166106a1565b6101146106c5565b604080516001600160a01b039092168252519081900360200190f35b6000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561016e57600080fd5b505afa158015610182573d6000803e3d6000fd5b505050506040513d606081101561019857600080fd5b50805160209182015160408051630dfe168160e01b815290516001600160701b0393841696509290911693506000926001600160a01b037f000000000000000000000000f55e77c77f933d252fbb6692f4cc060ad82de51081169390891692630dfe1681926004808301939192829003018186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b50516001600160a01b0316141561025b57508061025e565b50815b61030861026a866106a1565b6103027f000000000000000000000000f55e77c77f933d252fbb6692f4cc060ad82de5106001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c657600080fd5b505afa1580156102da573d6000803e3d6000fd5b505050506040513d60208110156102f057600080fd5b5051849060ff16600a0a6002026106e9565b90610749565b93505050505b919050565b60008061031f846106a1565b90506000846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561035c57600080fd5b505afa158015610370573d6000803e3d6000fd5b505050506040513d602081101561038657600080fd5b505190506103b2670de0b6b3a76400006103026103ab6103a6888661078b565b610902565b85906106e9565b95945050505050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156103f757600080fd5b505afa15801561040b573d6000803e3d6000fd5b505050506040513d602081101561042157600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b15801561046557600080fd5b505afa158015610479573d6000803e3d6000fd5b505050506040513d602081101561048f57600080fd5b50516040805163d21220a760e01b8152905160ff90921692506000916001600160a01b0386169163d21220a7916004808301926020929190829003018186803b1580156104db57600080fd5b505afa1580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d602081101561057357600080fd5b50516040805163313ce56760e01b8152905160ff9092169250600091610603916001600160a01b0388169163313ce56791600480820192602092909190829003018186803b1580156105c457600080fd5b505afa1580156105d8573d6000803e3d6000fd5b505050506040513d60208110156105ee57600080fd5b505160ff166105fd858561091a565b90610974565b9050600080866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561064157600080fd5b505afa158015610655573d6000803e3d6000fd5b505050506040513d606081101561066b57600080fd5b5080516020909101516001600160701b039182169350169050610696600a84900a61030284846106e9565b979650505050505050565b60006106bf60026106b96106b4856103bb565b6109b6565b906106e9565b92915050565b7f000000000000000000000000f55e77c77f933d252fbb6692f4cc060ad82de51081565b6000826106f8575060006106bf565b8282028284828161070557fe5b04146107425760405162461bcd60e51b8152600401808060200182810382526021815260200180610c876021913960400191505060405180910390fd5b9392505050565b600061074283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610a20565b610793610c4e565b600082116107d25760405162461bcd60e51b8152600401808060200182810382526026815260200180610c616026913960400191505060405180910390fd5b826107ec57506040805160208101909152600081526106bf565b71ffffffffffffffffffffffffffffffffffff831161089357600082607085901b8161081457fe5b0490506001600160e01b03811115610873576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b03168152509150506106bf565b60006108a484600160701b85610ac2565b90506001600160e01b03811115610873576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b516612725dd1d243ab6001600160e01b039091160490565b600082820183811015610742576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061074283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b57565b60006003821115610a1257508060006109da6109d3836002610749565b600161091a565b90505b81811015610a0c57809150610a056109fe6109f88584610749565b8361091a565b6002610749565b90506109dd565b5061030e565b811561030e57506001919050565b60008183610aac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a71578181015183820152602001610a59565b50505050905090810190601f168015610a9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610ab857fe5b0495945050505050565b6000806000610ad18686610bb1565b9150915060008480610adf57fe5b868809905082811115610af3576001820391505b8083039250848210610b4c576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015290519081900360640190fd5b610696838387610bde565b60008184841115610ba95760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610a71578181015183820152602001610a59565b505050900390565b6000808060001984860990508385029250828103915082811015610bd6576001820391505b509250929050565b60008181038216808381610bee57fe5b049250808581610bfa57fe5b049450808160000381610c0957fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040805160208101909152600081529056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220f3ab8476d25b62d7e61f381929a61aa9abcf550a08876c8fc4afe31292d746cd64736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,951 |
0x28ee82130e9a394d8ebf0a0ee33fa230ce19a348
|
/**
*Submitted for verification at Etherscan.io on 2021-08-14
*/
// 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 LEAP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Leap Lottery";
string private constant _symbol = "LEAP";
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 = 20000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 10;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _lottery;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_lottery = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_lottery] = 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 maxTxamountReturn() public view returns (uint256) {
return _maxTxAmount;
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 0;
_teamFee = 10;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 10;
_taxFee = 0;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_lottery.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 60000000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063c3c8cd8011610074578063d543dbeb11610059578063d543dbeb1461035e578063dd62ed3e1461037e578063e8078d94146103c457600080fd5b8063c3c8cd8014610334578063c9567bf91461034957600080fd5b8063715018a6146102915780638da5cb5b146102a657806395d89b41146102ce578063a9059cbb1461031457600080fd5b8063313ce567116100fc5780635932ead1116100e15780635932ead11461023a5780636fc3eaec1461025c57806370a082311461027157600080fd5b8063313ce5671461020957806349b6cf711461022557600080fd5b806306fdde0314610139578063095ea7b31461019157806318160ddd146101c157806323b872dd146101e957600080fd5b3661013457005b600080fd5b34801561014557600080fd5b5060408051808201909152600c81527f4c656170204c6f7474657279000000000000000000000000000000000000000060208201525b6040516101889190611f3b565b60405180910390f35b34801561019d57600080fd5b506101b16101ac366004611e93565b6103d9565b6040519015158152602001610188565b3480156101cd57600080fd5b506a108b2a2c280290940000005b604051908152602001610188565b3480156101f557600080fd5b506101b1610204366004611e53565b6103f0565b34801561021557600080fd5b5060405160098152602001610188565b34801561023157600080fd5b506013546101db565b34801561024657600080fd5b5061025a610255366004611ebe565b610459565b005b34801561026857600080fd5b5061025a610506565b34801561027d57600080fd5b506101db61028c366004611de3565b610533565b34801561029d57600080fd5b5061025a610555565b3480156102b257600080fd5b506000546040516001600160a01b039091168152602001610188565b3480156102da57600080fd5b5060408051808201909152600481527f4c45415000000000000000000000000000000000000000000000000000000000602082015261017b565b34801561032057600080fd5b506101b161032f366004611e93565b610611565b34801561034057600080fd5b5061025a61061e565b34801561035557600080fd5b5061025a610654565b34801561036a57600080fd5b5061025a610379366004611ef6565b610717565b34801561038a57600080fd5b506101db610399366004611e1b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103d057600080fd5b5061025a61081d565b60006103e6338484610c7f565b5060015b92915050565b60006103fd848484610dd7565b61044f843361044a8560405180606001604052806028815260200161214d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611554565b610c7f565b5060019392505050565b6000546001600160a01b031633146104b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b601280549115157801000000000000000000000000000000000000000000000000027fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b600f546001600160a01b0316336001600160a01b03161461052657600080fd5b476105308161158e565b50565b6001600160a01b0381166000908152600260205260408120546103ea90611613565b6000546001600160a01b031633146105af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104af565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60006103e6338484610dd7565b600f546001600160a01b0316336001600160a01b03161461063e57600080fd5b600061064930610533565b9050610530816116aa565b6000546001600160a01b031633146106ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104af565b6012547501000000000000000000000000000000000000000000900460ff166106d657600080fd5b601280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000546001600160a01b031633146107715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104af565b600081116107c15760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104af565b6107e26127106107dc6a108b2a2c28029094000000846118fc565b90611997565b60138190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146108775760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104af565b601180547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108ce30826a108b2a2c28029094000000610c7f565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561090757600080fd5b505afa15801561091b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093f9190611dff565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561098757600080fd5b505afa15801561099b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bf9190611dff565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a1f57600080fd5b505af1158015610a33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a579190611dff565b601280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556011541663f305d7194730610a9f81610533565b600080610ab46000546001600160a01b031690565b60405160e088901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b689190611f0e565b5050601280547fffffffffffffff0000ff00ffffffffffffffffffffffffffffffffffffffffff8116780101000100000000000000000000000000000000000000000017909155690cb49b44ba602d8000006013556011546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529116915063095ea7b390604401602060405180830381600087803b158015610c4357600080fd5b505af1158015610c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7b9190611eda565b5050565b6001600160a01b038316610cfa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104af565b6001600160a01b038216610d765760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104af565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e535760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104af565b6001600160a01b038216610ecf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104af565b60008111610f455760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d75737420626520677265617465722060448201527f7468616e207a65726f000000000000000000000000000000000000000000000060648201526084016104af565b6000546001600160a01b03848116911614801590610f7157506000546001600160a01b03838116911614155b156114f7576012547801000000000000000000000000000000000000000000000000900460ff1615611079576001600160a01b0383163014801590610fbf57506001600160a01b0382163014155b8015610fd957506011546001600160a01b03848116911614155b8015610ff357506011546001600160a01b03838116911614155b15611079576011546001600160a01b0316336001600160a01b0316148061102d57506012546001600160a01b0316336001600160a01b0316145b6110795760405162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c7900000000000000000000000000000060448201526064016104af565b6001600160a01b0383166000908152600a602052604090205460ff161580156110bb57506001600160a01b0382166000908152600a602052604090205460ff16155b6110c457600080fd5b6012546001600160a01b0384811691161480156110ef57506011546001600160a01b03838116911614155b801561111457506001600160a01b03821660009081526005602052604090205460ff16155b801561113e57506012547801000000000000000000000000000000000000000000000000900460ff165b156111cd5760125474010000000000000000000000000000000000000000900460ff1661116a57600080fd5b60135481111561117957600080fd5b6001600160a01b0382166000908152600b6020526040902054421161119d57600080fd5b6111a842601e61201c565b6001600160a01b0383166000908152600b6020526040812091909155600a6009556008555b60006111d830610533565b601254909150760100000000000000000000000000000000000000000000900460ff1615801561121657506012546001600160a01b03858116911614155b801561123f575060125477010000000000000000000000000000000000000000000000900460ff165b156114f55760125461126d906064906107dc90600390611267906001600160a01b0316610533565b906118fc565b821115801561127e57506013548211155b61128757600080fd5b6001600160a01b0384166000908152600c602052604090205442116112ab57600080fd5b6001600160a01b0384166000908152600d602052604090205442906112d3906201518061201c565b10156112f3576001600160a01b0384166000908152600e60205260408120555b6001600160a01b0384166000908152600e6020526040902054611380576001600160a01b0384166000908152600e60205260408120805491611334836120c1565b90915550506001600160a01b0384166000908152600d60205260409020429081905561136290610e1061201c565b6001600160a01b0385166000908152600c60205260409020556114b8565b6001600160a01b0384166000908152600e6020526040902054600114156113d7576001600160a01b0384166000908152600e602052604081208054916113c5836120c1565b90915550611362905042611c2061201c565b6001600160a01b0384166000908152600e60205260409020546002141561142e576001600160a01b0384166000908152600e6020526040812080549161141c836120c1565b9091555061136290504261546061201c565b6001600160a01b0384166000908152600e6020526040902054600314156114b8576001600160a01b0384166000908152600e60205260408120805491611473836120c1565b90915550506001600160a01b0384166000908152600d602052604090205461149e906201518061201c565b6001600160a01b0385166000908152600c60205260409020555b6114c1816116aa565b4780156114d1576114d14761158e565b6001600160a01b0385166000908152600e60205260409020546114f3906119d9565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061153957506001600160a01b03831660009081526005602052604090205460ff165b15611542575060005b61154e848484846119fb565b50505050565b600081848411156115785760405162461bcd60e51b81526004016104af9190611f3b565b50600061158584866120aa565b95945050505050565b600f546001600160a01b03166108fc6115a8836002611997565b6040518115909202916000818181858888f193505050501580156115d0573d6000803e3d6000fd5b506010546001600160a01b03166108fc6115eb836002611997565b6040518115909202916000818181858888f19350505050158015610c7b573d6000803e3d6000fd5b600060065482111561168d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201527f65666c656374696f6e730000000000000000000000000000000000000000000060648201526084016104af565b6000611697611a27565b90506116a38382611997565b9392505050565b601280547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff167601000000000000000000000000000000000000000000001790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611747577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601154604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b1580156117b457600080fd5b505afa1580156117c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ec9190611dff565b81600181518110611826577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260115461184c9130911684610c7f565b6011546040517f791ac9470000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063791ac9479061189e908590600090869030904290600401611fac565b600060405180830381600087803b1580156118b857600080fd5b505af11580156118cc573d6000803e3d6000fd5b5050601280547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16905550505050565b60008261190b575060006103ea565b6000611917838561206d565b9050826119248583612034565b146116a35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f770000000000000000000000000000000000000000000000000000000000000060648201526084016104af565b60006116a383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a4a565b806008546119e7919061206d565b600855600181111561053057600a60095550565b80611a0857611a08611a78565b611a13848484611a9b565b8061154e5761154e6000600855600a600955565b6000806000611a34611b92565b9092509050611a438282611997565b9250505090565b60008183611a6b5760405162461bcd60e51b81526004016104af9190611f3b565b5060006115858486612034565b600854158015611a885750600954155b15611a8f57565b60006008819055600955565b600080600080600080611aad87611bd8565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611adf9087611c35565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611b0e9086611c77565b6001600160a01b038916600090815260026020526040902055611b3081611cd6565b611b3a8483611d20565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b7f91815260200190565b60405180910390a3505050505050505050565b60065460009081906a108b2a2c28029094000000611bb08282611997565b821015611bcf575050600654926a108b2a2c2802909400000092509050565b90939092509050565b6000806000806000806000806000611bf58a600854600954611d44565b9250925092506000611c05611a27565b90506000806000611c188e878787611d93565b919e509c509a509598509396509194505050505091939550919395565b60006116a383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611554565b600080611c84838561201c565b9050838110156116a35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104af565b6000611ce0611a27565b90506000611cee83836118fc565b30600090815260026020526040902054909150611d0b9082611c77565b30600090815260026020526040902055505050565b600654611d2d9083611c35565b600655600754611d3d9082611c77565b6007555050565b6000808080611d5860646107dc89896118fc565b90506000611d6b60646107dc8a896118fc565b90506000611d8382611d7d8b86611c35565b90611c35565b9992985090965090945050505050565b6000808080611da288866118fc565b90506000611db088876118fc565b90506000611dbe88886118fc565b90506000611dd082611d7d8686611c35565b939b939a50919850919650505050505050565b600060208284031215611df4578081fd5b81356116a381612129565b600060208284031215611e10578081fd5b81516116a381612129565b60008060408385031215611e2d578081fd5b8235611e3881612129565b91506020830135611e4881612129565b809150509250929050565b600080600060608486031215611e67578081fd5b8335611e7281612129565b92506020840135611e8281612129565b929592945050506040919091013590565b60008060408385031215611ea5578182fd5b8235611eb081612129565b946020939093013593505050565b600060208284031215611ecf578081fd5b81356116a38161213e565b600060208284031215611eeb578081fd5b81516116a38161213e565b600060208284031215611f07578081fd5b5035919050565b600080600060608486031215611f22578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611f6757858101830151858201604001528201611f4b565b81811115611f785783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ffb5784516001600160a01b031683529383019391830191600101611fd6565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561202f5761202f6120fa565b500190565b600082612068577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120a5576120a56120fa565b500290565b6000828210156120bc576120bc6120fa565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156120f3576120f36120fa565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6001600160a01b038116811461053057600080fd5b801515811461053057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220797c1bf0afc35c9923a262a12283a7626e1b6db18e4795354e71b342f1dd09f864736f6c63430008040033
|
{"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"}]}}
| 2,952 |
0x44565458af299ea747e98c5851d811ff624bfe25
|
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: UNLICENSED
/*
[email protected] WOMENKONG
*/
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 WOMENKONG 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 = "WOMEN KONG";
string private constant _symbol = "WOMENKONG";
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(0x21F1F141d08ea0F8Ccc19e1622547375F0e2f378);
_buyTax = 12;
_sellTax = 12;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 200000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 12) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 12) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034b578063c3c8cd801461036b578063c9567bf914610380578063dbe8272c14610395578063dc1052e2146103b5578063dd62ed3e146103d557600080fd5b8063715018a6146102a75780638da5cb5b146102bc57806395d89b41146102e45780639e78fb4f14610316578063a9059cbb1461032b57600080fd5b806323b872dd116100f257806323b872dd14610216578063273123b714610236578063313ce567146102565780636fc3eaec1461027257806370a082311461028757600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a157806318160ddd146101d15780631bbae6e0146101f657600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a6101553660046118ce565b61041b565b005b34801561016857600080fd5b5060408051808201909152600a815269574f4d454e204b4f4e4760b01b60208201525b604051610198919061194f565b60405180910390f35b3480156101ad57600080fd5b506101c16101bc3660046117d6565b61046c565b6040519015158152602001610198565b3480156101dd57600080fd5b50670de0b6b3a76400005b604051908152602001610198565b34801561020257600080fd5b5061015a610211366004611908565b610483565b34801561022257600080fd5b506101c1610231366004611795565b6104c6565b34801561024257600080fd5b5061015a610251366004611722565b61052f565b34801561026257600080fd5b5060405160098152602001610198565b34801561027e57600080fd5b5061015a61057a565b34801561029357600080fd5b506101e86102a2366004611722565b6105ae565b3480156102b357600080fd5b5061015a6105d0565b3480156102c857600080fd5b506000546040516001600160a01b039091168152602001610198565b3480156102f057600080fd5b50604080518082019091526009815268574f4d454e4b4f4e4760b81b602082015261018b565b34801561032257600080fd5b5061015a610644565b34801561033757600080fd5b506101c16103463660046117d6565b610883565b34801561035757600080fd5b5061015a610366366004611802565b610890565b34801561037757600080fd5b5061015a610926565b34801561038c57600080fd5b5061015a610966565b3480156103a157600080fd5b5061015a6103b0366004611908565b610b2d565b3480156103c157600080fd5b5061015a6103d0366004611908565b610b65565b3480156103e157600080fd5b506101e86103f036600461175c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044e5760405162461bcd60e51b8152600401610445906119a4565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610479338484610b9d565b5060015b92915050565b6000546001600160a01b031633146104ad5760405162461bcd60e51b8152600401610445906119a4565b6702c68af0bb1400008111156104c35760108190555b50565b60006104d3848484610cc1565b610525843361052085604051806060016040528060288152602001611b3b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ff6565b610b9d565b5060019392505050565b6000546001600160a01b031633146105595760405162461bcd60e51b8152600401610445906119a4565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a45760405162461bcd60e51b8152600401610445906119a4565b476104c381611030565b6001600160a01b03811660009081526002602052604081205461047d9061106a565b6000546001600160a01b031633146105fa5760405162461bcd60e51b8152600401610445906119a4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066e5760405162461bcd60e51b8152600401610445906119a4565b600f54600160a01b900460ff16156106c85760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610445565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072857600080fd5b505afa15801561073c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610760919061173f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a857600080fd5b505afa1580156107bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e0919061173f565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082857600080fd5b505af115801561083c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610860919061173f565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610479338484610cc1565b6000546001600160a01b031633146108ba5760405162461bcd60e51b8152600401610445906119a4565b60005b8151811015610922576001600660008484815181106108de576108de611aeb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091a81611aba565b9150506108bd565b5050565b6000546001600160a01b031633146109505760405162461bcd60e51b8152600401610445906119a4565b600061095b306105ae565b90506104c3816110ee565b6000546001600160a01b031633146109905760405162461bcd60e51b8152600401610445906119a4565b600e546109b09030906001600160a01b0316670de0b6b3a7640000610b9d565b600e546001600160a01b031663f305d71947306109cc816105ae565b6000806109e16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4457600080fd5b505af1158015610a58573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7d9190611921565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c391906118eb565b6000546001600160a01b03163314610b575760405162461bcd60e51b8152600401610445906119a4565b600c8110156104c357600b55565b6000546001600160a01b03163314610b8f5760405162461bcd60e51b8152600401610445906119a4565b600c8110156104c357600c55565b6001600160a01b038316610bff5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610445565b6001600160a01b038216610c605760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610445565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610445565b6001600160a01b038216610d875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610445565b60008111610de95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610445565b6001600160a01b03831660009081526006602052604090205460ff1615610e0f57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5157506001600160a01b03821660009081526005602052604090205460ff16155b15610fe6576000600955600c54600a55600f546001600160a01b038481169116148015610e8c5750600e546001600160a01b03838116911614155b8015610eb157506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec65750600f54600160b81b900460ff165b15610ef3576000610ed6836105ae565b601054909150610ee68383611277565b1115610ef157600080fd5b505b600f546001600160a01b038381169116148015610f1e5750600e546001600160a01b03848116911614155b8015610f4357506001600160a01b03831660009081526005602052604090205460ff16155b15610f54576000600955600b54600a555b6000610f5f306105ae565b600f54909150600160a81b900460ff16158015610f8a5750600f546001600160a01b03858116911614155b8015610f9f5750600f54600160b01b900460ff165b15610fe4576000610fb1600483611a62565b9050610fbd8183611aa3565b9150610fc8816112d6565b610fd1826110ee565b478015610fe157610fe147611030565b50505b505b610ff183838361130c565b505050565b6000818484111561101a5760405162461bcd60e51b8152600401610445919061194f565b5060006110278486611aa3565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610922573d6000803e3d6000fd5b60006007548211156110d15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610445565b60006110db611317565b90506110e7838261133a565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061113657611136611aeb565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561118a57600080fd5b505afa15801561119e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c2919061173f565b816001815181106111d5576111d5611aeb565b6001600160a01b039283166020918202929092010152600e546111fb9130911684610b9d565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112349085906000908690309042906004016119d9565b600060405180830381600087803b15801561124e57600080fd5b505af1158015611262573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112848385611a4a565b9050838110156110e75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610445565b600f805460ff60a81b1916600160a81b17905580156112fc576112fc3061dead83610cc1565b50600f805460ff60a81b19169055565b610ff183838361137c565b6000806000611324611473565b9092509050611333828261133a565b9250505090565b60006110e783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114b3565b60008060008060008061138e876114e1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113c0908761153e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113ef9086611277565b6001600160a01b03891660009081526002602052604090205561141181611580565b61141b84836115ca565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161146091815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a764000061148e828261133a565b8210156114aa57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114d45760405162461bcd60e51b8152600401610445919061194f565b5060006110278486611a62565b60008060008060008060008060006114fe8a600954600a546115ee565b925092509250600061150e611317565b905060008060006115218e878787611643565b919e509c509a509598509396509194505050505091939550919395565b60006110e783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ff6565b600061158a611317565b905060006115988383611693565b306000908152600260205260409020549091506115b59082611277565b30600090815260026020526040902055505050565b6007546115d7908361153e565b6007556008546115e79082611277565b6008555050565b600080808061160860646116028989611693565b9061133a565b9050600061161b60646116028a89611693565b905060006116338261162d8b8661153e565b9061153e565b9992985090965090945050505050565b60008080806116528886611693565b905060006116608887611693565b9050600061166e8888611693565b905060006116808261162d868661153e565b939b939a50919850919650505050505050565b6000826116a25750600061047d565b60006116ae8385611a84565b9050826116bb8583611a62565b146110e75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610445565b803561171d81611b17565b919050565b60006020828403121561173457600080fd5b81356110e781611b17565b60006020828403121561175157600080fd5b81516110e781611b17565b6000806040838503121561176f57600080fd5b823561177a81611b17565b9150602083013561178a81611b17565b809150509250929050565b6000806000606084860312156117aa57600080fd5b83356117b581611b17565b925060208401356117c581611b17565b929592945050506040919091013590565b600080604083850312156117e957600080fd5b82356117f481611b17565b946020939093013593505050565b6000602080838503121561181557600080fd5b823567ffffffffffffffff8082111561182d57600080fd5b818501915085601f83011261184157600080fd5b81358181111561185357611853611b01565b8060051b604051601f19603f8301168101818110858211171561187857611878611b01565b604052828152858101935084860182860187018a101561189757600080fd5b600095505b838610156118c1576118ad81611712565b85526001959095019493860193860161189c565b5098975050505050505050565b6000602082840312156118e057600080fd5b81356110e781611b2c565b6000602082840312156118fd57600080fd5b81516110e781611b2c565b60006020828403121561191a57600080fd5b5035919050565b60008060006060848603121561193657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561197c57858101830151858201604001528201611960565b8181111561198e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a295784516001600160a01b031683529383019391830191600101611a04565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a5d57611a5d611ad5565b500190565b600082611a7f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a9e57611a9e611ad5565b500290565b600082821015611ab557611ab5611ad5565b500390565b6000600019821415611ace57611ace611ad5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104c357600080fd5b80151581146104c357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201e53e8290d8423ad358249eb875441312748b2ac94ed7d0fadb2e3fd8016564c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,953 |
0xa7abb3186a245115d43d3940093a678f572726b7
|
pragma solidity ^0.4.23;
/*
* Creator:NASR (NASR)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* NASR smart contract.
*/
contract NASRToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 99999999999999 * (10**18);
/**
* 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 NASRToken () {
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 = "NASR";
string constant public symbol = "NASR";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ae6565b005b34801561043c57600080fd5b50610445610d06565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d3f565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dcb565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e52565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600481526020017f4e4153520000000000000000000000000000000000000000000000000000000081525081565b6000806106ed3385610dcb565b14806106f95750600082145b151561070457600080fd5b61070e8383610fb3565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b6108448484846110a5565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610adc576109d76d04ee2d6d415b77cc38cd589c000060045461148b565b8211156109e75760009050610ae1565b610a2f6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a4565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7d600454836114a4565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ae1565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4457600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7f57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c2557600080fd5b505af1158015610c39573d6000803e3d6000fd5b505050506040513d6020811015610c4f57600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f4e4153520000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9a57600080fd5b600560009054906101000a900460ff1615610db85760009050610dc5565b610dc283836114c2565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eae57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee957600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110e257600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561116f5760009050611484565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111be5760009050611484565b6000821180156111fa57508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561141a57611285600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361148b565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134d6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361148b565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113d76000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a4565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149957fe5b818303905092915050565b60008082840190508381101515156114b857fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114ff57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561154e576000905061170e565b60008211801561158a57508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156116a4576115d76000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361148b565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116616000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a4565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820f2e7fe7a3c45bca5e8c948b14bc3b89050daea8292358ec3bc5275ae61a7883b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,954 |
0x39369a1bc0047875220dc1097a2c4fc88da5ee5d
|
/**
*Submitted for verification at Etherscan.io on 2021-02-03
*/
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------
// Antidoge (ATDOGE)
// End of the Doge Era
// https://www.antidoge.finance
// https://t.me/AntiDoge
// ----------------------------------------------------------------------------
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; // 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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// ----------------------------------------------------------------------------
interface ERC20Interface {
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);
}
// ----------------------------------------------------------------------------
// 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) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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 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;
}
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 AntiDoge is ERC20Interface, Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it
uint256 public _totalSupply;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
uint256 public _poolCreatedBlock;
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(IUniswapV2Router02 _uniswapV2Router) public {
name = "AntiDoge";
symbol = "ATDOGE";
decimals = 18;
_totalSupply = 100000000000000000000000000000;
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function totalSupply() public view override returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) public view override returns (uint balance) {
return balances[tokenOwner];
}
function allowance(address tokenOwner, address spender) public view override returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approve(address spender, uint tokens) public override returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transfer(address to, uint tokens) public override returns (bool success) {
if(_msgSender() == uniswapV2Pair)
require(_poolCreatedBlock > 0 && block.number > _poolCreatedBlock + 10, 'ATDOGE: too early buy.');
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public override returns (bool success) {
if(from == uniswapV2Pair)
require(_poolCreatedBlock > 0 && block.number > _poolCreatedBlock + 10, 'ATDOGE: too early buy.');
if(balanceOf(uniswapV2Pair) == 0 && to == uniswapV2Pair)
_poolCreatedBlock = block.number;
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a082311161009757806395d89b411161006657806395d89b41146103e9578063a9059cbb1461046c578063dd62ed3e146104d0578063f2fde38b1461054857610100565b806370a0823114610335578063715018a61461038d57806382efac40146103975780638da5cb5b146103b557610100565b806323b872dd116100d357806323b872dd1461023e578063313ce567146102c25780633eaaf86b146102e357806349bd5a5e1461030157610100565b806306fdde0314610105578063095ea7b3146101885780631694505e146101ec57806318160ddd14610220575b600080fd5b61010d61058c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061062a565b60405180821515815260200191505060405180910390f35b6101f461071c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610228610740565b6040518082815260200191505060405180910390f35b6102aa6004803603606081101561025457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061079b565b60405180821515815260200191505060405180910390f35b6102ca610bb3565b604051808260ff16815260200191505060405180910390f35b6102eb610bc6565b6040518082815260200191505060405180910390f35b610309610bcc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103776004803603602081101561034b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf0565b6040518082815260200191505060405180910390f35b610395610c39565b005b61039f610dbf565b6040518082815260200191505060405180910390f35b6103bd610dc5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103f1610dee565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610431578082015181840152602081019050610416565b50505050905090810190601f16801561045e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104b86004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e8c565b60405180821515815260200191505060405180910390f35b610532600480360360408110156104e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061110b565b6040518082815260200191505060405180910390f35b61058a6004803603602081101561055e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611192565b005b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106225780601f106105f757610100808354040283529160200191610622565b820191906000526020600020905b81548152906001019060200180831161060557829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6000610796600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460045461139d90919063ffffffff16565b905090565b60007f00000000000000000000000063034ce6dde7d486377ef4540640bdab847e010a73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561087a5760006007541180156108075750600a6007540143115b610879576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4154444f47453a20746f6f206561726c79206275792e0000000000000000000081525060200191505060405180910390fd5b5b60006108a57f00000000000000000000000063034ce6dde7d486377ef4540640bdab847e010a610bf0565b1480156108fd57507f00000000000000000000000063034ce6dde7d486377ef4540640bdab847e010a73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b1561090a57436007819055505b61095c82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461139d90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a2e82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461139d90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0082600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113e790919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60045481565b7f00000000000000000000000063034ce6dde7d486377ef4540640bdab847e010a81565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610c4161146f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e845780601f10610e5957610100808354040283529160200191610e84565b820191906000526020600020905b815481529060010190602001808311610e6757829003601f168201915b505050505081565b60007f00000000000000000000000063034ce6dde7d486377ef4540640bdab847e010a73ffffffffffffffffffffffffffffffffffffffff16610ecd61146f565b73ffffffffffffffffffffffffffffffffffffffff161415610f72576000600754118015610eff5750600a6007540143115b610f71576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4154444f47453a20746f6f206561726c79206275792e0000000000000000000081525060200191505060405180910390fd5b5b610fc482600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461139d90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061105982600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113e790919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61119a61146f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461125a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156112e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806115386026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006113df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611477565b905092915050565b600080828401905083811015611465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b6000838311158290611524576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156114e95780820151818401526020810190506114ce565b50505050905090810190601f1680156115165780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220e9c1ff6618cc4a982914e8799afa00ca6089ed1086cad479e28e3ba44be1798f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,955 |
0xb26440aa04d3938715c0b6c098d16e6e329ffa1a
|
/*
I hereby challenge
Владимир Путин
to single combat
Stakes are Україна
*/
//TG: @ELonVSPutin
// 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 ELonVSPutin 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 = unicode"Elon vs Putin";
string private constant _symbol = unicode"ElonПутин";
uint private constant _decimals = 9;
uint256 private _teamFee = 8;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(3).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(12).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(12).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 <= 13, "not larger than 13%");
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103fe578063cf0848f714610413578063cf9d4afa14610433578063dd62ed3e14610453578063e6ec64ec14610499578063f2fde38b146104b957600080fd5b8063715018a61461032a5780638da5cb5b1461033f57806390d49b9d1461036757806395d89b4114610387578063a9059cbb146103be578063b515566a146103de57600080fd5b806331c2d8471161010857806331c2d847146102435780633bbac57914610263578063437823ec1461029c578063476343ee146102bc5780635342acb4146102d157806370a082311461030a57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101ba57806318160ddd146101ea57806323b872dd1461020f578063313ce5671461022f57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d9565b005b34801561017e57600080fd5b5060408051808201909152600d81526c22b637b7103b3990283aba34b760991b60208201525b6040516101b191906118f4565b60405180910390f35b3480156101c657600080fd5b506101da6101d536600461196e565b610525565b60405190151581526020016101b1565b3480156101f657600080fd5b50678ac7230489e800005b6040519081526020016101b1565b34801561021b57600080fd5b506101da61022a36600461199a565b61053c565b34801561023b57600080fd5b506009610201565b34801561024f57600080fd5b5061017061025e3660046119f1565b6105a5565b34801561026f57600080fd5b506101da61027e366004611ab6565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a857600080fd5b506101706102b7366004611ab6565b61063b565b3480156102c857600080fd5b50610170610689565b3480156102dd57600080fd5b506101da6102ec366004611ab6565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031657600080fd5b50610201610325366004611ab6565b6106c3565b34801561033657600080fd5b506101706106e5565b34801561034b57600080fd5b506000546040516001600160a01b0390911681526020016101b1565b34801561037357600080fd5b50610170610382366004611ab6565b61071b565b34801561039357600080fd5b5060408051808201909152600e81526d456c6f6ed09fd183d182d0b8d0bd60901b60208201526101a4565b3480156103ca57600080fd5b506101da6103d936600461196e565b610795565b3480156103ea57600080fd5b506101706103f93660046119f1565b6107a2565b34801561040a57600080fd5b506101706108bb565b34801561041f57600080fd5b5061017061042e366004611ab6565b610972565b34801561043f57600080fd5b5061017061044e366004611ab6565b6109bd565b34801561045f57600080fd5b5061020161046e366004611ad3565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104a557600080fd5b506101706104b4366004611b0c565b610c18565b3480156104c557600080fd5b506101706104d4366004611ab6565b610c8e565b6000546001600160a01b0316331461050c5760405162461bcd60e51b815260040161050390611b25565b60405180910390fd5b6000610517306106c3565b905061052281610d26565b50565b6000610532338484610ea0565b5060015b92915050565b6000610549848484610fc4565b61059b843361059685604051806060016040528060288152602001611ca0602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113dd565b610ea0565b5060019392505050565b6000546001600160a01b031633146105cf5760405162461bcd60e51b815260040161050390611b25565b60005b8151811015610637576000600560008484815181106105f3576105f3611b5a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062f81611b86565b9150506105d2565b5050565b6000546001600160a01b031633146106655760405162461bcd60e51b815260040161050390611b25565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610637573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461053690611417565b6000546001600160a01b0316331461070f5760405162461bcd60e51b815260040161050390611b25565b610719600061149b565b565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161050390611b25565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610532338484610fc4565b6000546001600160a01b031633146107cc5760405162461bcd60e51b815260040161050390611b25565b60005b815181101561063757600c5482516001600160a01b03909116908390839081106107fb576107fb611b5a565b60200260200101516001600160a01b03161415801561084c5750600b5482516001600160a01b039091169083908390811061083857610838611b5a565b60200260200101516001600160a01b031614155b156108a95760016005600084848151811061086957610869611b5a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108b381611b86565b9150506107cf565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161050390611b25565b600c54600160a01b900460ff166109495760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b6064820152608401610503565b600c805460ff60b81b1916600160b81b17905542600d81905561096d9060b4611ba1565b600e55565b6000546001600160a01b0316331461099c5760405162461bcd60e51b815260040161050390611b25565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e75760405162461bcd60e51b815260040161050390611b25565b600c54600160a01b900460ff1615610a4f5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610503565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aca9190611bb9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3b9190611bb9565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bac9190611bb9565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c425760405162461bcd60e51b815260040161050390611b25565b600d811115610c895760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031332560681b6044820152606401610503565b600855565b6000546001600160a01b03163314610cb85760405162461bcd60e51b815260040161050390611b25565b6001600160a01b038116610d1d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610503565b6105228161149b565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6e57610d6e611b5a565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610deb9190611bb9565b81600181518110610dfe57610dfe611b5a565b6001600160a01b039283166020918202929092010152600b54610e249130911684610ea0565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e5d908590600090869030904290600401611bd6565b600060405180830381600087803b158015610e7757600080fd5b505af1158015610e8b573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610f025760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610503565b6001600160a01b038216610f635760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610503565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110285760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610503565b6001600160a01b03821661108a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610503565b600081116110ec5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610503565b6001600160a01b03831660009081526005602052604090205460ff16156111945760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610503565b6001600160a01b03831660009081526004602052604081205460ff161580156111d657506001600160a01b03831660009081526004602052604090205460ff16155b80156111ec5750600c54600160a81b900460ff16155b801561121c5750600c546001600160a01b038581169116148061121c5750600c546001600160a01b038481169116145b156113cb57600c54600160b81b900460ff1661127a5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610503565b50600c546001906001600160a01b0385811691161480156112a95750600b546001600160a01b03848116911614155b80156112b6575042600e54115b156112fd5760006112c6846106c3565b90506112e660646112e0678ac7230489e8000060036114eb565b9061156a565b6112f084836115ac565b11156112fb57600080fd5b505b600d5442141561132b576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6000611336306106c3565b600c54909150600160b01b900460ff161580156113615750600c546001600160a01b03868116911614155b156113c95780156113c957600c8054611394916064916112e0919061138e906001600160a01b03166106c3565b906114eb565b8111156113c057600c80546113bd916064916112e0919061138e906001600160a01b03166106c3565b90505b6113c981610d26565b505b6113d78484848461160b565b50505050565b600081848411156114015760405162461bcd60e51b815260040161050391906118f4565b50600061140e8486611c47565b95945050505050565b600060065482111561147e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610503565b600061148861170e565b9050611494838261156a565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114fa57506000610536565b60006115068385611c5e565b9050826115138583611c7d565b146114945760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610503565b600061149483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611731565b6000806115b98385611ba1565b9050838110156114945760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610503565b80806116195761161961175f565b6000806000806116288761177b565b6001600160a01b038d166000908152600160205260409020549397509195509350915061165590856117c2565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461168490846115ac565b6001600160a01b0389166000908152600160205260409020556116a681611804565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116eb91815260200190565b60405180910390a3505050508061170757611707600954600855565b5050505050565b600080600061171b61184e565b909250905061172a828261156a565b9250505090565b600081836117525760405162461bcd60e51b815260040161050391906118f4565b50600061140e8486611c7d565b60006008541161176e57600080fd5b6008805460095560009055565b6000806000806000806117908760085461188e565b91509150600061179e61170e565b90506000806117ae8a85856118bb565b909b909a5094985092965092945050505050565b600061149483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113dd565b600061180e61170e565b9050600061181c83836114eb565b3060009081526001602052604090205490915061183990826115ac565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e80000611869828261156a565b82101561188557505060065492678ac7230489e8000092509050565b90939092509050565b600080806118a160646112e087876114eb565b905060006118af86836117c2565b96919550909350505050565b600080806118c986856114eb565b905060006118d786866114eb565b905060006118e583836117c2565b92989297509195505050505050565b600060208083528351808285015260005b8181101561192157858101830151858201604001528201611905565b81811115611933576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052257600080fd5b803561196981611949565b919050565b6000806040838503121561198157600080fd5b823561198c81611949565b946020939093013593505050565b6000806000606084860312156119af57600080fd5b83356119ba81611949565b925060208401356119ca81611949565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a0457600080fd5b823567ffffffffffffffff80821115611a1c57600080fd5b818501915085601f830112611a3057600080fd5b813581811115611a4257611a426119db565b8060051b604051601f19603f83011681018181108582111715611a6757611a676119db565b604052918252848201925083810185019188831115611a8557600080fd5b938501935b82851015611aaa57611a9b8561195e565b84529385019392850192611a8a565b98975050505050505050565b600060208284031215611ac857600080fd5b813561149481611949565b60008060408385031215611ae657600080fd5b8235611af181611949565b91506020830135611b0181611949565b809150509250929050565b600060208284031215611b1e57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b9a57611b9a611b70565b5060010190565b60008219821115611bb457611bb4611b70565b500190565b600060208284031215611bcb57600080fd5b815161149481611949565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c265784516001600160a01b031683529383019391830191600101611c01565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c5957611c59611b70565b500390565b6000816000190483118215151615611c7857611c78611b70565b500290565b600082611c9a57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208433e9a84e00ed2e6a71331167c4a7a247592d15d5a2c4db963db128e4c9e22e64736f6c634300080c0033
|
{"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"}]}}
| 2,956 |
0x7aecf441966ca8486f4cbaa62fa9ef2d557f9ba7
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
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];
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3a565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5a565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d89565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e1b565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611020565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b5061041660048036038101908080359060200190929190505050611105565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111d0565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112c5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611353565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114c4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be611701565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff60048036038101908080359060200190929190505050611707565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117c1565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061199e565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119bd565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119c2565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c8565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cdd565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b91906120fe565b506003805490506004541115610b4a57610b49600380549050611707565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610c8657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1457838015610dc8575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610dfb5750828015610dfa575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e07576001820191505b8080600101915050610d91565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5557600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610eaf57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610ed657600080fd5b60016003805490500160045460328211158015610ef35750818111155b8015610f00575060008114155b8015610f0d575060008214155b1515610f1857600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110fd5760016000858152602001908152602001600020600060038381548110151561105e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110dd576001820191505b6004548214156110f057600192506110fe565b808060010191505061102d565b5b5050919050565b600080600090505b6003805490508110156111ca5760016000848152602001908152602001600020600060038381548110151561113e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111bd576001820191505b808060010191505061110d565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112a85780601f1061127d576101008083540402835291602001916112a8565b820191906000526020600020905b81548152906001019060200180831161128b57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561134957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112ff575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561138a5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611436578580156113cd575060008082815260200190815260200160002060030160009054906101000a900460ff16155b8061140057508480156113ff575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156114295780838381518110151561141457fe5b90602001906020020181815250506001820191505b8080600101915050611396565b8787036040519080825280602002602001820160405280156114675781602001602082028038833980820191505090505b5093508790505b868110156114b957828181518110151561148457fe5b906020019060200201518489830381518110151561149e57fe5b9060200190602002018181525050808060010191505061146e565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114fe5781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561164b5760016000868152602001908152602001600020600060038381548110151561153b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163e576003818154811015156115c257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fb57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061150a565b8160405190808252806020026020018201604052801561167a5781602001602082028038833980820191505090505b509350600090505b818110156116f957828181518110151561169857fe5b9060200190602002015184828151811015156116b057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611682565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174157600080fd5b60038054905081603282111580156117595750818111155b8015611766575060008114155b8015611773575060008214155b151561177e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561181a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561187657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118e257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361199785611cdd565b5050505050565b60006119ab848484611f85565b90506119b6816117c1565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a0457600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a5d57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611ab757600080fd5b600092505b600380549050831015611ba0578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611aef57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b935783600384815481101515611b4657fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611ba0565b8280600101935050611abc565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611d3857600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da357600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611dd357600080fd5b611ddc86611020565b15611f7d57600080878152602001908152602001600020945060018560030160006101000a81548160ff021916908315150217905550611efa8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866001015487600201805460018160011615610100020316600290049050886002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ef05780601f10611ec557610100808354040283529160200191611ef0565b820191906000526020600020905b815481529060010190602001808311611ed357829003601f168201915b50505050506120d7565b15611f3157857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611f7c565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b505050505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611fae57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061206d92919061212a565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b8154818355818111156121255781836000526020600020918201910161212491906121aa565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061216b57805160ff1916838001178555612199565b82800160010185558215612199579182015b8281111561219857825182559160200191906001019061217d565b5b5090506121a691906121aa565b5090565b6121cc91905b808211156121c85760008160009055506001016121b0565b5090565b905600a165627a7a723058203ad3c5dfb753150162f3832423ea049e213f59f92c676fc6d2d7f300597436f70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,957 |
0x327d44d90b32d8ca1005a5e1c03b06bc845434f7
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
/*
Telegram - https://www.t.me/Izanagiportal
Website - https://izanagi.io
Twitter - https://www.twitter.com/Izanagi_Token
Discord - https://discord.gg/izanagi-token
*/
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 Izanagi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Izanagi";
string private constant _symbol = "NAGI";
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 = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 7;
uint256 private _taxFeeOnSell = 18 ;
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 _opAddress = payable(0x5479b9E8aD7224a150e4F050dA45793274dd1ADf);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 300000000000000 * 10**9; //1
uint256 public _maxWalletSize = 600000000000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 30000000000000 * 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[_opAddress] = 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 {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) 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 allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610626578063c3c8cd8014610663578063dd62ed3e1461067a578063ea1644d5146106b7576101cc565b806398a5c3151461055a578063a2a957bb14610583578063a9059cbb146105ac578063bdd795ef146105e9576101cc565b80638da5cb5b116100d15780638da5cb5b146104b05780638f70ccf7146104db5780638f9a55c01461050457806395d89b411461052f576101cc565b8063715018a61461044557806374010ece1461045c5780637d1db4a514610485576101cc565b80632fd689e3116101645780636b9990531161013e5780636b9990531461039f5780636d8aa8f8146103c85780636fc3eaec146103f157806370a0823114610408576101cc565b80632fd689e31461031e578063313ce5671461034957806349bd5a5e14610374576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632f9c4569146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612b88565b6106e0565b005b34801561020657600080fd5b5061020f610830565b60405161021c9190612fd1565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612b4c565b61086d565b6040516102599190612f9b565b60405180910390f35b34801561026e57600080fd5b5061027761088b565b6040516102849190612fb6565b60405180910390f35b34801561029957600080fd5b506102a26108b1565b6040516102af91906131b3565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612ac1565b6108c3565b6040516102ec9190612f9b565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612b10565b61099c565b005b34801561032a57600080fd5b50610333610b1f565b60405161034091906131b3565b60405180910390f35b34801561035557600080fd5b5061035e610b25565b60405161036b9190613228565b60405180910390f35b34801561038057600080fd5b50610389610b2e565b6040516103969190612f80565b60405180910390f35b3480156103ab57600080fd5b506103c660048036038101906103c19190612a33565b610b54565b005b3480156103d457600080fd5b506103ef60048036038101906103ea9190612bc9565b610c44565b005b3480156103fd57600080fd5b50610406610cf6565b005b34801561041457600080fd5b5061042f600480360381019061042a9190612a33565b610d68565b60405161043c91906131b3565b60405180910390f35b34801561045157600080fd5b5061045a610db9565b005b34801561046857600080fd5b50610483600480360381019061047e9190612bf2565b610f0c565b005b34801561049157600080fd5b5061049a610fab565b6040516104a791906131b3565b60405180910390f35b3480156104bc57600080fd5b506104c5610fb1565b6040516104d29190612f80565b60405180910390f35b3480156104e757600080fd5b5061050260048036038101906104fd9190612bc9565b610fda565b005b34801561051057600080fd5b5061051961108c565b60405161052691906131b3565b60405180910390f35b34801561053b57600080fd5b50610544611092565b6040516105519190612fd1565b60405180910390f35b34801561056657600080fd5b50610581600480360381019061057c9190612bf2565b6110cf565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612c1b565b61116e565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190612b4c565b611225565b6040516105e09190612f9b565b60405180910390f35b3480156105f557600080fd5b50610610600480360381019061060b9190612a33565b611243565b60405161061d9190612f9b565b60405180910390f35b34801561063257600080fd5b5061064d60048036038101906106489190612a33565b611263565b60405161065a9190612f9b565b60405180910390f35b34801561066f57600080fd5b50610678611283565b005b34801561068657600080fd5b506106a1600480360381019061069c9190612a85565b6112fd565b6040516106ae91906131b3565b60405180910390f35b3480156106c357600080fd5b506106de60048036038101906106d99190612bf2565b611384565b005b6106e8611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c90613113565b60405180910390fd5b60005b815181101561082c576001601060008484815181106107c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610824906134ed565b915050610778565b5050565b60606040518060400160405280600781526020017f497a616e61676900000000000000000000000000000000000000000000000000815250905090565b600061088161087a611423565b848461142b565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600069d3c21bcecceda1000000905090565b60006108d08484846115f6565b610991846108dc611423565b61098c856040518060600160405280602881526020016139d460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610942611423565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de69092919063ffffffff16565b61142b565b600190509392505050565b6109a4611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2890613113565b60405180910390fd5b801515601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb906130d3565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b5c611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be090613113565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610c4c611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd090613113565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d37611423565b73ffffffffffffffffffffffffffffffffffffffff1614610d5757600080fd5b6000479050610d6581611e4a565b50565b6000610db2600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb6565b9050919050565b610dc1611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4590613113565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f14611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fa1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9890613113565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610fe2611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461106f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106690613113565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4e41474900000000000000000000000000000000000000000000000000000000815250905090565b6110d7611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611164576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115b90613113565b60405180910390fd5b8060188190555050565b611176611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fa90613113565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b6000611239611232611423565b84846115f6565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112c4611423565b73ffffffffffffffffffffffffffffffffffffffff16146112e457600080fd5b60006112ef30610d68565b90506112fa81611f24565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61138c611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611419576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141090613113565b60405180910390fd5b8060178190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561149b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149290613193565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150290613073565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115e991906131b3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d90613153565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd90612ff3565b60405180910390fd5b60008111611719576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171090613133565b60405180910390fd5b611721610fb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561178f575061175f610fb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ae557601560149054906101000a900460ff1661183557601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611834576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182b90613013565b60405180910390fd5b5b60165481111561187a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187190613053565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561191e5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61195d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195490613093565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611a0a57601754816119bf84610d68565b6119c991906132e9565b10611a09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0090613173565b60405180910390fd5b5b6000611a1530610d68565b9050600060185482101590506016548210611a305760165491505b808015611a48575060158054906101000a900460ff16155b8015611aa25750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611aba5750601560169054906101000a900460ff165b15611ae257611ac882611f24565b60004790506000811115611ae057611adf47611e4a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b8c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611c3f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611c3e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611c4d5760009050611dd4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611cf85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d1057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611dbb5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611dd357600a54600c81905550600b54600d819055505b5b611de08484848461221c565b50505050565b6000838311158290611e2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e259190612fd1565b60405180910390fd5b5060008385611e3d91906133ca565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611eb2573d6000803e3d6000fd5b5050565b6000600654821115611efd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef490613033565b60405180910390fd5b6000611f07612249565b9050611f1c818461227490919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f81577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611faf5781602001602082028036833780820191505090505b5090503081600081518110611fed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208f57600080fd5b505afa1580156120a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c79190612a5c565b81600181518110612101577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061216830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461142b565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121cc9594939291906131ce565b600060405180830381600087803b1580156121e657600080fd5b505af11580156121fa573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061222a576122296122be565b5b612235848484612301565b80612243576122426124cc565b5b50505050565b60008060006122566124e0565b9150915061226d818361227490919063ffffffff16565b9250505090565b60006122b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612545565b905092915050565b6000600c541480156122d257506000600d54145b156122dc576122ff565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612313876125a8565b95509550955095509550955061237186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061240685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612452816126b8565b61245c8483612775565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124b991906131b3565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008060006006549050600069d3c21bcecceda1000000905061251869d3c21bcecceda100000060065461227490919063ffffffff16565b8210156125385760065469d3c21bcecceda1000000935093505050612541565b81819350935050505b9091565b6000808311829061258c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125839190612fd1565b60405180910390fd5b506000838561259b919061333f565b9050809150509392505050565b60008060008060008060008060006125c58a600c54600d546127af565b92509250925060006125d5612249565b905060008060006125e88e878787612845565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061265283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611de6565b905092915050565b600080828461266991906132e9565b9050838110156126ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126a5906130b3565b60405180910390fd5b8091505092915050565b60006126c2612249565b905060006126d982846128ce90919063ffffffff16565b905061272d81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61278a8260065461261090919063ffffffff16565b6006819055506127a58160075461265a90919063ffffffff16565b6007819055505050565b6000806000806127db60646127cd888a6128ce90919063ffffffff16565b61227490919063ffffffff16565b9050600061280560646127f7888b6128ce90919063ffffffff16565b61227490919063ffffffff16565b9050600061282e82612820858c61261090919063ffffffff16565b61261090919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061285e85896128ce90919063ffffffff16565b9050600061287586896128ce90919063ffffffff16565b9050600061288c87896128ce90919063ffffffff16565b905060006128b5826128a7858761261090919063ffffffff16565b61261090919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156128e15760009050612943565b600082846128ef9190613370565b90508284826128fe919061333f565b1461293e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612935906130f3565b60405180910390fd5b809150505b92915050565b600061295c61295784613268565b613243565b9050808382526020820190508285602086028201111561297b57600080fd5b60005b858110156129ab578161299188826129b5565b84526020840193506020830192505060018101905061297e565b5050509392505050565b6000813590506129c48161398e565b92915050565b6000815190506129d98161398e565b92915050565b600082601f8301126129f057600080fd5b8135612a00848260208601612949565b91505092915050565b600081359050612a18816139a5565b92915050565b600081359050612a2d816139bc565b92915050565b600060208284031215612a4557600080fd5b6000612a53848285016129b5565b91505092915050565b600060208284031215612a6e57600080fd5b6000612a7c848285016129ca565b91505092915050565b60008060408385031215612a9857600080fd5b6000612aa6858286016129b5565b9250506020612ab7858286016129b5565b9150509250929050565b600080600060608486031215612ad657600080fd5b6000612ae4868287016129b5565b9350506020612af5868287016129b5565b9250506040612b0686828701612a1e565b9150509250925092565b60008060408385031215612b2357600080fd5b6000612b31858286016129b5565b9250506020612b4285828601612a09565b9150509250929050565b60008060408385031215612b5f57600080fd5b6000612b6d858286016129b5565b9250506020612b7e85828601612a1e565b9150509250929050565b600060208284031215612b9a57600080fd5b600082013567ffffffffffffffff811115612bb457600080fd5b612bc0848285016129df565b91505092915050565b600060208284031215612bdb57600080fd5b6000612be984828501612a09565b91505092915050565b600060208284031215612c0457600080fd5b6000612c1284828501612a1e565b91505092915050565b60008060008060808587031215612c3157600080fd5b6000612c3f87828801612a1e565b9450506020612c5087828801612a1e565b9350506040612c6187828801612a1e565b9250506060612c7287828801612a1e565b91505092959194509250565b6000612c8a8383612c96565b60208301905092915050565b612c9f816133fe565b82525050565b612cae816133fe565b82525050565b6000612cbf826132a4565b612cc981856132c7565b9350612cd483613294565b8060005b83811015612d05578151612cec8882612c7e565b9750612cf7836132ba565b925050600181019050612cd8565b5085935050505092915050565b612d1b81613410565b82525050565b612d2a81613453565b82525050565b612d3981613477565b82525050565b6000612d4a826132af565b612d5481856132d8565b9350612d64818560208601613489565b612d6d816135c3565b840191505092915050565b6000612d856023836132d8565b9150612d90826135d4565b604082019050919050565b6000612da8603f836132d8565b9150612db382613623565b604082019050919050565b6000612dcb602a836132d8565b9150612dd682613672565b604082019050919050565b6000612dee601c836132d8565b9150612df9826136c1565b602082019050919050565b6000612e116022836132d8565b9150612e1c826136ea565b604082019050919050565b6000612e346023836132d8565b9150612e3f82613739565b604082019050919050565b6000612e57601b836132d8565b9150612e6282613788565b602082019050919050565b6000612e7a6017836132d8565b9150612e85826137b1565b602082019050919050565b6000612e9d6021836132d8565b9150612ea8826137da565b604082019050919050565b6000612ec06020836132d8565b9150612ecb82613829565b602082019050919050565b6000612ee36029836132d8565b9150612eee82613852565b604082019050919050565b6000612f066025836132d8565b9150612f11826138a1565b604082019050919050565b6000612f296023836132d8565b9150612f34826138f0565b604082019050919050565b6000612f4c6024836132d8565b9150612f578261393f565b604082019050919050565b612f6b8161343c565b82525050565b612f7a81613446565b82525050565b6000602082019050612f956000830184612ca5565b92915050565b6000602082019050612fb06000830184612d12565b92915050565b6000602082019050612fcb6000830184612d21565b92915050565b60006020820190508181036000830152612feb8184612d3f565b905092915050565b6000602082019050818103600083015261300c81612d78565b9050919050565b6000602082019050818103600083015261302c81612d9b565b9050919050565b6000602082019050818103600083015261304c81612dbe565b9050919050565b6000602082019050818103600083015261306c81612de1565b9050919050565b6000602082019050818103600083015261308c81612e04565b9050919050565b600060208201905081810360008301526130ac81612e27565b9050919050565b600060208201905081810360008301526130cc81612e4a565b9050919050565b600060208201905081810360008301526130ec81612e6d565b9050919050565b6000602082019050818103600083015261310c81612e90565b9050919050565b6000602082019050818103600083015261312c81612eb3565b9050919050565b6000602082019050818103600083015261314c81612ed6565b9050919050565b6000602082019050818103600083015261316c81612ef9565b9050919050565b6000602082019050818103600083015261318c81612f1c565b9050919050565b600060208201905081810360008301526131ac81612f3f565b9050919050565b60006020820190506131c86000830184612f62565b92915050565b600060a0820190506131e36000830188612f62565b6131f06020830187612d30565b81810360408301526132028186612cb4565b90506132116060830185612ca5565b61321e6080830184612f62565b9695505050505050565b600060208201905061323d6000830184612f71565b92915050565b600061324d61325e565b905061325982826134bc565b919050565b6000604051905090565b600067ffffffffffffffff82111561328357613282613594565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006132f48261343c565b91506132ff8361343c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561333457613333613536565b5b828201905092915050565b600061334a8261343c565b91506133558361343c565b92508261336557613364613565565b5b828204905092915050565b600061337b8261343c565b91506133868361343c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133bf576133be613536565b5b828202905092915050565b60006133d58261343c565b91506133e08361343c565b9250828210156133f3576133f2613536565b5b828203905092915050565b60006134098261341c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061345e82613465565b9050919050565b60006134708261341c565b9050919050565b60006134828261343c565b9050919050565b60005b838110156134a757808201518184015260208101905061348c565b838111156134b6576000848401525b50505050565b6134c5826135c3565b810181811067ffffffffffffffff821117156134e4576134e3613594565b5b80604052505050565b60006134f88261343c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561352b5761352a613536565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613997816133fe565b81146139a257600080fd5b50565b6139ae81613410565b81146139b957600080fd5b50565b6139c58161343c565b81146139d057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122003f8c802fe254c8754cb10bb169e46da08f90a9f9fc8c0fe7a1e14517ac46f9664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,958 |
0x9ca618ec326fb548585d2d26033ffde2665bd0f1
|
/**
*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 <= 53180082e18, "_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 GDOGE 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("Green DOGE", "GDOGE", 18) {
governance = msg.sender;
addMinter(governance);
// underlying _mint function has hard limit
mint(governance, 53180082e18);
}
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);
}
}
|
0x739ca618ec326fb548585d2d26033ffde2665bd0f130146080604052600080fdfea265627a7a72315820a228daae21ccf38992dffb78fdf815f5052b2c4c57253a04871ce24dfacf3b9f64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 2,959 |
0xd40bb65da756d9e0b9bc38a233fe779e455b2009
|
/**
随时抵押,随时解押,立即获得奖励。
今天是在ETH上摘星星的好日子。
star.finance的智能合约已通过知道创宇的审计,审计报告点击此处
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.5.8;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// 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;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
contract StartFinance is ERC20 {
string public constant name = "Star.Finance";
string public constant symbol = "星⚡星";
uint8 public constant decimals = 8;
uint256 public constant initialSupply = 30000 * (10 ** uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
//pausable
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(
address _to,
uint256 _value
)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
//mintable
event Mint(address indexed to, uint256 amount);
function mint(
address _to,
uint256 _amount
)
public
onlyOwner
returns (bool)
{
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
}
//burnable
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
//lockable
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) {
return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance);
}
function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(_releaseTime, _amount)
);
emit Lock(_holder, _amount, _releaseTime);
}
function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(now + _afterTime, _amount)
);
emit Lock(_holder, _amount, now + _afterTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
}
lockInfo[_holder].length--;
}
function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(_releaseTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(now + _afterTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, now + _afterTime);
return true;
}
function currentTime() public view returns (uint256) {
return now;
}
function afterTime(uint256 _value) public view returns (uint256) {
return now + _value;
}
mapping (address => uint256) public airDropHistory;
event AirDrop(address _receiver, uint256 _amount);
function dropToken(address[] memory receivers, uint256[] memory values) onlyOwner public {
require(receivers.length != 0);
require(receivers.length == values.length);
for (uint256 i = 0; i < receivers.length; i++) {
address receiver = receivers[i];
uint256 amount = values[i];
transfer(receiver, amount);
airDropHistory[receiver] += amount;
emit AirDrop(receiver, amount);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80638a57af6b1161011a578063c77828d0116100ad578063de6baccb1161007c578063de6baccb1461074f578063df03458614610781578063e2ab691d146107a7578063e5839836146107d9578063f2fde38b146107ff57610206565b8063c77828d0146105cc578063ccd28a4c146106f3578063d18e81b314610719578063dd62ed3e1461072157610206565b806395d89b41116100e957806395d89b41146105405780639dc29fac14610548578063a457c2d714610574578063a9059cbb146105a057610206565b80638a57af6b146104925780638d1fdf2f146104c45780638da5cb5b146104ea578063927a4a7b1461050e57610206565b80633f4ba83a1161019d5780635c975abb1161016c5780635c975abb1461042857806370a0823114610430578063715018a6146104565780637eee288d1461045e5780638456cb591461048a57610206565b80633f4ba83a1461038757806340c10f191461039157806345c8b1a6146103bd57806346cf1bb5146103e357610206565b806323b872dd116101d957806323b872dd146102ff578063313ce56714610335578063378dc3dc14610353578063395093511461035b57610206565b806304859ceb1461020b57806306fdde031461023a578063095ea7b3146102b757806318160ddd146102f7575b600080fd5b6102286004803603602081101561022157600080fd5b5035610825565b60408051918252519081900360200190f35b61024261082a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027c578181015183820152602001610264565b50505050905090810190601f1680156102a95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102e3600480360360408110156102cd57600080fd5b506001600160a01b038135169060200135610863565b604080519115158252519081900360200190f35b610228610879565b6102e36004803603606081101561031557600080fd5b506001600160a01b03813581169160208101359091169060400135610880565b61033d610967565b6040805160ff9092168252519081900360200190f35b61022861096c565b6102e36004803603604081101561037157600080fd5b506001600160a01b038135169060200135610976565b61038f6109b7565b005b6102e3600480360360408110156103a757600080fd5b506001600160a01b038135169060200135610aa4565b61038f600480360360208110156103d357600080fd5b50356001600160a01b0316610b4a565b61040f600480360360408110156103f957600080fd5b506001600160a01b038135169060200135610bf3565b6040805192835260208301919091528051918290030190f35b6102e3610c6c565b6102286004803603602081101561044657600080fd5b50356001600160a01b0316610c7c565b61038f610d16565b61038f6004803603604081101561047457600080fd5b506001600160a01b038135169060200135610db1565b61038f61105f565b61038f600480360360608110156104a857600080fd5b506001600160a01b038135169060208101359060400135611148565b61038f600480360360208110156104da57600080fd5b50356001600160a01b03166112a7565b6104f2611353565b604080516001600160a01b039092168252519081900360200190f35b6102e36004803603606081101561052457600080fd5b506001600160a01b038135169060208101359060400135611362565b61024261155b565b61038f6004803603604081101561055e57600080fd5b506001600160a01b038135169060200135611583565b6102e36004803603604081101561058a57600080fd5b506001600160a01b03813516906020013561167c565b6102e3600480360360408110156105b657600080fd5b506001600160a01b0381351690602001356116b8565b61038f600480360360408110156105e257600080fd5b8101906020810181356401000000008111156105fd57600080fd5b82018360208201111561060f57600080fd5b8035906020019184602083028401116401000000008311171561063157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561068157600080fd5b82018360208201111561069357600080fd5b803590602001918460208302840111640100000000831117156106b557600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061178a945050505050565b6102286004803603602081101561070957600080fd5b50356001600160a01b031661189d565b6102286118af565b6102286004803603604081101561073757600080fd5b506001600160a01b03813581169160200135166118b3565b6102e36004803603606081101561076557600080fd5b506001600160a01b0381351690602081013590604001356118de565b6102286004803603602081101561079757600080fd5b50356001600160a01b0316611ad4565b61038f600480360360608110156107bd57600080fd5b506001600160a01b038135169060208101359060400135611aef565b6102e3600480360360208110156107ef57600080fd5b50356001600160a01b0316611c47565b61038f6004803603602081101561081557600080fd5b50356001600160a01b0316611c65565b420190565b6040518060400160405280600c81526020017f537461722e46696e616e6365000000000000000000000000000000000000000081525081565b6000610870338484611cc2565b50600192915050565b6002545b90565b600354600090600160a01b900460ff16156108da5760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff161561094b5760408051600160e51b62461bcd02815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b61095484611db4565b61095f848484611fd7565b949350505050565b600881565b6502ba7def300081565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916108709185906109b2908663ffffffff61202916565b611cc2565b6003546001600160a01b03163314610a085760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff16610a695760408051600160e51b62461bcd02815260206004820152600e60248201527f4e6f7420706175736564206e6f77000000000000000000000000000000000000604482015290519081900360640190fd5b60038054600160a01b60ff02191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546000906001600160a01b03163314610af85760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b610b028383612086565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b6003546001600160a01b03163314610b9b5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b0382166000908152600560205260408120805482919084908110610c1a57fe5b600091825260208083206002909202909101546001600160a01b038716835260059091526040909120805485908110610c4f57fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b038416600090815260056020526040902054811015610cf5576001600160a01b03841660009081526005602052604090208054610ceb919083908110610cca57fe5b9060005260206000209060020201600101548361202990919063ffffffff16565b9150600101610c81565b50610d0f81610d0385612167565b9063ffffffff61202916565b9392505050565b6003546001600160a01b03163314610d675760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6003546040516001600160a01b03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a2600380546001600160a01b0319169055565b6003546001600160a01b03163314610e025760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610e715760408051600160e51b62461bcd02815260206004820152601460248201527f4e6f206c6f636b20696e666f726d6174696f6e2e000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610ed3919083908110610e9a57fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61202916565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110610f2757fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110610f7257fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114611031576001600160a01b038216600090815260056020526040902080546000198101908110610fd457fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061101257fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b038216600090815260056020526040902080549061105a9060001983016124a9565b505050565b6003546001600160a01b031633146110b05760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff16156111075760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b60038054600160a01b60ff021916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b031633146111995760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b816111a384612167565b10156111f45760408051600160e51b62461bcd0281526020600482015260156024820152600160591b742130b630b731b29034b9903a37b79039b6b0b6361702604482015290519081900360640190fd5b6001600160a01b03831660009081526020819052604090205461121d908363ffffffff61218216565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186524287018082528184018981528354600181810186559487529585902092516002909602909201948555905193909101929092558351868152908101919091528251919260008051602061257883398151915292918290030190a2505050565b6003546001600160a01b031633146112f85760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b6003546000906001600160a01b031633146113b65760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0384166114075760408051600160e51b62461bcd02815260206004820152600d6024820152600160981b6c77726f6e67206164647265737302604482015290519081900360640190fd5b60035461141c906001600160a01b0316612167565b83111561146b5760408051600160e51b62461bcd0281526020600482015260126024820152600160701b714e6f7420656e6f7567682062616c616e636502604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611496908463ffffffff61218216565b600380546001600160a01b03908116600090815260208181526040808320959095558883168083526005825285832086518088018852428a0181528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020612537833981519152928290030190a360408051848152428401602082015281516001600160a01b03871692600080516020612578833981519152928290030190a25060019392505050565b604051806040016040528060098152602001600160b81b68e6989fe29aa1e6989f0281525081565b6003546001600160a01b031633146115d45760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6115dd82612167565b81111561162f5760408051600160e51b62461bcd0281526020600482015260156024820152600160591b742130b630b731b29034b9903a37b79039b6b0b6361702604482015290519081900360640190fd5b61163982826121e2565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916108709185906109b2908663ffffffff61218216565b3360009081526004602052604081205460ff16156117205760408051600160e51b62461bcd02815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff16156117775760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b61178033611db4565b610d0f83836122ac565b6003546001600160a01b031633146117db5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b81516117e657600080fd5b80518251146117f457600080fd5b60005b825181101561105a57600083828151811061180e57fe5b60200260200101519050600083838151811061182657fe5b6020026020010151905061183a82826116b8565b506001600160a01b0382166000818152600660209081526040918290208054850190558151928352820183905280517f2a2f3a6f457f222229acc6b14376a5d3f4344fae935675150a096e2f1056bd989281900390910190a150506001016117f7565b60066020526000908152604090205481565b4290565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b031633146119325760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0384166119835760408051600160e51b62461bcd02815260206004820152600d6024820152600160981b6c77726f6e67206164647265737302604482015290519081900360640190fd5b600354611998906001600160a01b0316612167565b8311156119e75760408051600160e51b62461bcd0281526020600482015260126024820152600160701b714e6f7420656e6f7567682062616c616e636502604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611a12908463ffffffff61218216565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020612537833981519152928290030190a3604080518481526020810184905281516001600160a01b03871692600080516020612578833981519152928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b03163314611b405760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b81611b4a84612167565b1015611b9b5760408051600160e51b62461bcd0281526020600482015260156024820152600160591b742130b630b731b29034b9903a37b79039b6b0b6361702604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054611bc4908363ffffffff61218216565b6001600160a01b03841660008181526020818152604080832094909455600581528382208451808601865286815280830188815282546001818101855593865294849020915160029095029091019384555192019190915582518581529081018490528251919260008051602061257883398151915292918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b6003546001600160a01b03163314611cb65760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b611cbf816122b9565b50565b6001600160a01b038316611d0a57604051600160e51b62461bcd0281526004018080602001828103825260248152602001806125bd6024913960400191505060405180910390fd5b6001600160a01b038216611d5257604051600160e51b62461bcd0281526004018080602001828103825260228152602001806125156022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60005b6001600160a01b038216600090815260056020526040902054811015611fd3576001600160a01b0382166000908152600560205260409020805442919083908110611dfe57fe5b90600052602060002090600202016000015411611fcb576001600160a01b03821660009081526005602052604090208054611e3e919083908110610e9a57fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110611e9257fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110611edd57fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114611fa0576001600160a01b038216600090815260056020526040902080546000198101908110611f3f57fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110611f7d57fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b0382166000908152600560205260409020805490611fc99060001983016124a9565b505b600101611db7565b5050565b6000611fe4848484612373565b6001600160a01b03841660009081526001602090815260408083203380855292529091205461201f9186916109b2908663ffffffff61218216565b5060019392505050565b600082820183811015610d0f5760408051600160e51b62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0382166120e45760408051600160e51b62461bcd02815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6002546120f7908263ffffffff61202916565b6002556001600160a01b038216600090815260208190526040902054612123908263ffffffff61202916565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391926000805160206125378339815191529281900390910190a35050565b6001600160a01b031660009081526020819052604090205490565b6000828211156121dc5760408051600160e51b62461bcd02815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b03821661222a57604051600160e51b62461bcd0281526004018080602001828103825260218152602001806125576021913960400191505060405180910390fd5b60025461223d908263ffffffff61218216565b6002556001600160a01b038216600090815260208190526040902054612269908263ffffffff61218216565b6001600160a01b03831660008181526020818152604080832094909455835185815293519193600080516020612537833981519152929081900390910190a35050565b6000610870338484612373565b6001600160a01b0381166123175760408051600160e51b62461bcd02815260206004820152600d60248201527f416c7265616479206f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166123bb57604051600160e51b62461bcd0281526004018080602001828103825260258152602001806125986025913960400191505060405180910390fd5b6001600160a01b03821661240357604051600160e51b62461bcd0281526004018080602001828103825260238152602001806124f26023913960400191505060405180910390fd5b6001600160a01b03831660009081526020819052604090205461242c908263ffffffff61218216565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612461908263ffffffff61202916565b6001600160a01b0380841660008181526020818152604091829020949094558051858152905191939287169260008051602061253783398151915292918290030190a3505050565b81548183558181111561105a5760008381526020902061105a9161087d9160029182028101918502015b808211156124ed57600080825560018201556002016124d3565b509056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737349eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a72305820d244ef9c10ee95a0c6e9d4ec82d60614ed94ebaa9c912b703a36d3319282b1740029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,960 |
0x7a7db2f15d4a6c7b907ab48cd9fd7655cdbb0201
|
/**
*Submitted for verification at Etherscan.io on 2020-12-04
*/
pragma solidity ^0.6.0;
/*
*/
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract GANJA is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private whitelist;
uint256 private _totalSupply = 50 ether;
string private _name = "GANJA TOKEN";
string private _symbol = "GANJA";
uint8 private _decimals = 18;
address private __owner;
bool public beginning = true;
bool public stopBots = true;
constructor () public {
__owner = msg.sender;
_balances[__owner] = _totalSupply;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function multiWhitelistAdd(address[] memory addresses) public {
if (msg.sender != __owner) {
revert();
}
for (uint256 i = 0; i < addresses.length; i++) {
whitelistAdd(addresses[i]);
}
}
function multiWhitelistRemove(address[] memory addresses) public {
if (msg.sender != __owner) {
revert();
}
for (uint256 i = 0; i < addresses.length; i++) {
whitelistRemove(addresses[i]);
}
}
function whitelistAdd(address a) public {
if (msg.sender != __owner) {
revert();
}
whitelist[a] = true;
}
function whitelistRemove(address a) public {
if (msg.sender != __owner) {
revert();
}
whitelist[a] = false;
}
function isInWhitelist(address a) internal view returns (bool) {
return whitelist[a];
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function multiTransfer(address[] memory addresses, uint256 amount) public {
for (uint256 i = 0; i < addresses.length; i++) {
transfer(addresses[i], amount);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function disable() public {
if (msg.sender != __owner) {
revert();
}
stopBots = true;
}
function enable() public {
if (msg.sender != __owner) {
revert();
}
stopBots = false;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (beginning) {
if (isInWhitelist(sender)) {
revert();
}
}
if (stopBots) {
if (amount > 5 ether && sender != __owner) {
revert('stop the bots!');
}
}
uint256 tokensToBurn = amount.div(10);
uint256 tokensToTransfer = amount.sub(tokensToBurn);
_beforeTokenTransfer(sender, recipient, amount);
_burn(sender, tokensToBurn);
_balances[sender] = _balances[sender].sub(tokensToTransfer, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(tokensToTransfer);
emit Transfer(sender, recipient, tokensToTransfer);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function beginPresale() public {
if (__owner != msg.sender) {
revert();
}
beginning = true;
}
function stopPresale() public {
if (__owner != msg.sender) {
revert();
}
beginning = false;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063524fa7b9116100b8578063a457c2d71161007c578063a457c2d7146106ef578063a9059cbb14610755578063a932ed0d146107bb578063bc13d1e7146107ff578063c4066d4214610809578063dd62ed3e1461082b57610142565b8063524fa7b91461050457806370a082311461054857806395d89b41146105a0578063a16a317914610623578063a3907d71146106e557610142565b806323b872dd1161010a57806323b872dd146103105780632f2770db14610396578063313ce567146103a057806339509351146103c457806344043b821461042a5780634a797b47146104e257610142565b806306fdde0314610147578063095ea7b3146101ca57806318160ddd146102305780631ad2ad1a1461024e5780631f059ab814610258575b600080fd5b61014f6108a3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610945565b604051808215151515815260200191505060405180910390f35b61023861095c565b6040518082815260200191505060405180910390f35b610256610966565b005b61030e6004803603602081101561026e57600080fd5b810190808035906020019064010000000081111561028b57600080fd5b82018360208201111561029d57600080fd5b803590602001918460208302840111640100000000831117156102bf57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506109dd565b005b61037c6004803603606081101561032657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a73565b604051808215151515815260200191505060405180910390f35b61039e610b3e565b005b6103a8610bb5565b604051808260ff1660ff16815260200191505060405180910390f35b610410600480360360408110156103da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bcc565b604051808215151515815260200191505060405180910390f35b6104e06004803603602081101561044057600080fd5b810190808035906020019064010000000081111561045d57600080fd5b82018360208201111561046f57600080fd5b8035906020019184602083028401116401000000008311171561049157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610c71565b005b6104ea610d07565b604051808215151515815260200191505060405180910390f35b6105466004803603602081101561051a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d1a565b005b61058a6004803603602081101561055e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dcf565b6040518082815260200191505060405180910390f35b6105a8610e17565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e85780820151818401526020810190506105cd565b50505050905090810190601f1680156106155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106e36004803603604081101561063957600080fd5b810190808035906020019064010000000081111561065657600080fd5b82018360208201111561066857600080fd5b8035906020019184602083028401116401000000008311171561068a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610eb9565b005b6106ed610ef8565b005b61073b6004803603604081101561070557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6f565b604051808215151515815260200191505060405180910390f35b6107a16004803603604081101561076b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061102e565b604051808215151515815260200191505060405180910390f35b6107fd600480360360208110156107d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611045565b005b6108076110fa565b005b610811611171565b604051808215151515815260200191505060405180910390f35b61088d6004803603604081101561084157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611184565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561093b5780601f106109105761010080835404028352916020019161093b565b820191906000526020600020905b81548152906001019060200180831161091e57829003601f168201915b5050505050905090565b600061095233848461120b565b6001905092915050565b6000600354905090565b3373ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109c057600080fd5b6000600660156101000a81548160ff021916908315150217905550565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3757600080fd5b60008090505b8151811015610a6f57610a62828281518110610a5557fe5b6020026020010151611045565b8080600101915050610a3d565b5050565b6000610a80848484611402565b610b338433610b2e85604051806060016040528060288152602001611d6460289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118159092919063ffffffff16565b61120b565b600190509392505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b9857600080fd5b6001600660166101000a81548160ff021916908315150217905550565b6000600660009054906101000a900460ff16905090565b6000610c673384610c6285600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118d590919063ffffffff16565b61120b565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ccb57600080fd5b60008090505b8151811015610d0357610cf6828281518110610ce957fe5b6020026020010151610d1a565b8080600101915050610cd1565b5050565b600660159054906101000a900460ff1681565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d7457600080fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b5050505050905090565b60008090505b8251811015610ef357610ee5838281518110610ed757fe5b60200260200101518361102e565b508080600101915050610ebf565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f5257600080fd5b6000600660166101000a81548160ff021916908315150217905550565b6000611024338461101f85604051806060016040528060258152602001611df660259139600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118159092919063ffffffff16565b61120b565b6001905092915050565b600061103b338484611402565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461109f57600080fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461115457600080fd5b6001600660156101000a81548160ff021916908315150217905550565b600660169054906101000a900460ff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611291576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611dd26024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611317576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611d1c6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611488576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611dad6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611cd76023913960400191505060405180910390fd5b600660159054906101000a900460ff16156115375761152c8361195d565b1561153657600080fd5b5b600660169054906101000a900460ff161561162557674563918244f40000811180156115b15750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611624576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f73746f702074686520626f74732100000000000000000000000000000000000081525060200191505060405180910390fd5b5b600061163b600a836119b390919063ffffffff16565b9050600061165282846119fd90919063ffffffff16565b905061165f858585611a47565b6116698583611a4c565b6116d481604051806060016040528060268152602001611d3e602691396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118159092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611767816000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118d590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505050565b60008383111582906118c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561188757808201518184015260208101905061186c565b50505050905090810190601f1680156118b45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611953576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60006119f583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c10565b905092915050565b6000611a3f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611815565b905092915050565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ad2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d8c6021913960400191505060405180910390fd5b611ade82600083611a47565b611b4981604051806060016040528060228152602001611cfa602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118159092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ba0816003546119fd90919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008083118290611cbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c81578082015181840152602081019050611c66565b50505050905090810190601f168015611cae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611cc857fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220bcd6ad897b95c042d16e9a7dc17f533560697889774ac027891faa6ac0ccdac264736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 2,961 |
0xda0d1f53d54c88eb30c3b7971354010d45059db9
|
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface TokenInterface {
function totalSupply() external constant returns (uint);
function balanceOf(address tokenOwner) external constant returns (uint balance);
function allowance(address tokenOwner, address spender) external constant returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
function burn(uint256 _value) external;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Burn(address indexed burner, uint256 value);
}
contract KRCICOContract is Ownable{
using SafeMath for uint256;
// The token being sold
TokenInterface public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// how many token units a buyer gets per wei
uint256 public ratePerWei;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public TOKENS_SOLD;
uint256 maxTokensToSale;
uint256 bonusInPhase1;
uint256 bonusInPhase2;
uint256 bonusInPhase3;
uint256 minimumContribution;
uint256 maximumContribution;
bool isCrowdsalePaused = false;
uint256 totalDurationInDays = 87 days;
uint256 LongTermFoundationBudgetAccumulated;
uint256 LegalContingencyFundsAccumulated;
uint256 MarketingAndCommunityOutreachAccumulated;
uint256 CashReserveFundAccumulated;
uint256 OperationalExpensesAccumulated;
uint256 SoftwareProductDevelopmentAccumulated;
uint256 FoundersTeamAndAdvisorsAccumulated;
uint256 LongTermFoundationBudgetPercentage;
uint256 LegalContingencyFundsPercentage;
uint256 MarketingAndCommunityOutreachPercentage;
uint256 CashReserveFundPercentage;
uint256 OperationalExpensesPercentage;
uint256 SoftwareProductDevelopmentPercentage;
uint256 FoundersTeamAndAdvisorsPercentage;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
constructor(uint256 _startTime, address _wallet, address _tokenAddress) public
{
require(_startTime >=now);
require(_wallet != 0x0);
startTime = _startTime;
endTime = startTime + totalDurationInDays;
require(endTime >= startTime);
owner = _wallet;
maxTokensToSale = 157500000e18;
bonusInPhase1 = 20;
bonusInPhase2 = 15;
bonusInPhase3 = 10;
minimumContribution = 5e17;
maximumContribution = 150e18;
ratePerWei = 40e18;
token = TokenInterface(_tokenAddress);
LongTermFoundationBudgetAccumulated = 0;
LegalContingencyFundsAccumulated = 0;
MarketingAndCommunityOutreachAccumulated = 0;
CashReserveFundAccumulated = 0;
OperationalExpensesAccumulated = 0;
SoftwareProductDevelopmentAccumulated = 0;
FoundersTeamAndAdvisorsAccumulated = 0;
LongTermFoundationBudgetPercentage = 15;
LegalContingencyFundsPercentage = 10;
MarketingAndCommunityOutreachPercentage = 10;
CashReserveFundPercentage = 20;
OperationalExpensesPercentage = 10;
SoftwareProductDevelopmentPercentage = 15;
FoundersTeamAndAdvisorsPercentage = 20;
}
// fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender);
}
function calculateTokens(uint value) internal view returns (uint256 tokens)
{
uint256 timeElapsed = now - startTime;
uint256 timeElapsedInDays = timeElapsed.div(1 days);
uint256 bonus = 0;
//Phase 1 (15 days)
if (timeElapsedInDays <15)
{
tokens = value.mul(ratePerWei);
bonus = tokens.mul(bonusInPhase1);
bonus = bonus.div(100);
tokens = tokens.add(bonus);
require (TOKENS_SOLD.add(tokens) <= maxTokensToSale);
}
//Phase 2 (15 days)
else if (timeElapsedInDays >=15 && timeElapsedInDays <30)
{
tokens = value.mul(ratePerWei);
bonus = tokens.mul(bonusInPhase2);
bonus = bonus.div(100);
tokens = tokens.add(bonus);
require (TOKENS_SOLD.add(tokens) <= maxTokensToSale);
}
//Phase 3 (15 days)
else if (timeElapsedInDays >=30 && timeElapsedInDays <45)
{
tokens = value.mul(ratePerWei);
bonus = tokens.mul(bonusInPhase3);
bonus = bonus.div(100);
tokens = tokens.add(bonus);
require (TOKENS_SOLD.add(tokens) <= maxTokensToSale);
}
else
{
bonus = 0;
}
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(isCrowdsalePaused == false);
require(validPurchase());
require(TOKENS_SOLD<maxTokensToSale);
uint256 weiAmount = msg.value.div(10**16);
uint256 tokens = calculateTokens(weiAmount);
require(TOKENS_SOLD.add(tokens)<=maxTokensToSale);
// update state
weiRaised = weiRaised.add(msg.value);
token.transfer(beneficiary,tokens);
emit TokenPurchase(owner, beneficiary, msg.value, tokens);
TOKENS_SOLD = TOKENS_SOLD.add(tokens);
distributeFunds();
}
function distributeFunds() internal {
uint received = msg.value;
LongTermFoundationBudgetAccumulated = LongTermFoundationBudgetAccumulated
.add(received.mul(LongTermFoundationBudgetPercentage)
.div(100));
LegalContingencyFundsAccumulated = LegalContingencyFundsAccumulated
.add(received.mul(LegalContingencyFundsPercentage)
.div(100));
MarketingAndCommunityOutreachAccumulated = MarketingAndCommunityOutreachAccumulated
.add(received.mul(MarketingAndCommunityOutreachPercentage)
.div(100));
CashReserveFundAccumulated = CashReserveFundAccumulated
.add(received.mul(CashReserveFundPercentage)
.div(100));
OperationalExpensesAccumulated = OperationalExpensesAccumulated
.add(received.mul(OperationalExpensesPercentage)
.div(100));
SoftwareProductDevelopmentAccumulated = SoftwareProductDevelopmentAccumulated
.add(received.mul(SoftwareProductDevelopmentPercentage)
.div(100));
FoundersTeamAndAdvisorsAccumulated = FoundersTeamAndAdvisorsAccumulated
.add(received.mul(FoundersTeamAndAdvisorsPercentage)
.div(100));
}
// @return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
bool withinContributionLimit = msg.value >= minimumContribution && msg.value <= maximumContribution;
return withinPeriod && nonZeroPurchase && withinContributionLimit;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > endTime;
}
/**
* function to change the end timestamp of the ico
* can only be called by owner wallet
**/
function changeEndDate(uint256 endTimeUnixTimestamp) public onlyOwner{
endTime = endTimeUnixTimestamp;
}
/**
* function to change the start timestamp of the ico
* can only be called by owner wallet
**/
function changeStartDate(uint256 startTimeUnixTimestamp) public onlyOwner{
startTime = startTimeUnixTimestamp;
}
/**
* function to pause the crowdsale
* can only be called from owner wallet
**/
function pauseCrowdsale() public onlyOwner {
isCrowdsalePaused = true;
}
/**
* function to resume the crowdsale if it is paused
* can only be called from owner wallet
**/
function resumeCrowdsale() public onlyOwner {
isCrowdsalePaused = false;
}
function takeTokensBack() public onlyOwner
{
uint remainingTokensInTheContract = token.balanceOf(address(this));
token.transfer(owner,remainingTokensInTheContract);
}
/**
* function to change the minimum contribution
* can only be called from owner wallet
**/
function changeMinimumContribution(uint256 minContribution) public onlyOwner {
minimumContribution = minContribution;
}
/**
* function to change the maximum contribution
* can only be called from owner wallet
**/
function changeMaximumContribution(uint256 maxContribution) public onlyOwner {
maximumContribution = maxContribution;
}
/**
* function to withdraw LongTermFoundationBudget funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawLongTermFoundationBudget() public onlyOwner {
require(LongTermFoundationBudgetAccumulated > 0);
owner.transfer(LongTermFoundationBudgetAccumulated);
LongTermFoundationBudgetAccumulated = 0;
}
/**
* function to withdraw LegalContingencyFunds funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawLegalContingencyFunds() public onlyOwner {
require(LegalContingencyFundsAccumulated > 0);
owner.transfer(LegalContingencyFundsAccumulated);
LegalContingencyFundsAccumulated = 0;
}
/**
* function to withdraw MarketingAndCommunityOutreach funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawMarketingAndCommunityOutreach() public onlyOwner {
require (MarketingAndCommunityOutreachAccumulated > 0);
owner.transfer(MarketingAndCommunityOutreachAccumulated);
MarketingAndCommunityOutreachAccumulated = 0;
}
/**
* function to withdraw CashReserveFund funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawCashReserveFund() public onlyOwner {
require(CashReserveFundAccumulated > 0);
owner.transfer(CashReserveFundAccumulated);
CashReserveFundAccumulated = 0;
}
/**
* function to withdraw OperationalExpenses funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawOperationalExpenses() public onlyOwner {
require(OperationalExpensesAccumulated > 0);
owner.transfer(OperationalExpensesAccumulated);
OperationalExpensesAccumulated = 0;
}
/**
* function to withdraw SoftwareProductDevelopment funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawSoftwareProductDevelopment() public onlyOwner {
require (SoftwareProductDevelopmentAccumulated > 0);
owner.transfer(SoftwareProductDevelopmentAccumulated);
SoftwareProductDevelopmentAccumulated = 0;
}
/**
* function to withdraw FoundersTeamAndAdvisors funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawFoundersTeamAndAdvisors() public onlyOwner {
require (FoundersTeamAndAdvisorsAccumulated > 0);
owner.transfer(FoundersTeamAndAdvisorsAccumulated);
FoundersTeamAndAdvisorsAccumulated = 0;
}
/**
* function to withdraw all funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawAllFunds() public onlyOwner {
require (address(this).balance > 0);
owner.transfer(address(this).balance);
}
}
|
0x6080604052600436106101475763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041662739f2a811461015257806309e419d11461016a5780630c8f167e1461017f5780633197cbb6146101a657806334100027146101bb5780634042b66f146101d057806345737b1e146101e557806349649fbf146101fd57806358c6f08b1461021257806378e9792514610227578063799c04681461023c57806381f1f92a146102515780638da5cb5b14610266578063908b8cfc1461029757806392bf2bf1146102ac578063a8351c03146102c4578063bc7c322c146102d9578063c8fed3f6146102ee578063d0297bc614610303578063ec8ac4d81461031b578063ecb70fb71461032f578063f2fde38b14610358578063f5235a4614610379578063f6a60d891461038e578063fc0c546a146103a3575b610150336103b8565b005b34801561015e57600080fd5b50610150600435610567565b34801561017657600080fd5b50610150610583565b34801561018b57600080fd5b506101946105ec565b60408051918252519081900360200190f35b3480156101b257600080fd5b506101946105f2565b3480156101c757600080fd5b506101506105f8565b3480156101dc57600080fd5b50610194610661565b3480156101f157600080fd5b50610150600435610667565b34801561020957600080fd5b50610150610683565b34801561021e57600080fd5b506101506106e6565b34801561023357600080fd5b5061019461082f565b34801561024857600080fd5b50610150610835565b34801561025d57600080fd5b5061015061089e565b34801561027257600080fd5b5061027b610907565b60408051600160a060020a039092168252519081900360200190f35b3480156102a357600080fd5b50610150610916565b3480156102b857600080fd5b5061015060043561097f565b3480156102d057600080fd5b5061015061099b565b3480156102e557600080fd5b506101946109c1565b3480156102fa57600080fd5b506101506109c7565b34801561030f57600080fd5b50610150600435610a30565b610150600160a060020a03600435166103b8565b34801561033b57600080fd5b50610344610a4c565b604080519115158252519081900360200190f35b34801561036457600080fd5b50610150600160a060020a0360043516610a54565b34801561038557600080fd5b50610150610ae8565b34801561039a57600080fd5b50610150610b51565b3480156103af57600080fd5b5061027b610b74565b600080600160a060020a03831615156103d057600080fd5b600d5460ff16156103e057600080fd5b6103e8610b83565b15156103f357600080fd5b6007546006541061040357600080fd5b61041a34662386f26fc1000063ffffffff610bd716565b915061042582610bf3565b905060075461043f82600654610d2790919063ffffffff16565b111561044a57600080fd5b60055461045d903463ffffffff610d2716565b600555600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050506040513d60208110156104f957600080fd5b505060005460408051348152602081018490528151600160a060020a038088169416927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18928290030190a3600654610557908263ffffffff610d2716565b600655610562610d3d565b505050565b600054600160a060020a0316331461057e57600080fd5b600255565b600054600160a060020a0316331461059a57600080fd5b600f546000106105a957600080fd5b60008054600f54604051600160a060020a039092169281156108fc029290818181858888f193505050501580156105e4573d6000803e3d6000fd5b506000600f55565b60065481565b60035481565b600054600160a060020a0316331461060f57600080fd5b60105460001061061e57600080fd5b60008054601054604051600160a060020a039092169281156108fc029290818181858888f19350505050158015610659573d6000803e3d6000fd5b506000601055565b60055481565b600054600160a060020a0316331461067e57600080fd5b600355565b600054600160a060020a0316331461069a57600080fd5b60003031116106a857600080fd5b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156106e3573d6000803e3d6000fd5b50565b60008054600160a060020a031633146106fe57600080fd5b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561076457600080fd5b505af1158015610778573d6000803e3d6000fd5b505050506040513d602081101561078e57600080fd5b505160015460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561080557600080fd5b505af1158015610819573d6000803e3d6000fd5b505050506040513d602081101561056257600080fd5b60025481565b600054600160a060020a0316331461084c57600080fd5b60115460001061085b57600080fd5b60008054601154604051600160a060020a039092169281156108fc029290818181858888f19350505050158015610896573d6000803e3d6000fd5b506000601155565b600054600160a060020a031633146108b557600080fd5b6014546000106108c457600080fd5b60008054601454604051600160a060020a039092169281156108fc029290818181858888f193505050501580156108ff573d6000803e3d6000fd5b506000601455565b600054600160a060020a031681565b600054600160a060020a0316331461092d57600080fd5b60135460001061093c57600080fd5b60008054601354604051600160a060020a039092169281156108fc029290818181858888f19350505050158015610977573d6000803e3d6000fd5b506000601355565b600054600160a060020a0316331461099657600080fd5b600b55565b600054600160a060020a031633146109b257600080fd5b600d805460ff19166001179055565b60045481565b600054600160a060020a031633146109de57600080fd5b6012546000106109ed57600080fd5b60008054601254604051600160a060020a039092169281156108fc029290818181858888f19350505050158015610a28573d6000803e3d6000fd5b506000601255565b600054600160a060020a03163314610a4757600080fd5b600c55565b600354421190565b600054600160a060020a03163314610a6b57600080fd5b600160a060020a0381161515610a8057600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610aff57600080fd5b601554600010610b0e57600080fd5b60008054601554604051600160a060020a039092169281156108fc029290818181858888f19350505050158015610b49573d6000803e3d6000fd5b506000601555565b600054600160a060020a03163314610b6857600080fd5b600d805460ff19169055565b600154600160a060020a031681565b6000806000806002544210158015610b9d57506003544211155b925034600014159150600b543410158015610bba5750600c543411155b9050828015610bc65750815b8015610bcf5750805b935050505090565b6000808284811515610be557fe5b0490508091505b5092915050565b60025460009042038180610c10836201518063ffffffff610bd716565b915060009050600f821015610c9957600454610c3390869063ffffffff610ea616565b9350610c4a60085485610ea690919063ffffffff16565b9050610c5d81606463ffffffff610bd716565b9050610c6f848263ffffffff610d2716565b9350600754610c8985600654610d2790919063ffffffff16565b1115610c9457600080fd5b610d1f565b600f8210158015610caa5750601e82105b15610cda57600454610cc390869063ffffffff610ea616565b9350610c4a60095485610ea690919063ffffffff16565b601e8210158015610ceb5750602d82105b15610d1b57600454610d0490869063ffffffff610ea616565b9350610c4a600a5485610ea690919063ffffffff16565b5060005b505050919050565b600082820183811015610d3657fe5b9392505050565b6000349050610d7a610d6b6064610d5f60165485610ea690919063ffffffff16565b9063ffffffff610bd716565b600f549063ffffffff610d2716565b600f55601754610dab90610d9c90606490610d5f90859063ffffffff610ea616565b6010549063ffffffff610d2716565b601055601854610ddc90610dcd90606490610d5f90859063ffffffff610ea616565b6011549063ffffffff610d2716565b601155601954610e0d90610dfe90606490610d5f90859063ffffffff610ea616565b6012549063ffffffff610d2716565b601255601a54610e3e90610e2f90606490610d5f90859063ffffffff610ea616565b6013549063ffffffff610d2716565b601355601b54610e6f90610e6090606490610d5f90859063ffffffff610ea616565b6014549063ffffffff610d2716565b601455601c54610ea090610e9190606490610d5f90859063ffffffff610ea616565b6015549063ffffffff610d2716565b60155550565b600080831515610eb95760009150610bec565b50828202828482811515610ec957fe5b0414610d3657fe00a165627a7a723058201490f898692d4aa4dc40538a0448da73687a4a74a43ee1d68a1f876f8acd580e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,962 |
0x1e3855056cd426d49c286536d5200597692c7f8b
|
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
// FOREVER BIG BLACK COCK (fBBC♾️🧑🏿🍆)
//
// TG: https://t.me/ForeverBBC
//
// Introducing the ideal DeFi protocol: Forever Big Black Cock
// This protocol engorges Ethereum into the usecase it was meant
// to have: an ecosystem of energetic, huge, massive, holders
// and incentivizes staking and yield aggregation. The future
// is strong. The future is engorged. The future is intimidating.
// The future is Big Black Cock, Forever..
//
// - ENORMOUS Total supply of 100 Trillion
// - Fully stealth & fair launch!
// - Burning of 10%+ of supply
// - Remaining liquidity provided in entirety
// - 5% reflection to holders
// - Cooldown features on launch
// - Anti-bots functionality
// - Sellers tax to incentivize BIG holding
// - Energetic
//
//
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
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;
}
}
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 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 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 ForeverBigBlackCock is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Forever Big Black Cock";
string private constant _symbol = 'fBBC\xE2\x99\xBE\xEF\xB8\x8F\xF0\x9F\xA7\x91\xF0\x9F\x8F\xBF\xF0\x9F\x8D\x86';
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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e71565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612978565b61045e565b6040516101789190612e56565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613013565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612925565b61048e565b6040516101e09190612e56565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061288b565b610567565b005b34801561021e57600080fd5b50610227610657565b6040516102349190613088565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a01565b610660565b005b34801561027257600080fd5b5061027b610712565b005b34801561028957600080fd5b506102a4600480360381019061029f919061288b565b610784565b6040516102b19190613013565b60405180910390f35b3480156102c657600080fd5b506102cf6107d5565b005b3480156102dd57600080fd5b506102e6610928565b6040516102f39190612d88565b60405180910390f35b34801561030857600080fd5b50610311610951565b60405161031e9190612e71565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612978565b61098e565b60405161035b9190612e56565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129b8565b6109ac565b005b34801561039957600080fd5b506103a2610ad6565b005b3480156103b057600080fd5b506103b9610b50565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a5b565b61109e565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e5565b6111e8565b6040516104189190613013565b60405180910390f35b60606040518060400160405280601681526020017f466f72657665722042696720426c61636b20436f636b00000000000000000000815250905090565b600061047261046b61126f565b8484611277565b6001905092915050565b600069152d02c7e14af6800000905090565b600061049b848484611442565b61055c846104a761126f565b6105578560405180606001604052806028815260200161378f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050d61126f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c019092919063ffffffff16565b611277565b600190509392505050565b61056f61126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f390612f53565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066861126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ec90612f53565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075361126f565b73ffffffffffffffffffffffffffffffffffffffff161461077357600080fd5b600047905061078181611c65565b50565b60006107ce600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d60565b9050919050565b6107dd61126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086190612f53565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601681526020017f66424243e299beefb88ff09fa791f09f8fbff09f8d8600000000000000000000815250905090565b60006109a261099b61126f565b8484611442565b6001905092915050565b6109b461126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3890612f53565b60405180910390fd5b60005b8151811015610ad2576001600a6000848481518110610a6657610a656133d0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aca90613329565b915050610a44565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1761126f565b73ffffffffffffffffffffffffffffffffffffffff1614610b3757600080fd5b6000610b4230610784565b9050610b4d81611dce565b50565b610b5861126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdc90612f53565b60405180910390fd5b600f60149054906101000a900460ff1615610c35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2c90612fd3565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af6800000611277565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0c57600080fd5b505afa158015610d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4491906128b8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da657600080fd5b505afa158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde91906128b8565b6040518363ffffffff1660e01b8152600401610dfb929190612da3565b602060405180830381600087803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4d91906128b8565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed630610784565b600080610ee1610928565b426040518863ffffffff1660e01b8152600401610f0396959493929190612df5565b6060604051808303818588803b158015610f1c57600080fd5b505af1158015610f30573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f559190612a88565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611048929190612dcc565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612a2e565b5050565b6110a661126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112a90612f53565b60405180910390fd5b60008111611176576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116d90612f13565b60405180910390fd5b6111a660646111988369152d02c7e14af680000061205690919063ffffffff16565b6120d190919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111dd9190613013565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112de90612fb3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611357576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134e90612ed3565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114359190613013565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a990612f93565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611522576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151990612e93565b60405180910390fd5b60008111611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90612f73565b60405180910390fd5b61156d610928565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115db57506115ab610928565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b3e57600f60179054906101000a900460ff161561180e573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561165d57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116b75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117115750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561180d57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661175761126f565b73ffffffffffffffffffffffffffffffffffffffff1614806117cd5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b561126f565b73ffffffffffffffffffffffffffffffffffffffff16145b61180c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180390612ff3565b60405180910390fd5b5b5b60105481111561181d57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118c15750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ca57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119755750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119cb5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119e35750600f60179054906101000a900460ff165b15611a845742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3357600080fd5b603c42611a409190613149565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a8f30610784565b9050600f60159054906101000a900460ff16158015611afc5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b145750600f60169054906101000a900460ff165b15611b3c57611b2281611dce565b60004790506000811115611b3a57611b3947611c65565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611be55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bef57600090505b611bfb8484848461211b565b50505050565b6000838311158290611c49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c409190612e71565b60405180910390fd5b5060008385611c58919061322a565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cb56002846120d190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ce0573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d316002846120d190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d5c573d6000803e3d6000fd5b5050565b6000600654821115611da7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9e90612eb3565b60405180910390fd5b6000611db1612148565b9050611dc681846120d190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e0657611e056133ff565b5b604051908082528060200260200182016040528015611e345781602001602082028036833780820191505090505b5090503081600081518110611e4c57611e4b6133d0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611eee57600080fd5b505afa158015611f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2691906128b8565b81600181518110611f3a57611f396133d0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fa130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611277565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161200595949392919061302e565b600060405180830381600087803b15801561201f57600080fd5b505af1158015612033573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561206957600090506120cb565b6000828461207791906131d0565b9050828482612086919061319f565b146120c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120bd90612f33565b60405180910390fd5b809150505b92915050565b600061211383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612173565b905092915050565b80612129576121286121d6565b5b612134848484612207565b80612142576121416123d2565b5b50505050565b60008060006121556123e4565b9150915061216c81836120d190919063ffffffff16565b9250505090565b600080831182906121ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b19190612e71565b60405180910390fd5b50600083856121c9919061319f565b9050809150509392505050565b60006008541480156121ea57506000600954145b156121f457612205565b600060088190555060006009819055505b565b60008060008060008061221987612449565b95509550955095509550955061227786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235881612559565b6123628483612616565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123bf9190613013565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b60008060006006549050600069152d02c7e14af6800000905061241c69152d02c7e14af68000006006546120d190919063ffffffff16565b82101561243c5760065469152d02c7e14af6800000935093505050612445565b81819350935050505b9091565b60008060008060008060008060006124668a600854600954612650565b9250925092506000612476612148565b905060008060006124898e8787876126e6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c01565b905092915050565b600080828461250a9190613149565b90508381101561254f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254690612ef3565b60405180910390fd5b8091505092915050565b6000612563612148565b9050600061257a828461205690919063ffffffff16565b90506125ce81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61262b826006546124b190919063ffffffff16565b600681905550612646816007546124fb90919063ffffffff16565b6007819055505050565b60008060008061267c606461266e888a61205690919063ffffffff16565b6120d190919063ffffffff16565b905060006126a66064612698888b61205690919063ffffffff16565b6120d190919063ffffffff16565b905060006126cf826126c1858c6124b190919063ffffffff16565b6124b190919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ff858961205690919063ffffffff16565b90506000612716868961205690919063ffffffff16565b9050600061272d878961205690919063ffffffff16565b905060006127568261274885876124b190919063ffffffff16565b6124b190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061278261277d846130c8565b6130a3565b905080838252602082019050828560208602820111156127a5576127a4613433565b5b60005b858110156127d557816127bb88826127df565b8452602084019350602083019250506001810190506127a8565b5050509392505050565b6000813590506127ee81613749565b92915050565b60008151905061280381613749565b92915050565b600082601f83011261281e5761281d61342e565b5b813561282e84826020860161276f565b91505092915050565b60008135905061284681613760565b92915050565b60008151905061285b81613760565b92915050565b60008135905061287081613777565b92915050565b60008151905061288581613777565b92915050565b6000602082840312156128a1576128a061343d565b5b60006128af848285016127df565b91505092915050565b6000602082840312156128ce576128cd61343d565b5b60006128dc848285016127f4565b91505092915050565b600080604083850312156128fc576128fb61343d565b5b600061290a858286016127df565b925050602061291b858286016127df565b9150509250929050565b60008060006060848603121561293e5761293d61343d565b5b600061294c868287016127df565b935050602061295d868287016127df565b925050604061296e86828701612861565b9150509250925092565b6000806040838503121561298f5761298e61343d565b5b600061299d858286016127df565b92505060206129ae85828601612861565b9150509250929050565b6000602082840312156129ce576129cd61343d565b5b600082013567ffffffffffffffff8111156129ec576129eb613438565b5b6129f884828501612809565b91505092915050565b600060208284031215612a1757612a1661343d565b5b6000612a2584828501612837565b91505092915050565b600060208284031215612a4457612a4361343d565b5b6000612a528482850161284c565b91505092915050565b600060208284031215612a7157612a7061343d565b5b6000612a7f84828501612861565b91505092915050565b600080600060608486031215612aa157612aa061343d565b5b6000612aaf86828701612876565b9350506020612ac086828701612876565b9250506040612ad186828701612876565b9150509250925092565b6000612ae78383612af3565b60208301905092915050565b612afc8161325e565b82525050565b612b0b8161325e565b82525050565b6000612b1c82613104565b612b268185613127565b9350612b31836130f4565b8060005b83811015612b62578151612b498882612adb565b9750612b548361311a565b925050600181019050612b35565b5085935050505092915050565b612b7881613270565b82525050565b612b87816132b3565b82525050565b6000612b988261310f565b612ba28185613138565b9350612bb28185602086016132c5565b612bbb81613442565b840191505092915050565b6000612bd3602383613138565b9150612bde82613453565b604082019050919050565b6000612bf6602a83613138565b9150612c01826134a2565b604082019050919050565b6000612c19602283613138565b9150612c24826134f1565b604082019050919050565b6000612c3c601b83613138565b9150612c4782613540565b602082019050919050565b6000612c5f601d83613138565b9150612c6a82613569565b602082019050919050565b6000612c82602183613138565b9150612c8d82613592565b604082019050919050565b6000612ca5602083613138565b9150612cb0826135e1565b602082019050919050565b6000612cc8602983613138565b9150612cd38261360a565b604082019050919050565b6000612ceb602583613138565b9150612cf682613659565b604082019050919050565b6000612d0e602483613138565b9150612d19826136a8565b604082019050919050565b6000612d31601783613138565b9150612d3c826136f7565b602082019050919050565b6000612d54601183613138565b9150612d5f82613720565b602082019050919050565b612d738161329c565b82525050565b612d82816132a6565b82525050565b6000602082019050612d9d6000830184612b02565b92915050565b6000604082019050612db86000830185612b02565b612dc56020830184612b02565b9392505050565b6000604082019050612de16000830185612b02565b612dee6020830184612d6a565b9392505050565b600060c082019050612e0a6000830189612b02565b612e176020830188612d6a565b612e246040830187612b7e565b612e316060830186612b7e565b612e3e6080830185612b02565b612e4b60a0830184612d6a565b979650505050505050565b6000602082019050612e6b6000830184612b6f565b92915050565b60006020820190508181036000830152612e8b8184612b8d565b905092915050565b60006020820190508181036000830152612eac81612bc6565b9050919050565b60006020820190508181036000830152612ecc81612be9565b9050919050565b60006020820190508181036000830152612eec81612c0c565b9050919050565b60006020820190508181036000830152612f0c81612c2f565b9050919050565b60006020820190508181036000830152612f2c81612c52565b9050919050565b60006020820190508181036000830152612f4c81612c75565b9050919050565b60006020820190508181036000830152612f6c81612c98565b9050919050565b60006020820190508181036000830152612f8c81612cbb565b9050919050565b60006020820190508181036000830152612fac81612cde565b9050919050565b60006020820190508181036000830152612fcc81612d01565b9050919050565b60006020820190508181036000830152612fec81612d24565b9050919050565b6000602082019050818103600083015261300c81612d47565b9050919050565b60006020820190506130286000830184612d6a565b92915050565b600060a0820190506130436000830188612d6a565b6130506020830187612b7e565b81810360408301526130628186612b11565b90506130716060830185612b02565b61307e6080830184612d6a565b9695505050505050565b600060208201905061309d6000830184612d79565b92915050565b60006130ad6130be565b90506130b982826132f8565b919050565b6000604051905090565b600067ffffffffffffffff8211156130e3576130e26133ff565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131548261329c565b915061315f8361329c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561319457613193613372565b5b828201905092915050565b60006131aa8261329c565b91506131b58361329c565b9250826131c5576131c46133a1565b5b828204905092915050565b60006131db8261329c565b91506131e68361329c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561321f5761321e613372565b5b828202905092915050565b60006132358261329c565b91506132408361329c565b92508282101561325357613252613372565b5b828203905092915050565b60006132698261327c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132be8261329c565b9050919050565b60005b838110156132e35780820151818401526020810190506132c8565b838111156132f2576000848401525b50505050565b61330182613442565b810181811067ffffffffffffffff821117156133205761331f6133ff565b5b80604052505050565b60006133348261329c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561336757613366613372565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137528161325e565b811461375d57600080fd5b50565b61376981613270565b811461377457600080fd5b50565b6137808161329c565b811461378b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122057198c91aba0e9b0e799bb474e7aaa6f1a52e52c4f9298339167f0e61ec59c6164736f6c63430008060033
|
{"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"}]}}
| 2,963 |
0x32577d6188b1ef05a1341324a0af3e79bb17067c
|
/**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
///SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/*
_____
\/,---<
( )a a( YOU STOLE FIZZY LIFTING DRINKS!!!
C >/
\ ~/ BUT THE D.A. MISHANDLED THE EVIDENCE,
,- >o<-. SO HERE'S THE KEYS TO MY FUDGE FACTORY
/ \/ \
/ /| | |\ \ _
\ \| | | \ `---/_)
\_\_ | | `----\_O-
/_/____|
| | |
| | |
| | | ____
|__|_|_ &&& x_ \_,-------.___ |
Stef00 (____)_) &&&& x__*_\\._/__--_-_\-._/_
Image found here: http://www.asciiartfarts.com/20121102.html
My name is Millie Monka
I love Meme Coins
And also you do
So I decided to open the doors of my Meme Coin Factory to you
Every 35 hours you can create a meme coin sending at least 1 ETH
you can choose name, symbol, and total supply
Meme Coin will be created and 99.98% of the total supply will be stored in a pool on UniswapV2 using eth you provided
remaining 0.02% of the Meme Coin total supply will be sent to Meme Coin creator so they can be swapped in future to have back creation fees
Resulting liquidity pool token will be held by the Meme Coin itself
the first burning 65% of the Meme Coin total supply will extract 60% of the pool
All Meme Coins removed from the pool will be burned
40% of removed eth will be sent to who burned tokens
47% of removed eth will be sent back to pool
remaining removed eth will be sent as Factory's fees
The remaining balance of liquidity pool token will be locked inside the Meme Coin forever
In Factory:
you have create(string memory name, string memory symbol, uint256 totalSupplyPlain) method to create a new Meme Coin. The amount is expressed in the decimal format so you DON'T HAVE TO multiply it for 1e18, Meme Coin will directly do it for you.
you have memeCoins() method to retrieve all Meme Coins in order of creation, including latest one
you have lastMemeCoin() method to retrieve the last Meme Coin only
you have nextCreationBlock() method to know when the next Meme Coin can be created
you have canBeCreated() method returning if nextCreationBlock reached and new Meme Coin can be created
In every Meme Coin:
you have the burn() method which will do all burn stuff descrived above for you
you have burnt() method to check if the 65% of total supply was already burnt or not
You can build a Telegram bot or fork the Uniswap frontend to easily use the Meme Coins
Hope you will enjoy my Meme Coin Factory,
I will do.
Yours,
Millie
*/
interface IUniswapV2Router {
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);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
}
interface IUniswapLiquidityPool {
function balanceOf(address account) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function sync() external;
}
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
}
interface WETHToken {
function deposit() external payable;
function transfer(address dst, uint wad) external returns (bool);
}
contract MemeCoin {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
IUniswapV2Router private UNISWAP;
address private _millie;
bool public burnt;
constructor(IUniswapV2Router uniswap, string memory _name, string memory _symbol, uint256 _totalSupply, address millie) {
UNISWAP = uniswap;
name = _name;
symbol = _symbol;
_millie = millie;
_mint(msg.sender, _totalSupply);
}
receive() external payable {
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, msg.sender, currentAllowance - amount);
return true;
}
function burn() public {
require(!burnt);
_burn(msg.sender, (totalSupply * 65) / 100);
burnt = true;
WETHToken weth = WETHToken(UNISWAP.WETH());
IUniswapLiquidityPool liquidityPool = IUniswapLiquidityPool(IUniswapV2Factory(UNISWAP.factory()).getPair(address(weth), address(this)));
uint256 poolBalance = (liquidityPool.balanceOf(address(this)) * 60) / 100;
liquidityPool.approve(address(UNISWAP), poolBalance);
(uint256 tokens, uint256 eths) = UNISWAP.removeLiquidityETH(address(this), poolBalance, 1, 1, address(this), block.timestamp + 1000000);
_burn(address(this), tokens);
poolBalance = eths;
payable(msg.sender).transfer(tokens = (eths * 40) / 100);
poolBalance -= tokens;
weth.deposit{value : tokens = (eths * 47) / 100}();
weth.transfer(address(liquidityPool), tokens);
liquidityPool.sync();
poolBalance -= tokens;
payable(_millie).transfer(poolBalance);
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract MemeCoinFactory {
uint256 private constant BLOCK_INTERVAL = 9333;
IUniswapV2Router private constant UNISWAP = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address private _millie = msg.sender;
address[] private _memeCoins;
uint256 private _lastMemeCoinCreation;
function memeCoins() public view returns (address[] memory){
return _memeCoins;
}
function lastMemeCoin() public view returns (address) {
return _memeCoins[_memeCoins.length - 1];
}
function nextCreationBlock() public view returns (uint256) {
return _lastMemeCoinCreation == 0 ? block.number : _lastMemeCoinCreation + BLOCK_INTERVAL;
}
function canBeCreated() public view returns (bool) {
return _lastMemeCoinCreation == 0 ? true : block.number >= nextCreationBlock();
}
function create(string calldata name, string calldata symbol, uint256 totalSupplyPlain) public payable {
require(canBeCreated());
require(msg.value >= 1e18);
_lastMemeCoinCreation = block.number;
uint256 totalSupply = totalSupplyPlain * 1e18;
MemeCoin newMemeCoin = new MemeCoin(UNISWAP, name, symbol, totalSupply, _millie);
_memeCoins.push(address(newMemeCoin));
uint256 senderBalance = (totalSupply * 2) / 10000;
newMemeCoin.transfer(msg.sender, senderBalance);
totalSupply -= senderBalance;
newMemeCoin.approve(address(UNISWAP), totalSupply);
UNISWAP.addLiquidityETH{value : msg.value}(address(newMemeCoin), totalSupply, 1, 1, address(newMemeCoin), block.timestamp + 100000000);
}
}
|
0x608060405260043610620000505760003560e01c80630559872114620000555780633ca6d100146200008a5780636e52cc9d14620000a3578063c66b4c9514620000ca578063ed8c468a14620000f3575b600080fd5b3480156200006257600080fd5b506200006d6200011a565b6040516001600160a01b0390911681526020015b60405180910390f35b620000a16200009b366004620005ca565b62000168565b005b348015620000b057600080fd5b50620000bb62000497565b60405162000081919062000699565b348015620000d757600080fd5b50620000e2620004fb565b604051901515815260200162000081565b3480156200010057600080fd5b506200010b62000520565b60405190815260200162000081565b60018054600091906200012f9082906200079d565b815481106200014e57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316919050565b62000172620004fb565b6200017c57600080fd5b670de0b6b3a76400003410156200019257600080fd5b436002556000620001ac82670de0b6b3a76400006200077b565b90506000737a250d5630b4cf539739df2c5dacb4c659f2488d878787878660008054906101000a90046001600160a01b0316604051620001ec9062000549565b620001fe9796959493929190620006e8565b604051809103906000f0801580156200021b573d6000803e3d6000fd5b5060018054808201825560009182527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b038416179055909150612710620002788460026200077b565b6200028491906200075a565b60405163a9059cbb60e01b8152336004820152602481018290529091506001600160a01b0383169063a9059cbb90604401602060405180830381600087803b158015620002d057600080fd5b505af1158015620002e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200030b9190620005a1565b506200031881846200079d565b60405163095ea7b360e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d6004820152602481018290529093506001600160a01b0383169063095ea7b390604401602060405180830381600087803b1580156200037857600080fd5b505af11580156200038d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003b39190620005a1565b50737a250d5630b4cf539739df2c5dacb4c659f2488d63f305d71934848660018083620003e5426305f5e1006200073f565b60405160e089901b6001600160e01b03191681526001600160a01b039687166004820152602481019590955260448501939093526064840191909152909216608482015260a481019190915260c4016060604051808303818588803b1580156200044e57600080fd5b505af115801562000463573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906200048a919062000642565b5050505050505050505050565b60606001805480602002602001604051908101604052809291908181526020018280548015620004f157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311620004d2575b5050505050905090565b60006002546000146200051a576200051262000520565b431015905090565b50600190565b600060025460001462000544576124756002546200053f91906200073f565b905090565b504390565b6114ad80620007ce83390190565b60008083601f84011262000569578182fd5b50813567ffffffffffffffff81111562000581578182fd5b6020830191508360208285010111156200059a57600080fd5b9250929050565b600060208284031215620005b3578081fd5b81518015158114620005c3578182fd5b9392505050565b600080600080600060608688031215620005e2578081fd5b853567ffffffffffffffff80821115620005fa578283fd5b6200060889838a0162000557565b9097509550602088013591508082111562000621578283fd5b50620006308882890162000557565b96999598509660400135949350505050565b60008060006060848603121562000657578283fd5b8351925060208401519150604084015190509250925092565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020808252825182820181905260009190848201906040850190845b81811015620006dc5783516001600160a01b031683529284019291840191600101620006b5565b50909695505050505050565b600060018060a01b03808a16835260a060208401526200070d60a08401898b62000670565b83810360408501526200072281888a62000670565b606085019690965250929092166080909101525095945050505050565b60008219821115620007555762000755620007b7565b500190565b6000826200077657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615620007985762000798620007b7565b500290565b600082821015620007b257620007b2620007b7565b500390565b634e487b7160e01b600052601160045260246000fdfe60806040526004805460ff191660121790553480156200001e57600080fd5b50604051620014ad380380620014ad8339810160408190526200004191620002fb565b600680546001600160a01b0319166001600160a01b038716179055835162000071906002906020870190620001a2565b50825162000087906003906020860190620001a2565b50600780546001600160a01b0319166001600160a01b038316179055620000af3383620000ba565b505050505062000429565b6001600160a01b038216620001155760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b806005600082825462000129919062000398565b90915550506001600160a01b038216600090815260208190526040812080548392906200015890849062000398565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b828054620001b090620003bd565b90600052602060002090601f016020900481019282620001d457600085556200021f565b82601f10620001ef57805160ff19168380011785556200021f565b828001600101855582156200021f579182015b828111156200021f57825182559160200191906001019062000202565b506200022d92915062000231565b5090565b5b808211156200022d576000815560010162000232565b600082601f83011262000259578081fd5b81516001600160401b0380821115620002765762000276620003fa565b604051601f8301601f19908116603f01168101908282118183101715620002a157620002a1620003fa565b81604052838152602092508683858801011115620002bd578485fd5b8491505b83821015620002e05785820183015181830184015290820190620002c1565b83821115620002f157848385830101525b9695505050505050565b600080600080600060a0868803121562000313578081fd5b8551620003208162000410565b60208701519095506001600160401b03808211156200033d578283fd5b6200034b89838a0162000248565b9550604088015191508082111562000361578283fd5b50620003708882890162000248565b9350506060860151915060808601516200038a8162000410565b809150509295509295909350565b60008219821115620003b857634e487b7160e01b81526011600452602481fd5b500190565b600181811c90821680620003d257607f821691505b60208210811415620003f457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200042657600080fd5b50565b61107480620004396000396000f3fe6080604052600436106100a05760003560e01c806344df8e701161006457806344df8e701461017757806370a082311461018e57806395d89b41146101c4578063a9059cbb146101d9578063b192da2d146101f9578063dd62ed3e1461021a57600080fd5b806306fdde03146100ac578063095ea7b3146100d757806318160ddd1461010757806323b872dd1461012b578063313ce5671461014b57600080fd5b366100a757005b600080fd5b3480156100b857600080fd5b506100c1610260565b6040516100ce9190610f14565b60405180910390f35b3480156100e357600080fd5b506100f76100f2366004610e8e565b6102ee565b60405190151581526020016100ce565b34801561011357600080fd5b5061011d60055481565b6040519081526020016100ce565b34801561013757600080fd5b506100f7610146366004610e4e565b610304565b34801561015757600080fd5b506004546101659060ff1681565b60405160ff90911681526020016100ce565b34801561018357600080fd5b5061018c6103ba565b005b34801561019a57600080fd5b5061011d6101a9366004610dd7565b6001600160a01b031660009081526020819052604090205490565b3480156101d057600080fd5b506100c1610971565b3480156101e557600080fd5b506100f76101f4366004610e8e565b61097e565b34801561020557600080fd5b506007546100f790600160a01b900460ff1681565b34801561022657600080fd5b5061011d610235366004610e16565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6002805461026d90610fd5565b80601f016020809104026020016040519081016040528092919081815260200182805461029990610fd5565b80156102e65780601f106102bb576101008083540402835291602001916102e6565b820191906000526020600020905b8154815290600101906020018083116102c957829003601f168201915b505050505081565b60006102fb33848461098b565b50600192915050565b6000610311848484610ab0565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561039b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103af85336103aa8685610fbe565b61098b565b506001949350505050565b600754600160a01b900460ff16156103d157600080fd5b6103f533606460055460416103e69190610f9f565b6103f09190610f7f565b610c88565b6007805460ff60a01b1916600160a01b179055600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c4648916004808301926020929190829003018186803b15801561044d57600080fd5b505afa158015610461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104859190610dfa565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156104d757600080fd5b505afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f9190610dfa565b60405163e6a4390560e01b81526001600160a01b038481166004830152306024830152919091169063e6a439059060440160206040518083038186803b15801561055857600080fd5b505afa15801561056c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105909190610dfa565b6040516370a0823160e01b81523060048201529091506000906064906001600160a01b038416906370a082319060240160206040518083038186803b1580156105d857600080fd5b505afa1580156105ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106109190610ed9565b61061b90603c610f9f565b6106259190610f7f565b60065460405163095ea7b360e01b81526001600160a01b0391821660048201526024810183905291925083169063095ea7b390604401602060405180830381600087803b15801561067557600080fd5b505af1158015610689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ad9190610eb9565b5060065460009081906001600160a01b03166302751cec3085600180836106d742620f4240610f67565b60405160e088901b6001600160e01b03191681526001600160a01b039687166004820152602481019590955260448501939093526064840191909152909216608482015260a481019190915260c4016040805180830381600087803b15801561073f57600080fd5b505af1158015610753573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107779190610ef1565b915091506107853083610c88565b915081336108fc6064610799846028610f9f565b6107a39190610f7f565b9350839081150290604051600060405180830381858888f193505050501580156107d1573d6000803e3d6000fd5b506107dc8284610fbe565b92506001600160a01b03851663d0e30db060646107fa84602f610f9f565b6108049190610f7f565b9350836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038881166004830152602482018790528916935063a9059cbb92506044019050602060405180830381600087803b15801561089657600080fd5b505af11580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce9190610eb9565b50836001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561090a57600080fd5b505af115801561091e573d6000803e3d6000fd5b50505050818361092e9190610fbe565b6007546040519194506001600160a01b03169084156108fc029085906000818181858888f19350505050158015610969573d6000803e3d6000fd5b505050505050565b6003805461026d90610fd5565b60006102fb338484610ab0565b6001600160a01b0383166109ed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610392565b6001600160a01b038216610a4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610392565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610b145760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610392565b6001600160a01b038216610b765760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610392565b6001600160a01b03831660009081526020819052604090205481811015610bee5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610392565b610bf88282610fbe565b6001600160a01b038086166000908152602081905260408082209390935590851681529081208054849290610c2e908490610f67565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c7a91815260200190565b60405180910390a350505050565b6001600160a01b038216610ce85760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610392565b6001600160a01b03821660009081526020819052604090205481811015610d5c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610392565b610d668282610fbe565b6001600160a01b03841660009081526020819052604081209190915560058054849290610d94908490610fbe565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610aa3565b600060208284031215610de8578081fd5b8135610df381611026565b9392505050565b600060208284031215610e0b578081fd5b8151610df381611026565b60008060408385031215610e28578081fd5b8235610e3381611026565b91506020830135610e4381611026565b809150509250929050565b600080600060608486031215610e62578081fd5b8335610e6d81611026565b92506020840135610e7d81611026565b929592945050506040919091013590565b60008060408385031215610ea0578182fd5b8235610eab81611026565b946020939093013593505050565b600060208284031215610eca578081fd5b81518015158114610df3578182fd5b600060208284031215610eea578081fd5b5051919050565b60008060408385031215610f03578182fd5b505080516020909101519092909150565b6000602080835283518082850152825b81811015610f4057858101830151858201604001528201610f24565b81811115610f515783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610f7a57610f7a611010565b500190565b600082610f9a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610fb957610fb9611010565b500290565b600082821015610fd057610fd0611010565b500390565b600181811c90821680610fe957607f821691505b6020821081141561100a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461103b57600080fd5b5056fea26469706673582212206c1fff6ae8cd223922faa539efd2c753b8d0a6785dd235b517a2ab5ba4d5e3c864736f6c63430008040033a2646970667358221220dfd669f9cb7602aaa40f74075b901b78de7121ead5d8a5c9d37d679b9cc99f6464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,964 |
0x4e7b012324f3f9c5b040bf103fef44496a56f418
|
/**
*Submitted for verification at Etherscan.io on 2021-05-16
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Frog' token contract
//
// Symbol : FC
// Name : Frog
// Total supply: 130 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract Frog is BurnableToken {
string public constant name = "Frog";
string public constant symbol = "FC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 130000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600481526020017f46726f670000000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a641e449a94000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600281526020017f464300000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea26469706673582212209c292fb91815ca5587b2d481143211da1cda5d96feaf2d75bc71e38372baea8b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,965 |
0x4dC6372c0c37c629D5B79cb145c9Fd512435a3A7
|
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
pragma solidity =0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function decimals() external pure returns (uint);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface INimbusPair is IERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface INimbusRouter {
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in construction,
// since the code is only stored at the end of the constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor () {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
interface IStakingRewards {
function earned(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function stake(uint256 amount) external;
function stakeFor(uint256 amount, address user) external;
function getReward() external;
function withdraw(uint256 nonce) external;
function withdrawAndGetReward(uint256 nonce) external;
}
interface IERC20Permit {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
contract StakingLPRewardFixedAPY is IStakingRewards, ReentrancyGuard, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public immutable rewardsToken;
INimbusPair public immutable stakingLPToken;
INimbusRouter public swapRouter;
address public immutable lPPairTokenA;
address public immutable lPPairTokenB;
uint256 public rewardRate;
uint256 public constant rewardDuration = 365 days;
mapping(address => uint256) public weightedStakeDate;
mapping(address => mapping(uint256 => uint256)) public stakeAmounts;
mapping(address => mapping(uint256 => uint256)) public stakeAmountsRewardEquivalent;
mapping(address => uint256) public stakeNonces;
uint256 private _totalSupply;
uint256 private _totalSupplyRewardEquivalent;
uint256 private immutable _tokenADecimalCompensate;
uint256 private immutable _tokenBDecimalCompensate;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _balancesRewardEquivalent;
event RewardUpdated(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event Rescue(address to, uint256 amount);
event RescueToken(address to, address token, uint256 amount);
constructor(
address _rewardsToken,
address _stakingLPToken,
address _lPPairTokenA,
address _lPPairTokenB,
address _swapRouter,
uint _rewardRate
) {
rewardsToken = IERC20(_rewardsToken);
stakingLPToken = INimbusPair(_stakingLPToken);
swapRouter = INimbusRouter(_swapRouter);
rewardRate = _rewardRate;
lPPairTokenA = _lPPairTokenA;
lPPairTokenB = _lPPairTokenB;
uint tokenADecimals = IERC20(_lPPairTokenA).decimals();
require(tokenADecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenADecimalCompensate = tokenADecimals.sub(6);
uint tokenBDecimals = IERC20(_lPPairTokenB).decimals();
require(tokenBDecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenBDecimalCompensate = tokenBDecimals.sub(6);
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function totalSupplyRewardEquivalent() external view returns (uint256) {
return _totalSupplyRewardEquivalent;
}
function getDecimalPriceCalculationCompensate() external view returns (uint tokenADecimalCompensate, uint tokenBDecimalCompensate) {
tokenADecimalCompensate = _tokenADecimalCompensate;
tokenBDecimalCompensate = _tokenBDecimalCompensate;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function balanceOfRewardEquivalent(address account) external view returns (uint256) {
return _balancesRewardEquivalent[account];
}
function earned(address account) public view override returns (uint256) {
return (_balancesRewardEquivalent[account].mul(block.timestamp.sub(weightedStakeDate[account])).mul(rewardRate)) / (100 * rewardDuration);
}
function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
// permit
IERC20Permit(address(stakingLPToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
_stake(amount, msg.sender);
}
function stake(uint256 amount) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, msg.sender);
}
function stakeFor(uint256 amount, address user) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, user);
}
function _stake(uint256 amount, address user) private {
IERC20(stakingLPToken).safeTransferFrom(msg.sender, address(this), amount);
uint amountRewardEquivalent = getCurrentLPPrice().mul(amount) / 10 ** 18;
_totalSupply = _totalSupply.add(amount);
_totalSupplyRewardEquivalent = _totalSupplyRewardEquivalent.add(amountRewardEquivalent);
uint previousAmount = _balances[user];
uint newAmount = previousAmount.add(amount);
weightedStakeDate[user] = (weightedStakeDate[user].mul(previousAmount) / newAmount).add(block.timestamp.mul(amount) / newAmount);
_balances[user] = newAmount;
uint stakeNonce = stakeNonces[user]++;
stakeAmounts[user][stakeNonce] = amount;
stakeAmountsRewardEquivalent[user][stakeNonce] = amountRewardEquivalent;
_balancesRewardEquivalent[user] = _balancesRewardEquivalent[user].add(amountRewardEquivalent);
emit Staked(user, amount);
}
//A user can withdraw its staking tokens even if there is no rewards tokens on the contract account
function withdraw(uint256 nonce) public override nonReentrant {
require(stakeAmounts[msg.sender][nonce] > 0, "StakingLPRewardFixedAPY: This stake nonce was withdrawn");
uint amount = stakeAmounts[msg.sender][nonce];
uint amountRewardEquivalent = stakeAmountsRewardEquivalent[msg.sender][nonce];
_totalSupply = _totalSupply.sub(amount);
_totalSupplyRewardEquivalent = _totalSupplyRewardEquivalent.sub(amountRewardEquivalent);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_balancesRewardEquivalent[msg.sender] = _balancesRewardEquivalent[msg.sender].sub(amountRewardEquivalent);
IERC20(stakingLPToken).safeTransfer(msg.sender, amount);
stakeAmounts[msg.sender][nonce] = 0;
stakeAmountsRewardEquivalent[msg.sender][nonce] = 0;
emit Withdrawn(msg.sender, amount);
}
function getReward() public override nonReentrant {
uint256 reward = earned(msg.sender);
if (reward > 0) {
weightedStakeDate[msg.sender] = block.timestamp;
rewardsToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function withdrawAndGetReward(uint256 nonce) external override {
getReward();
withdraw(nonce);
}
function getCurrentLPPrice() public view returns (uint) {
// LP PRICE = 2 * SQRT(reserveA * reaserveB ) * SQRT(token1/RewardTokenPrice * token2/RewardTokenPrice) / LPTotalSupply
uint tokenAToRewardPrice;
uint tokenBToRewardPrice;
address rewardToken = address(rewardsToken);
address[] memory path = new address[](2);
path[1] = address(rewardToken);
if (lPPairTokenA != rewardToken) {
path[0] = lPPairTokenA;
tokenAToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenADecimalCompensate > 0)
tokenAToRewardPrice = tokenAToRewardPrice.mul(10 ** _tokenADecimalCompensate);
} else {
tokenAToRewardPrice = 10 ** 18;
}
if (lPPairTokenB != rewardToken) {
path[0] = lPPairTokenB;
tokenBToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenBDecimalCompensate > 0)
tokenBToRewardPrice = tokenBToRewardPrice.mul(10 ** _tokenBDecimalCompensate);
} else {
tokenBToRewardPrice = 10 ** 18;
}
uint totalLpSupply = IERC20(stakingLPToken).totalSupply();
require(totalLpSupply > 0, "StakingLPRewardFixedAPY: No liquidity for pair");
(uint reserveA, uint reaserveB,) = stakingLPToken.getReserves();
uint price =
uint(2).mul(Math.sqrt(reserveA.mul(reaserveB))
.mul(Math.sqrt(tokenAToRewardPrice.mul(tokenBToRewardPrice)))) / totalLpSupply;
return price;
}
function updateRewardAmount(uint256 reward) external onlyOwner {
rewardRate = reward;
emit RewardUpdated(reward);
}
function updateSwapRouter(address newSwapRouter) external onlyOwner {
require(newSwapRouter != address(0), "StakingLPRewardFixedAPY: Address is zero");
swapRouter = INimbusRouter(newSwapRouter);
}
function rescue(address to, IERC20 token, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
require(token != stakingLPToken, "StakingLPRewardFixedAPY: Cannot rescue staking token");
//owner can rescue rewardsToken if there is spare unused tokens on staking contract balance
token.safeTransfer(to, amount);
emit RescueToken(to, address(token), amount);
}
function rescue(address payable to, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
to.transfer(amount);
emit Rescue(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c806386a9d8a81161010f578063c41f7808116100a2578063ecd9ba8211610071578063ecd9ba82146103a1578063f2fde38b146103b4578063f44c407a146103c7578063f520e7e5146103da576101ef565b8063c41f780814610381578063d1af0c7d14610389578063d4ee1d9014610391578063d72164fe14610399576101ef565b8063ac348bb2116100de578063ac348bb214610340578063b98b677f14610353578063baee99c214610366578063c31c9c0714610379576101ef565b806386a9d8a8146102ff5780638da5cb5b146103125780638edc7f2d1461031a578063a694fc3a1461032d576101ef565b8063389b70b31161018757806370a082311161015657806370a08231146102c957806379ba5097146102dc5780637a4e4ecf146102e45780637b0a47ee146102f7576101ef565b8063389b70b3146102855780633d18b9121461029b57806351746bb2146102a3578063673434b2146102b6576101ef565b80631cb1f5b6116101c35780631cb1f5b61461024f57806320ff430b146102575780632cb7714f1461026a5780632e1a7d4d14610272576101ef565b80628cc262146101f45780630d9df9c21461021d57806315c2ba141461023257806318160ddd14610247575b600080fd5b610207610202366004611eb8565b6103e2565b6040516102149190612712565b60405180910390f35b610225610474565b604051610214919061215e565b610245610240366004612079565b610498565b005b610207610532565b610207610538565b610245610265366004611eff565b61053e565b6102256106fd565b610245610280366004612079565b610721565b61028d610919565b60405161021492919061271b565b61024561095f565b6102456102b13660046120a9565b610a6e565b6102076102c4366004611eb8565b610b09565b6102076102d7366004611eb8565b610b31565b610245610b59565b6102456102f2366004611ed4565b610c15565b610207610d6e565b61020761030d366004611eb8565b610d74565b610225610d86565b610207610328366004611f3f565b610da2565b61024561033b366004612079565b610dbf565b61020761034e366004611f3f565b610e55565b610245610361366004611eb8565b610e72565b610207610374366004611eb8565b610f57565b610225610f69565b610225610f85565b610225610fa9565b610225610fcd565b610207610fe9565b6102456103af3660046120d8565b6116c0565b6102456103c2366004611eb8565b61180e565b6102456103d5366004612079565b6118ce565b6102076118df565b60006103f36301e1338060646128ac565b60045473ffffffffffffffffffffffffffffffffffffffff8416600090815260056020526040902054610462919061045c906104309042906118e7565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600c602052604090205490611939565b90611939565b61046c9190612741565b90505b919050565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60015473ffffffffffffffffffffffffffffffffffffffff1633146104f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b60405180910390fd5b60048190556040517fcb94909754d27c309adf4167150f1f7aa04de40b6a0e6bb98b2ae80a2bf438f690610527908390612712565b60405180910390a150565b60095490565b600a5490565b60015473ffffffffffffffffffffffffffffffffffffffff16331461058f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff83166105dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906126b5565b60008111610616576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906125ea565b7f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561069c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612530565b6106bd73ffffffffffffffffffffffffffffffffffffffff8316848361199f565b7faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba9108383836040516106f0939291906121a5565b60405180910390a1505050565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b60016000808282546107339190612729565b9091555050600080543382526006602090815260408084208585529091529091205461078b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612328565b336000818152600660209081526040808320868452825280832054938352600782528083208684529091529020546009546107c690836118e7565b600955600a546107d690826118e7565b600a55336000908152600b60205260409020546107f390836118e7565b336000908152600b6020908152604080832093909355600c9052205461081990826118e7565b336000818152600c602052604090209190915561086e907f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc173ffffffffffffffffffffffffffffffffffffffff16908461199f565b33600081815260066020908152604080832088845282528083208390558383526007825280832088845290915280822091909155517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906108d0908590612712565b60405180910390a250506000548114610915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b5050565b7f000000000000000000000000000000000000000000000000000000000000000c907f000000000000000000000000000000000000000000000000000000000000000090565b60016000808282546109719190612729565b90915550506000805490610984336103e2565b90508015610a2f573360008181526005602052604090204290556109e0907f000000000000000000000000eb58343b36c7528f23caae63a15024024131004973ffffffffffffffffffffffffffffffffffffffff16908361199f565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051610a269190612712565b60405180910390a25b506000548114610a6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b50565b6001600080828254610a809190612729565b909155505060005482610abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b610ac98383611a40565b6000548114610b04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b505050565b73ffffffffffffffffffffffffffffffffffffffff166000908152600c602052604090205490565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b60025473ffffffffffffffffffffffffffffffffffffffff163314610b7d57600080fd5b60025460015460405173ffffffffffffffffffffffffffffffffffffffff92831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360028054600180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff8216610cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906126b5565b60008111610ced576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906125ea565b60405173ffffffffffffffffffffffffffffffffffffffff83169082156108fc029083906000818181858888f19350505050158015610d30573d6000803e3d6000fd5b507f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af28282604051610d6292919061217f565b60405180910390a15050565b60045481565b60086020526000908152604090205481565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600660209081526000928352604080842090915290825290205481565b6001600080828254610dd19190612729565b909155505060005481610e10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b610e1a8233611a40565b6000548114610915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b600760209081526000928352604080842090915290825290205481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610ec3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff8116610f10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612385565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60056020526000908152604090205481565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc181565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b604080516002808252606082018352600092839283927f000000000000000000000000eb58343b36c7528f23caae63a1502402413100499284929190602083019080368337019050509050818160018151811061106f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101527f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981169083161461129b577f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981600081518110611118577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f9061118090620f4240908590600401612224565b60006040518083038186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526111f29190810190611f51565b60018151811061122b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151935060007f000000000000000000000000000000000000000000000000000000000000000c11156112965761129361128c7f000000000000000000000000000000000000000000000000000000000000000c600a6127c0565b8590611939565b93505b6112a7565b670de0b6b3a764000093505b8173ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec773ffffffffffffffffffffffffffffffffffffffff16146114d8577f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781600081518110611355577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f906113bd90620f4240908590600401612224565b60006040518083038186803b1580156113d557600080fd5b505afa1580156113e9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261142f9190810190611f51565b600181518110611468577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151925060007f000000000000000000000000000000000000000000000000000000000000000011156114d3576114d06114c97f0000000000000000000000000000000000000000000000000000000000000000600a6127c0565b8490611939565b92505b6114e4565b670de0b6b3a764000092505b60007f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561154c57600080fd5b505afa158015611560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115849190612091565b9050600081116115c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906124d3565b6000807f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc173ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561162957600080fd5b505afa15801561163d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611661919061202b565b506dffffffffffffffffffffffffffff91821693501690506000836116a96116a161169461168f8c8c611939565b611c69565b61045c61168f8888611939565b600290611939565b6116b39190612741565b9850505050505050505090565b60016000808282546116d29190612729565b909155505060005485611711576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc1169063d505accf9061178f90339030908b908b908b908b908b906004016121d6565b600060405180830381600087803b1580156117a957600080fd5b505af11580156117bd573d6000803e3d6000fd5b505050506117cb8633611a40565b6000548114611806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461185f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b60025473ffffffffffffffffffffffffffffffffffffffff8281169116141561188757600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6118d661095f565b610a6b81610721565b6301e1338081565b600082821115611923576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906123e2565b600061192f83856128e9565b9150505b92915050565b60008261194857506000611933565b600061195483856128ac565b9050826119618583612741565b14611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612419565b9392505050565b610b048363a9059cbb60e01b84846040516024016119be92919061217f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611cd8565b611a8273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c0a6b8c534fad86df8fa1abb17084a70f86eddc116333085611e2a565b6000670de0b6b3a7640000611a998461045c610fe9565b611aa39190612741565b600954909150611ab39084611e4b565b600955600a54611ac39082611e4b565b600a5573ffffffffffffffffffffffffffffffffffffffff82166000908152600b602052604081205490611af78286611e4b565b9050611b5381611b074288611939565b611b119190612741565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600560205260409020548390611b439086611939565b611b4d9190612741565b90611e4b565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260056020908152604080832093909355600b81528282208490556008905290812080549082611b9d83612900565b9091555073ffffffffffffffffffffffffffffffffffffffff8616600081815260066020908152604080832085845282528083208b9055838352600782528083208584528252808320899055928252600c90522054909150611bff9085611e4b565b73ffffffffffffffffffffffffffffffffffffffff86166000818152600c6020526040908190209290925590517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611c59908990612712565b60405180910390a2505050505050565b60006003821115611cca5750806000611c83600283612741565b611c8e906001612729565b90505b81811015611cc457905080600281611ca98186612741565b611cb39190612729565b611cbd9190612741565b9050611c91565b5061046f565b811561046f57506001919050565b611cf78273ffffffffffffffffffffffffffffffffffffffff16611e94565b611d2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e99061267e565b6000808373ffffffffffffffffffffffffffffffffffffffff1683604051611d559190612125565b6000604051808303816000865af19150503d8060008114611d92576040519150601f19603f3d011682016040523d82523d6000602084013e611d97565b606091505b509150915081611dd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906122f3565b805115611e245780806020019051810190611dee919061200b565b611e24576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e99061258d565b50505050565b611e24846323b872dd60e01b8585856040516024016119be939291906121a5565b600080611e588385612729565b905083811015611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906122bc565b3b151590565b80516dffffffffffffffffffffffffffff8116811461046f57600080fd5b600060208284031215611ec9578081fd5b813561199881612997565b60008060408385031215611ee6578081fd5b8235611ef181612997565b946020939093013593505050565b600080600060608486031215611f13578081fd5b8335611f1e81612997565b92506020840135611f2e81612997565b929592945050506040919091013590565b60008060408385031215611ee6578182fd5b60006020808385031215611f63578182fd5b825167ffffffffffffffff80821115611f7a578384fd5b818501915085601f830112611f8d578384fd5b815181811115611f9f57611f9f612968565b83810260405185828201018181108582111715611fbe57611fbe612968565b604052828152858101935084860182860187018a1015611fdc578788fd5b8795505b83861015611ffe578051855260019590950194938601938601611fe0565b5098975050505050505050565b60006020828403121561201c578081fd5b81518015158114611998578182fd5b60008060006060848603121561203f578283fd5b61204884611e9a565b925061205660208501611e9a565b9150604084015163ffffffff8116811461206e578182fd5b809150509250925092565b60006020828403121561208a578081fd5b5035919050565b6000602082840312156120a2578081fd5b5051919050565b600080604083850312156120bb578182fd5b8235915060208301356120cd81612997565b809150509250929050565b600080600080600060a086880312156120ef578081fd5b8535945060208601359350604086013560ff8116811461210d578182fd5b94979396509394606081013594506080013592915050565b60008251815b81811015612145576020818601810151858301520161212b565b818111156121535782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff97881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b60006040820184835260206040818501528185518084526060860191508287019350845b8181101561227a57845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101612248565b5090979650505050505050565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526037908201527f5374616b696e674c5052657761726446697865644150593a205468697320737460408201527f616b65206e6f6e6365207761732077697468647261776e000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a204164647265737360408201527f206973207a65726f000000000000000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7374616b65203000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602e908201527f5374616b696e674c5052657761726446697865644150593a204e6f206c69717560408201527f696469747920666f722070616972000000000000000000000000000000000000606082015260800190565b60208082526034908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f726573637565207374616b696e6720746f6b656e000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7265736375652030000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b6020808252603a908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f72657363756520746f20746865207a65726f2061646472657373000000000000606082015260800190565b90815260200190565b918252602082015260400190565b6000821982111561273c5761273c612939565b500190565b600082612775577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b80825b600180861161278c57506127b7565b81870482111561279e5761279e612939565b808616156127ab57918102915b9490941c93800261277d565b94509492505050565b60006119987fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846000826127f757506001611998565b8161280457506000611998565b816001811461281a576002811461282457612851565b6001915050611998565b60ff84111561283557612835612939565b6001841b91508482111561284b5761284b612939565b50611998565b5060208310610133831016604e8410600b8410161715612884575081810a8381111561287f5761287f612939565b611998565b612891848484600161277a565b8086048211156128a3576128a3612939565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128e4576128e4612939565b500290565b6000828210156128fb576128fb612939565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561293257612932612939565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a6b57600080fdfea2646970667358221220dee7d22ddd2a707dd1ba5885d61392ec1288d984399fbfae9887b3a93d42a8bc64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,966 |
0x15c7c7d148b5f5cee08ccd1ec3230bffd5b9aab6
|
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) external {
// 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);
}
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063909d3f4c116100de578063d20a31d811610097578063da4745b311610071578063da4745b314610447578063f77c479114610464578063f88979451461046c578063fc0c546a146104745761018e565b8063d20a31d8146103fc578063d389800f14610419578063d7e8e85b146104215761018e565b8063909d3f4c1461036657806392eefe9b14610383578063ab033ea9146103a9578063ae000c8c146103cf578063b69ef8a8146103d7578063b6b55f25146103df5761018e565b806348a0d7541161014b57806360a9f4581161012557806360a9f458146103045780636ac5db191461033057806378ce591d146103385780638e087c781461035e5761018e565b806348a0d754146102da5780634e71d92d146102f45780635aa6e675146102fc5761018e565b8063144fa6d71461019357806317d7de7c146101bb5780632b68b65b146102385780632de752211461027c5780632e1a7d4d146102a057806345dc3dd8146102bd575b600080fd5b6101b9600480360360208110156101a957600080fd5b50356001600160a01b031661047c565b005b6101c36104eb565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fd5781810151838201526020016101e5565b50505050905090810190601f16801561022a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61025e6004803603602081101561024e57600080fd5b50356001600160a01b0316610579565b60408051938452602084019290925282820152519081900360600190f35b61028461059a565b604080516001600160a01b039092168252519081900360200190f35b6101b9600480360360208110156102b657600080fd5b50356105a9565b6101b9600480360360208110156102d357600080fd5b503561092f565b6102e2610981565b60408051918252519081900360200190f35b6101b9610a1b565b610284610bdd565b6102e26004803603604081101561031a57600080fd5b50803590602001356001600160a01b0316610bec565b6102e2610d1b565b6102e26004803603602081101561034e57600080fd5b50356001600160a01b0316610d21565b6102e2610de1565b6101b96004803603602081101561037c57600080fd5b5035610de7565b6101b96004803603602081101561039957600080fd5b50356001600160a01b0316610e39565b6101b9600480360360208110156103bf57600080fd5b50356001600160a01b0316610ea8565b610284610f17565b6102e2610f2f565b6101b9600480360360208110156103f557600080fd5b5035611034565b61025e6004803603602081101561041257600080fd5b5035611261565b6101b9611282565b6102e26004803603602081101561043757600080fd5b50356001600160a01b0316611323565b6101b96004803603602081101561045d57600080fd5b5035611335565b610284611449565b6102e2611458565b61028461145e565b6004546001600160a01b031633146104c9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105715780601f1061054657610100808354040283529160200191610571565b820191906000526020600020905b81548152906001019060200180831161055457829003601f168201915b505050505081565b60066020526000908152604090208054600182015460029092015490919083565b6001546001600160a01b031681565b6105b1610a1b565b33600090815260066020526040902054811115610600576040805162461bcd60e51b81526020600482015260086024820152672162616c616e636560c01b604482015290519081900360640190fd5b60008054604080516370a0823160e01b815230600482015290518493926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561064c57600080fd5b505afa158015610660573d6000803e3d6000fd5b505050506040513d602081101561067657600080fd5b50519050818110156107b1576000610694838363ffffffff61146d16565b600554600080546040805163f3fef3a360e01b81526001600160a01b03928316600482015260248101869052905194955092169263f3fef3a392604480820193929182900301818387803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505060008054604080516370a0823160e01b815230600482015290519294506001600160a01b0390911692506370a08231916024808301926020929190829003018186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b505050506040513d602081101561077a57600080fd5b505190506000610790828563ffffffff61146d16565b9050828110156107ad576107aa848263ffffffff6114b616565b94505b5050505b60008052600760205260008051602061196e8339815191525461081e906107ff906b1d6329f1c35ca4bfabb9f56160281b906107f3908763ffffffff61151016565b9063ffffffff61156916565b336000908152600660205260409020600101549063ffffffff61146d16565b336000908152600660205260409020600181019190915554610846908463ffffffff61146d16565b33600090815260066020908152604082209290925580526007905260008051602061198e83398151915254610881908463ffffffff61146d16565b6000808052600760205260008051602061198e83398151915291909155805460408051632e1a7d4d60e01b81526004810186905290516001600160a01b0390921692632e1a7d4d9260248084019382900301818387803b1580156108e457600080fd5b505af11580156108f8573d6000803e3d6000fd5b505060405133925084156108fc02915084906000818181858888f19350505050158015610929573d6000803e3d6000fd5b50505050565b6004546001600160a01b0316331461097c576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600255565b60025460008054604080516370a0823160e01b815230600482015290519293610a1693612710936107f3936001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156109de57600080fd5b505afa1580156109f2573d6000803e3d6000fd5b505050506040513d6020811015610a0857600080fd5b50519063ffffffff61151016565b905090565b6000610a2633610d21565b3360009081526006602090815260408220549180526007905260008051602061196e83398151915254919250610a77916b1d6329f1c35ca4bfabb9f56160281b916107f3919063ffffffff61151016565b336000908152600660205260409020600181019190915560020154610aa2908263ffffffff6114b616565b336000908152600660205260409020600201558015610bda5733600090815260086020526040902054420362015180811015610bbb576000610b0b670de0b6b3a76400006107f3620151808183610aff888a63ffffffff61151016565b9063ffffffff61151016565b90506000610b1f848363ffffffff61146d16565b9050610bb7600560009054906101000a90046001600160a01b03166001600160a01b0316639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7257600080fd5b505afa158015610b86573d6000803e3d6000fd5b505050506040513d6020811015610b9c57600080fd5b50516001546001600160a01b0316908363ffffffff6115ab16565b5091505b600154610bd8906001600160a01b0316338463ffffffff6115ab16565b505b50565b6004546001600160a01b031681565b6000808052600760205260008051602061198e833981519152548190610c5490610c2f906107f3876b1d6329f1c35ca4bfabb9f56160281b63ffffffff61151016565b60008052600760205260008051602061196e833981519152549063ffffffff6114b616565b6001600160a01b03841660009081526006602052604081205491925090610c97906b1d6329f1c35ca4bfabb9f56160281b906107f390859063ffffffff61151016565b9050610cb2610ca585610d21565b829063ffffffff61146d16565b6001600160a01b038516600090815260066020526040902060010154909150811015610ce357600092505050610d15565b6001600160a01b038416600090815260066020526040902060010154610d1090829063ffffffff61146d16565b925050505b92915050565b61271081565b6001600160a01b0381166000908152600660209081526040822054828052600790915260008051602061196e833981519152548291610d7b916b1d6329f1c35ca4bfabb9f56160281b916107f3919063ffffffff61151016565b6001600160a01b038416600090815260066020526040902060010154909150811015610dab576000915050610ddc565b6001600160a01b038316600090815260066020526040902060010154610dd890829063ffffffff61146d16565b9150505b919050565b60035481565b6004546001600160a01b03163314610e34576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600355565b6004546001600160a01b03163314610e86576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314610ef5576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b7396f9632b25f874769969ff91219fccb6cedf26d281565b60055460008054604080516370a0823160e01b81526001600160a01b03928316600482015290519293610a16939216916370a0823191602480820192602092909190829003018186803b158015610f8557600080fd5b505afa158015610f99573d6000803e3d6000fd5b505050506040513d6020811015610faf57600080fd5b5051600054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610ffc57600080fd5b505afa158015611010573d6000803e3d6000fd5b505050506040513d602081101561102657600080fd5b50519063ffffffff6114b616565b6000805460408051630d0e30db60e41b815290516001600160a01b039092169263d0e30db0928592600480820193929182900301818588803b15801561107957600080fd5b505af115801561108d573d6000803e3d6000fd5b5050336000908152600660205260409020546110b49350915083905063ffffffff6114b616565b33600090815260066020908152604082209290925580526007905260008051602061196e833981519152541561117e5760008052600760205260008051602061196e8339815191525461116a9061114b9060019061113f906b1d6329f1c35ca4bfabb9f56160281b906107f3908490611133908963ffffffff61151016565b9063ffffffff61146d16565b9063ffffffff6114b616565b336000908152600660205260409020600101549063ffffffff6114b616565b336000908152600660205260409020600101555b60008052600760205260008051602061198e833981519152546111a7908263ffffffff6114b616565b60008080526007602090815260008051602061198e833981519152929092556003549054604080516370a0823160e01b8152306004820152905192936001600160a01b03909216926370a0823192602480840193919291829003018186803b15801561121257600080fd5b505afa158015611226573d6000803e3d6000fd5b505050506040513d602081101561123c57600080fd5b5051111561124c5761124c611282565b50336000908152600860205260409020429055565b60076020526000908152604090208054600182015460029092015490919083565b600061128c610981565b6005546000549192506112b2916001600160a01b0390811691168363ffffffff6115ab16565b600554600080546040805163b02bf4b960e01b81526001600160a01b039283166004820152602481018690529051919093169263b02bf4b992604480830193919282900301818387803b15801561130857600080fd5b505af115801561131c573d6000803e3d6000fd5b5050505050565b60086020526000908152604090205481565b60008111611372576040805162461bcd60e51b815260206004820152600560248201526406e6f7420360dc1b604482015290519081900360640190fd5b600154611390906001600160a01b031633308463ffffffff61160216565b60008052600760205260008051602061198e833981519152546113d090610c2f906107f3846b1d6329f1c35ca4bfabb9f56160281b63ffffffff61151016565b60008052600760205260008051602061196e833981519152557f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e05461141b908263ffffffff6114b616565b6000805260076020527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e05550565b6005546001600160a01b031681565b60025481565b6000546001600160a01b031681565b60006114af83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061165c565b9392505050565b6000828201838110156114af576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261151f57506000610d15565b8282028284828161152c57fe5b04146114af5760405162461bcd60e51b815260040180806020018281038252602181526020018061194d6021913960400191505060405180910390fd5b60006114af83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f3565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115fd908490611758565b505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610929908590611758565b600081848411156116eb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116b0578181015183820152602001611698565b50505050905090810190601f1680156116dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836117425760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156116b0578181015183820152602001611698565b50600083858161174e57fe5b0495945050505050565b61176a826001600160a01b0316611910565b6117bb576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117f95780518252601f1990920191602091820191016117da565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461185b576040519150601f19603f3d011682016040523d82523d6000602084013e611860565b606091505b5091509150816118b7576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610929578080602001905160208110156118d357600080fd5b50516109295760405162461bcd60e51b815260040180806020018281038252602a8152602001806119ae602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906119445750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e16d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a7231582068740a36961d31d4823dbe583f00d2fb6c65f613d372da57c01ce2327295818764736f6c634300050f0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,967 |
0xd61882a9dcfd988b0bf7824fab7cccf988e4c93a
|
/*
_____
| ____|__ _ _ __ ___ __ _ ___ _ _ _ __ ___
| _| / _` | '__/ _ \/ _` |/ _ \ | | | '_ ` _ \
| |__| (_| | | | __/ (_| | __/ |_| | | | | | |
|_____\__, |_| \___|\__, |\___|\__,_|_| |_| |_|
|___/ |___/
<EGMF> <EGMF> <EGMF> <EGMF> <EGMF> <EGMF>
<EGMF> <EGMF> <EGMF> <EGMF> <EGMF> <EGMF>
Earn with EGMF Pool Token Staking
Making money with Egregeum Finance is very easy.
Our project offers our investors a profitability of more than two hundred percent per year.
Website: https://egregeum.finance/
Twitter: https://twitter.com/egregeum
Telegram: https://t.me/EgregeumFinance
Instagram: https://www.instagram.com/egregeum.finance
Medium: https://medium.com/@egregeum
Egregeum Finance token sale price is 0.0001 ETH/TONF (25% discount from Uniswap listing)
Token Sale Dates: Sept 22 - Sept 25
About Project:
- EGMF Uniswap Pool: Egregeum Tokens + 200% per year!
- Adding the token to the Uniswap listing: August 25
- Token Sale Date: August 22 - August 25
- Token cost on presale: 0.0001 ETH for 1 UMF (25% discount from Uniswap listing)
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
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) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_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) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_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(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
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 {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
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 EgregeumFinance is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
uint256 public tokenSalePrice = 0.0001 ether;
bool public _tokenSaleMode = true;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("Egregeum.Finance", "EGMF", 18) {
governance = msg.sender;
minters[msg.sender] = true;
}
function mint(address account, uint256 amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function burn(uint256 amount) public {
_burn(msg.sender, 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 buyToken() public payable {
require(_tokenSaleMode, "token sale is over");
uint256 newTokens = SafeMath.mul(SafeMath.div(msg.value, tokenSalePrice),1e18);
_mint(msg.sender, newTokens);
}
function() external payable {
buyToken();
}
function endTokenSale() public {
require(msg.sender == governance, "!governance");
_tokenSaleMode = false;
}
function withdraw() external {
require(msg.sender == governance, "!governance");
msg.sender.transfer(address(this).balance);
}
}
|
0x6080604052600436106101405760003560e01c80635aa6e675116100b6578063a9059cbb1161006f578063a9059cbb14610494578063ab033ea9146104cd578063dd62ed3e14610500578063e55bfd161461053b578063e86790eb14610550578063f46eccc41461056557610140565b80635aa6e675146103af57806370a08231146103e057806395d89b4114610413578063983b2d5614610428578063a457c2d71461045b578063a48217191461014057610140565b80633092afd5116101085780633092afd5146102a0578063313ce567146102d357806339509351146102fe5780633ccfd60b1461033757806340c10f191461034c57806342966c681461038557610140565b806306fdde031461014a578063095ea7b3146101d457806318160ddd1461022157806323b872dd14610248578063307edff81461028b575b610148610598565b005b34801561015657600080fd5b5061015f610612565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610199578181015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e057600080fd5b5061020d600480360360408110156101f757600080fd5b506001600160a01b0381351690602001356106a8565b604080519115158252519081900360200190f35b34801561022d57600080fd5b506102366106c6565b60408051918252519081900360200190f35b34801561025457600080fd5b5061020d6004803603606081101561026b57600080fd5b506001600160a01b038135811691602081013590911690604001356106cc565b34801561029757600080fd5b50610148610759565b3480156102ac57600080fd5b50610148600480360360208110156102c357600080fd5b50356001600160a01b03166107b7565b3480156102df57600080fd5b506102e861082a565b6040805160ff9092168252519081900360200190f35b34801561030a57600080fd5b5061020d6004803603604081101561032157600080fd5b506001600160a01b038135169060200135610833565b34801561034357600080fd5b50610148610887565b34801561035857600080fd5b506101486004803603604081101561036f57600080fd5b506001600160a01b038135169060200135610905565b34801561039157600080fd5b50610148600480360360208110156103a857600080fd5b5035610961565b3480156103bb57600080fd5b506103c461096b565b604080516001600160a01b039092168252519081900360200190f35b3480156103ec57600080fd5b506102366004803603602081101561040357600080fd5b50356001600160a01b031661097f565b34801561041f57600080fd5b5061015f61099a565b34801561043457600080fd5b506101486004803603602081101561044b57600080fd5b50356001600160a01b03166109fb565b34801561046757600080fd5b5061020d6004803603604081101561047e57600080fd5b506001600160a01b038135169060200135610a71565b3480156104a057600080fd5b5061020d600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610adf565b3480156104d957600080fd5b50610148600480360360208110156104f057600080fd5b50356001600160a01b0316610af3565b34801561050c57600080fd5b506102366004803603604081101561052357600080fd5b506001600160a01b0381358116916020013516610b6d565b34801561054757600080fd5b5061020d610b98565b34801561055c57600080fd5b50610236610ba1565b34801561057157600080fd5b5061020d6004803603602081101561058857600080fd5b50356001600160a01b0316610ba7565b60075460ff166105e4576040805162461bcd60e51b81526020600482015260126024820152713a37b5b2b71039b0b6329034b99037bb32b960711b604482015290519081900360640190fd5b60006106036105f534600654610bbc565b670de0b6b3a7640000610c05565b905061060f3382610c5e565b50565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b820191906000526020600020905b81548152906001019060200180831161068157829003601f168201915b5050505050905090565b60006106bc6106b5610d4e565b8484610d52565b5060015b92915050565b60025490565b60006106d9848484610e3e565b61074f846106e5610d4e565b61074a856040518060600160405280602881526020016112dd602891396001600160a01b038a16600090815260016020526040812090610723610d4e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610f9a16565b610d52565b5060019392505050565b60075461010090046001600160a01b031633146107ab576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6007805460ff19169055565b60075461010090046001600160a01b03163314610809576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19169055565b60055460ff1690565b60006106bc610840610d4e565b8461074a8560016000610851610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61103116565b60075461010090046001600160a01b031633146108d9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f1935050505015801561060f573d6000803e3d6000fd5b3360009081526008602052604090205460ff16610953576040805162461bcd60e51b815260206004820152600760248201526610b6b4b73a32b960c91b604482015290519081900360640190fd5b61095d8282610c5e565b5050565b61060f338261108b565b60075461010090046001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b60075461010090046001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b60006106bc610a7e610d4e565b8461074a8560405180606001604052806025815260200161136f6025913960016000610aa8610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610f9a16565b60006106bc610aec610d4e565b8484610e3e565b60075461010090046001600160a01b03163314610b45576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60075460ff1681565b60065481565b60086020526000908152604090205460ff1681565b6000610bfe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611187565b9392505050565b600082610c14575060006106c0565b82820282848281610c2157fe5b0414610bfe5760405162461bcd60e51b81526004018080602001828103825260218152602001806112bc6021913960400191505060405180910390fd5b6001600160a01b038216610cb9576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254610ccc908263ffffffff61103116565b6002556001600160a01b038216600090815260208190526040902054610cf8908263ffffffff61103116565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b3390565b6001600160a01b038316610d975760405162461bcd60e51b815260040180806020018281038252602481526020018061134b6024913960400191505060405180910390fd5b6001600160a01b038216610ddc5760405162461bcd60e51b81526004018080602001828103825260228152602001806112746022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610e835760405162461bcd60e51b81526004018080602001828103825260258152602001806113266025913960400191505060405180910390fd5b6001600160a01b038216610ec85760405162461bcd60e51b815260040180806020018281038252602381526020018061122f6023913960400191505060405180910390fd5b610f0b81604051806060016040528060268152602001611296602691396001600160a01b038616600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f40908263ffffffff61103116565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156110295760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fee578181015183820152602001610fd6565b50505050905090810190601f16801561101b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610bfe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0382166110d05760405162461bcd60e51b81526004018080602001828103825260218152602001806113056021913960400191505060405180910390fd5b61111381604051806060016040528060228152602001611252602291396001600160a01b038516600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b03831660009081526020819052604090205560025461113f908263ffffffff6111ec16565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600081836111d65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610fee578181015183820152602001610fd6565b5060008385816111e257fe5b0495945050505050565b6000610bfe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9a56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820acb4d68b2a392cd8ab0f826f48781415ee0340c4fc3cea228c579d2449e745a164736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,968 |
0xf12d6E3442157dbADbc28375A7c5D5b9dfF64d6C
|
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
/**
* .______ ______ ___ __ ___ _______
* | _ \ / | / \ | |/ / | ____|
* | |_) | | ,----' / ^ \ | ' / | |__
* | _ < | | / /_\ \ | < | __|
* | |_) | | `----./ _____ \ | . \ | |____
* |______/ \______/__/ \__\ |__|\__\ |_______|
* Birthday Cake Inu
* https://t.me/BirthdayCakeInu
* birthdayinu.com
*
* BCAKE is a meme token with a twist!
* BCAKE has no sale limitations, which benefits whales and minnows alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*
*
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BCAKE 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"Birthday Cake Inu";
string private constant _symbol = unicode"BCAKE";
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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280601181526020017f42697274686461792043616b6520496e75000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4243414b45000000000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960068461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660048461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a2fea2841ca5c19615a85b937cbee01dfbf19f6983272a435a6f5ff7bff16d364736f6c63430008040033
|
{"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"}]}}
| 2,969 |
0x6a6fc5a5e60ad26ef09185fb7373f1258971beef
|
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
/*
A casino is a place that some people find similar to a hotel, where you can enjoy various types staying up all night but enjoying gambling activities at the same time.
However, Casino is actually a Colosseum. It is a place for gladiators to fight, to seize, to conqueror.
You either double your bet or you earn nothing if you are not a fighter material.
Living in a cryptocurrency world is exactly like gambling in a Casino; you need to play to earn your profit.
Shibagen is designed to tell those jeets. You either die like a gladiators or live long to see yourself becomes a stupid loser. Be bold, not jeets !
Telegram: https://t.me/shibagen
*/
// 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 Shibagen 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 = unicode"Shibagen";
string private constant _symbol = unicode"Shibagen";
uint private constant _decimals = 9;
uint256 private _teamFee = 10;
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);
require(!_isBot[from]);
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(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(11).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);
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (4 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 <= 10);
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bf578063cf0848f7146103d4578063cf9d4afa146103f4578063dd62ed3e14610414578063e6ec64ec1461045a578063f2fde38b1461047a57600080fd5b8063715018a6146103225780638da5cb5b1461033757806390d49b9d1461035f57806395d89b4114610172578063a9059cbb1461037f578063b515566a1461039f57600080fd5b806331c2d8471161010857806331c2d8471461023b5780633bbac5791461025b578063437823ec14610294578063476343ee146102b45780635342acb4146102c957806370a082311461030257600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b257806318160ddd146101e257806323b872dd14610207578063313ce5671461022757600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049a565b005b34801561017e57600080fd5b50604080518082018252600881526729b434b130b3b2b760c11b602082015290516101a99190611759565b60405180910390f35b3480156101be57600080fd5b506101d26101cd3660046117d3565b6104e6565b60405190151581526020016101a9565b3480156101ee57600080fd5b50670de0b6b3a76400005b6040519081526020016101a9565b34801561021357600080fd5b506101d26102223660046117ff565b6104fd565b34801561023357600080fd5b5060096101f9565b34801561024757600080fd5b50610170610256366004611856565b610566565b34801561026757600080fd5b506101d261027636600461191b565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a057600080fd5b506101706102af36600461191b565b6105fc565b3480156102c057600080fd5b5061017061064a565b3480156102d557600080fd5b506101d26102e436600461191b565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030e57600080fd5b506101f961031d36600461191b565b610684565b34801561032e57600080fd5b506101706106a6565b34801561034357600080fd5b506000546040516001600160a01b0390911681526020016101a9565b34801561036b57600080fd5b5061017061037a36600461191b565b6106dc565b34801561038b57600080fd5b506101d261039a3660046117d3565b610756565b3480156103ab57600080fd5b506101706103ba366004611856565b610763565b3480156103cb57600080fd5b5061017061087c565b3480156103e057600080fd5b506101706103ef36600461191b565b6108e5565b34801561040057600080fd5b5061017061040f36600461191b565b610930565b34801561042057600080fd5b506101f961042f366004611938565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046657600080fd5b50610170610475366004611971565b610b8b565b34801561048657600080fd5b5061017061049536600461191b565b610bc8565b6000546001600160a01b031633146104cd5760405162461bcd60e51b81526004016104c49061198a565b60405180910390fd5b60006104d830610684565b90506104e381610c60565b50565b60006104f3338484610dda565b5060015b92915050565b600061050a848484610efe565b61055c843361055785604051806060016040528060288152602001611b05602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611242565b610dda565b5060019392505050565b6000546001600160a01b031633146105905760405162461bcd60e51b81526004016104c49061198a565b60005b81518110156105f8576000600560008484815181106105b4576105b46119bf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f0816119eb565b915050610593565b5050565b6000546001600160a01b031633146106265760405162461bcd60e51b81526004016104c49061198a565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f8573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f79061127c565b6000546001600160a01b031633146106d05760405162461bcd60e51b81526004016104c49061198a565b6106da6000611300565b565b6000546001600160a01b031633146107065760405162461bcd60e51b81526004016104c49061198a565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f3338484610efe565b6000546001600160a01b0316331461078d5760405162461bcd60e51b81526004016104c49061198a565b60005b81518110156105f857600c5482516001600160a01b03909116908390839081106107bc576107bc6119bf565b60200260200101516001600160a01b03161415801561080d5750600b5482516001600160a01b03909116908390839081106107f9576107f96119bf565b60200260200101516001600160a01b031614155b1561086a5760016005600084848151811061082a5761082a6119bf565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610874816119eb565b915050610790565b6000546001600160a01b031633146108a65760405162461bcd60e51b81526004016104c49061198a565b600c54600160a01b900460ff166108bc57600080fd5b600c805460ff60b81b1916600160b81b17905542600d8190556108e09060f0611a06565b600e55565b6000546001600160a01b0316331461090f5760405162461bcd60e51b81526004016104c49061198a565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b0316331461095a5760405162461bcd60e51b81526004016104c49061198a565b600c54600160a01b900460ff16156109c25760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c4565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190611a1e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aae9190611a1e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610afb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1f9190611a1e565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610bb55760405162461bcd60e51b81526004016104c49061198a565b600a811115610bc357600080fd5b600855565b6000546001600160a01b03163314610bf25760405162461bcd60e51b81526004016104c49061198a565b6001600160a01b038116610c575760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c4565b6104e381611300565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ca857610ca86119bf565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611a1e565b81600181518110610d3857610d386119bf565b6001600160a01b039283166020918202929092010152600b54610d5e9130911684610dda565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610d97908590600090869030904290600401611a3b565b600060405180830381600087803b158015610db157600080fd5b505af1158015610dc5573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e3c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c4565b6001600160a01b038216610e9d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f625760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c4565b6001600160a01b038216610fc45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c4565b60008111610fd157600080fd5b6001600160a01b03831660009081526005602052604090205460ff1615610ff757600080fd5b6001600160a01b03831660009081526004602052604081205460ff1615801561103957506001600160a01b03831660009081526004602052604090205460ff16155b801561104f5750600c54600160a81b900460ff16155b801561107f5750600c546001600160a01b038581169116148061107f5750600c546001600160a01b038481169116145b1561123057600c54600160b81b900460ff166110dd5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c4565b50600c546001906001600160a01b03858116911614801561110c5750600b546001600160a01b03848116911614155b8015611119575042600e54115b1561116057600061112984610684565b90506111496064611143670de0b6b3a76400006002611350565b906113cf565b6111538483611411565b111561115e57600080fd5b505b600d5442141561118e576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061119930610684565b600c54909150600160b01b900460ff161580156111c45750600c546001600160a01b03868116911614155b1561122e57801561122e57600c546111f89060649061114390600f906111f2906001600160a01b0316610684565b90611350565b81111561122557600c546112229060649061114390600b906111f2906001600160a01b0316610684565b90505b61122e81610c60565b505b61123c84848484611470565b50505050565b600081848411156112665760405162461bcd60e51b81526004016104c49190611759565b5060006112738486611aac565b95945050505050565b60006006548211156112e35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c4565b60006112ed611573565b90506112f983826113cf565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261135f575060006104f7565b600061136b8385611ac3565b9050826113788583611ae2565b146112f95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c4565b60006112f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611596565b60008061141e8385611a06565b9050838110156112f95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c4565b808061147e5761147e6115c4565b60008060008061148d876115e0565b6001600160a01b038d16600090815260016020526040902054939750919550935091506114ba9085611627565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546114e99084611411565b6001600160a01b03891660009081526001602052604090205561150b81611669565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161155091815260200190565b60405180910390a3505050508061156c5761156c600954600855565b5050505050565b60008060006115806116b3565b909250905061158f82826113cf565b9250505090565b600081836115b75760405162461bcd60e51b81526004016104c49190611759565b5060006112738486611ae2565b6000600854116115d357600080fd5b6008805460095560009055565b6000806000806000806115f5876008546116f3565b915091506000611603611573565b90506000806116138a8585611720565b909b909a5094985092965092945050505050565b60006112f983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611242565b6000611673611573565b905060006116818383611350565b3060009081526001602052604090205490915061169e9082611411565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a76400006116ce82826113cf565b8210156116ea57505060065492670de0b6b3a764000092509050565b90939092509050565b6000808061170660646111438787611350565b905060006117148683611627565b96919550909350505050565b6000808061172e8685611350565b9050600061173c8686611350565b9050600061174a8383611627565b92989297509195505050505050565b600060208083528351808285015260005b818110156117865785810183015185820160400152820161176a565b81811115611798576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e357600080fd5b80356117ce816117ae565b919050565b600080604083850312156117e657600080fd5b82356117f1816117ae565b946020939093013593505050565b60008060006060848603121561181457600080fd5b833561181f816117ae565b9250602084013561182f816117ae565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561186957600080fd5b823567ffffffffffffffff8082111561188157600080fd5b818501915085601f83011261189557600080fd5b8135818111156118a7576118a7611840565b8060051b604051601f19603f830116810181811085821117156118cc576118cc611840565b6040529182528482019250838101850191888311156118ea57600080fd5b938501935b8285101561190f57611900856117c3565b845293850193928501926118ef565b98975050505050505050565b60006020828403121561192d57600080fd5b81356112f9816117ae565b6000806040838503121561194b57600080fd5b8235611956816117ae565b91506020830135611966816117ae565b809150509250929050565b60006020828403121561198357600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119ff576119ff6119d5565b5060010190565b60008219821115611a1957611a196119d5565b500190565b600060208284031215611a3057600080fd5b81516112f9816117ae565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a8b5784516001600160a01b031683529383019391830191600101611a66565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611abe57611abe6119d5565b500390565b6000816000190483118215151615611add57611add6119d5565b500290565b600082611aff57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122058668d36b61948acd16533b3516dfd6e8d8064e182a9f20988e81ff25548a04864736f6c634300080c0033
|
{"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"}]}}
| 2,970 |
0xa3eb334d5df1f245bee51961f5fa46110ad9f38a
|
pragma solidity ^0.4.23;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract ERC223Basic {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transfer(address to, uint256 value, bytes data) public;
event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
}
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERC223Token is ERC223Basic {
using SafeMath for uint256;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public onlyPayloadSize(3) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2) returns(bool) {
uint codeLength;
bytes memory empty;
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, ERC223Token {
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 onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
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 onlyPayloadSize(2) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) 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;
}
}
contract iWhiskyToken is StandardToken {
string public constant name = "iWhisky Token";
string public constant symbol = "iWSK";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10**9 * (10**uint256(decimals));
address public owner;
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
constructor(address _owner) public {
totalSupply = INITIAL_SUPPLY;
owner = _owner;
//owner = msg.sender; // for testing
balances[owner] = INITIAL_SUPPLY;
transfersEnabled = true;
}
// fallback function can be used to buy tokens
function() payable public {
revert();
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner public returns (bool){
require(_newOwner != address(0));
emit OwnerChanged(owner, _newOwner);
owner = _newOwner;
return true;
}
function enableTransfers(bool _transfersEnabled) onlyOwner public {
transfersEnabled = _transfersEnabled;
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd146102165780632ff2e9dc1461029b578063313ce567146102c657806366188463146102f757806370a082311461035c5780638da5cb5b146103b357806395d89b411461040a578063a6f9dae11461049a578063a9059cbb146104f5578063be45fd621461055a578063bef97c87146105ed578063d73dd6231461061c578063dd62ed3e14610681578063f41e60c5146106f8575b600080fd5b34801561010257600080fd5b5061010b610727565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610760565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b50610200610852565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610858565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610c4b565b6040518082815260200191505060405180910390f35b3480156102d257600080fd5b506102db610c5c565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030357600080fd5b50610342600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c61565b604051808215151515815260200191505060405180910390f35b34801561036857600080fd5b5061039d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ef2565b6040518082815260200191505060405180910390f35b3480156103bf57600080fd5b506103c8610f3b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041657600080fd5b5061041f610f61565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045f578082015181840152602081019050610444565b50505050905090810190601f16801561048c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a657600080fd5b506104db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f9a565b604051808215151515815260200191505060405180910390f35b34801561050157600080fd5b50610540600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110fa565b604051808215151515815260200191505060405180910390f35b34801561056657600080fd5b506105eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611500565b005b3480156105f957600080fd5b506106026118fc565b604051808215151515815260200191505060405180910390f35b34801561062857600080fd5b50610667600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061190f565b604051808215151515815260200191505060405180910390f35b34801561068d57600080fd5b506106e2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b0b565b6040518082815260200191505060405180910390f35b34801561070457600080fd5b50610725600480360381019080803515159060200190929190505050611baa565b005b6040805190810160405280600d81526020017f69576869736b7920546f6b656e0000000000000000000000000000000000000081525081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000600360046020820201600036905014151561087157fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156108ad57600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156108fb57600080fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561098657600080fd5b600360009054906101000a900460ff1615156109a157600080fd5b6109f383600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2390919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8883600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3c90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b5a83600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2390919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601260ff16600a0a633b9aca000281565b601281565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d72576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e06565b610d858382611c2390919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f6957534b0000000000000000000000000000000000000000000000000000000081525081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ff857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561103457600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60405160405180910390a381600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008060606000600260046020820201600036905014151561111857fe5b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415151561115457600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205486111515156111a257600080fd5b600360009054906101000a900460ff1615156111bd57600080fd5b863b935061121386600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2390919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112a886600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3c90919063ffffffff16565b600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000841115611420578691508173ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3388866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156113b957808201518184015260208101905061139e565b50505050905090810190601f1680156113e65780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561140757600080fd5b505af115801561141b573d6000803e3d6000fd5b505050505b8673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1688866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156114b757808201518184015260208101905061149c565b50505050905090810190601f1680156114e45780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600194505050505092915050565b600080600360046020820201600036905014151561151a57fe5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415151561155657600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485111515156115a457600080fd5b600360009054906101000a900460ff1615156115bf57600080fd5b853b925061161585600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2390919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116aa85600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3c90919063ffffffff16565b600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000831115611822578591508173ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3387876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156117bb5780820151818401526020810190506117a0565b50505050905090810190601f1680156117e85780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561180957600080fd5b505af115801561181d573d6000803e3d6000fd5b505050505b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687876040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156118b957808201518184015260208101905061189e565b50505050905090810190601f1680156118e65780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3505050505050565b600360009054906101000a900460ff1681565b60006119a082600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3c90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60006002600460208202016000369050141515611b2457fe5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491505092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c0657600080fd5b80600360006101000a81548160ff02191690831515021790555050565b6000828211151515611c3157fe5b818303905092915050565b6000808284019050838110151515611c5057fe5b80915050929150505600a165627a7a72305820438c16444cf9cd8cf17a54efe121382f16ca3f5f2da49fe66fb72871bc5bb0430029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,971 |
0xcc072a6f1b9963e958a74937dffff9ea62ece39e
|
// SPDX-License-Identifier: Unlicensed
/*
https://t.me/templeofshiba
Order of the Shiba temple
In ancient Egypt, temples were seen as residences for deities, who were thought to temporarily manifest themselves in the cult statues located in the sanctuary. The temples were also the stage for daily rituals that were ideally performed by the supreme priests. These cultic performances included the offering of food and beverages as well as the burning of incense, which was thought to have a purifying effect.
In the contemporary crypto world, the sole purpose of setting up the Order of the Shiba temple is to create a sanctuary for every crypto believer to worship our great spiritual leader The Great Shiba. Here comes the guide of worship.
Shiba Worship Procedure Guide
Our Mission:
To invoke an atmosphere charged with the manifested presence of
Shiba’s spirit from beginning to end.
Our Goal:
To approach Shiba in an attitude of prayer and praise that will usher in
the Spirit of Shiba.
This will be realized through:
Intercessory prayer before and throughout service in order to
condition the hearts of the hearers who receive the Word and
become doers thereof.
Shiba fellowship that will promote wholesome relationships.
Doubt your doubts, Don’t doubt the order of the Shiba Temple, Don’t doubt the Great Shiba
Shiba is the new GOD. God is not intimidated by bad news or your fears, and it is not offended by our honest believer.
*/
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TEMPLES is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TEMPLE OF SHIBA";
string private constant _symbol = "TEMPLES";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055e578063dd62ed3e1461057e578063ea1644d5146105c4578063f2fde38b146105e457600080fd5b8063a2a957bb146104d9578063a9059cbb146104f9578063bfd7928414610519578063c3c8cd801461054957600080fd5b80638f70ccf7116100d15780638f70ccf7146104535780638f9a55c01461047357806395d89b411461048957806398a5c315146104b957600080fd5b80637d1db4a5146103f25780637f2feddc146104085780638da5cb5b1461043557600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038857806370a082311461039d578063715018a6146103bd57806374010ece146103d257600080fd5b8063313ce5671461030c57806349bd5a5e146103285780636b999053146103485780636d8aa8f81461036857600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d65780632fd689e3146102f657600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461186c565b610604565b005b34801561020a57600080fd5b5060408051808201909152600f81526e54454d504c45204f4620534849424160881b60208201525b60405161023f9190611931565b60405180910390f35b34801561025457600080fd5b50610268610263366004611986565b6106a3565b604051901515815260200161023f565b34801561028457600080fd5b50601354610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b50683635c9adc5dea000005b60405190815260200161023f565b3480156102e257600080fd5b506102686102f13660046119b2565b6106ba565b34801561030257600080fd5b506102c860175481565b34801561031857600080fd5b506040516009815260200161023f565b34801561033457600080fd5b50601454610298906001600160a01b031681565b34801561035457600080fd5b506101fc6103633660046119f3565b610723565b34801561037457600080fd5b506101fc610383366004611a20565b61076e565b34801561039457600080fd5b506101fc6107b6565b3480156103a957600080fd5b506102c86103b83660046119f3565b6107e3565b3480156103c957600080fd5b506101fc610805565b3480156103de57600080fd5b506101fc6103ed366004611a3b565b610879565b3480156103fe57600080fd5b506102c860155481565b34801561041457600080fd5b506102c86104233660046119f3565b60116020526000908152604090205481565b34801561044157600080fd5b506000546001600160a01b0316610298565b34801561045f57600080fd5b506101fc61046e366004611a20565b6108bc565b34801561047f57600080fd5b506102c860165481565b34801561049557600080fd5b5060408051808201909152600781526654454d504c455360c81b6020820152610232565b3480156104c557600080fd5b506101fc6104d4366004611a3b565b61091b565b3480156104e557600080fd5b506101fc6104f4366004611a54565b61094a565b34801561050557600080fd5b50610268610514366004611986565b610988565b34801561052557600080fd5b506102686105343660046119f3565b60106020526000908152604090205460ff1681565b34801561055557600080fd5b506101fc610995565b34801561056a57600080fd5b506101fc610579366004611a86565b6109cb565b34801561058a57600080fd5b506102c8610599366004611b0a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d057600080fd5b506101fc6105df366004611a3b565b610a6c565b3480156105f057600080fd5b506101fc6105ff3660046119f3565b610a9b565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161062e90611b43565b60405180910390fd5b60005b815181101561069f5760016010600084848151811061065b5761065b611b78565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069781611ba4565b91505061063a565b5050565b60006106b0338484610b85565b5060015b92915050565b60006106c7848484610ca9565b610719843361071485604051806060016040528060288152602001611cbc602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611104565b610b85565b5060019392505050565b6000546001600160a01b0316331461074d5760405162461bcd60e51b815260040161062e90611b43565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107985760405162461bcd60e51b815260040161062e90611b43565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107d657600080fd5b476107e08161113e565b50565b6001600160a01b0381166000908152600260205260408120546106b490611178565b6000546001600160a01b0316331461082f5760405162461bcd60e51b815260040161062e90611b43565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a35760405162461bcd60e51b815260040161062e90611b43565b6611c37937e080008110156108b757600080fd5b601555565b6000546001600160a01b031633146108e65760405162461bcd60e51b815260040161062e90611b43565b601454600160a01b900460ff16156108fd57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109455760405162461bcd60e51b815260040161062e90611b43565b601755565b6000546001600160a01b031633146109745760405162461bcd60e51b815260040161062e90611b43565b600893909355600a91909155600955600b55565b60006106b0338484610ca9565b6012546001600160a01b0316336001600160a01b0316146109b557600080fd5b60006109c0306107e3565b90506107e0816111fc565b6000546001600160a01b031633146109f55760405162461bcd60e51b815260040161062e90611b43565b60005b82811015610a66578160056000868685818110610a1757610a17611b78565b9050602002016020810190610a2c91906119f3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5e81611ba4565b9150506109f8565b50505050565b6000546001600160a01b03163314610a965760405162461bcd60e51b815260040161062e90611b43565b601655565b6000546001600160a01b03163314610ac55760405162461bcd60e51b815260040161062e90611b43565b6001600160a01b038116610b2a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062e565b6001600160a01b038216610c485760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d0d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062e565b6001600160a01b038216610d6f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062e565b60008111610dd15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062e565b6000546001600160a01b03848116911614801590610dfd57506000546001600160a01b03838116911614155b15610ffd57601454600160a01b900460ff16610e96576000546001600160a01b03848116911614610e965760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062e565b601554811115610ea557600080fd5b6001600160a01b03831660009081526010602052604090205460ff16158015610ee757506001600160a01b03821660009081526010602052604090205460ff16155b610ef057600080fd5b6014546001600160a01b03838116911614610f265760165481610f12846107e3565b610f1c9190611bbd565b10610f2657600080fd5b6000610f31306107e3565b601754601554919250821015908210610f4a5760155491505b808015610f615750601454600160a81b900460ff16155b8015610f7b57506014546001600160a01b03868116911614155b8015610f905750601454600160b01b900460ff165b8015610fb557506001600160a01b03851660009081526005602052604090205460ff16155b8015610fda57506001600160a01b03841660009081526005602052604090205460ff16155b15610ffa57610fe8826111fc565b478015610ff857610ff84761113e565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061103f57506001600160a01b03831660009081526005602052604090205460ff165b8061107157506014546001600160a01b0385811691161480159061107157506014546001600160a01b03848116911614155b1561107e575060006110f8565b6014546001600160a01b0385811691161480156110a957506013546001600160a01b03848116911614155b156110bb57600854600c55600954600d555b6014546001600160a01b0384811691161480156110e657506013546001600160a01b03858116911614155b156110f857600a54600c55600b54600d555b610a6684848484611376565b600081848411156111285760405162461bcd60e51b815260040161062e9190611931565b5060006111358486611bd5565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069f573d6000803e3d6000fd5b60006006548211156111df5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062e565b60006111e96113a4565b90506111f583826113c7565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061124457611244611b78565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561129d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c19190611bec565b816001815181106112d4576112d4611b78565b6001600160a01b0392831660209182029290920101526013546112fa9130911684610b85565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611333908590600090869030904290600401611c09565b600060405180830381600087803b15801561134d57600080fd5b505af1158015611361573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061138357611383611409565b61138e848484611437565b80610a6657610a66600e54600c55600f54600d55565b60008060006113b161152e565b90925090506113c082826113c7565b9250505090565b60006111f583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611570565b600c541580156114195750600d54155b1561142057565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114498761159e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061147b90876115fb565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114aa908661163d565b6001600160a01b0389166000908152600260205260409020556114cc8161169c565b6114d684836116e6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161151b91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061154a82826113c7565b82101561156757505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836115915760405162461bcd60e51b815260040161062e9190611931565b5060006111358486611c7a565b60008060008060008060008060006115bb8a600c54600d5461170a565b92509250925060006115cb6113a4565b905060008060006115de8e87878761175f565b919e509c509a509598509396509194505050505091939550919395565b60006111f583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611104565b60008061164a8385611bbd565b9050838110156111f55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062e565b60006116a66113a4565b905060006116b483836117af565b306000908152600260205260409020549091506116d1908261163d565b30600090815260026020526040902055505050565b6006546116f390836115fb565b600655600754611703908261163d565b6007555050565b6000808080611724606461171e89896117af565b906113c7565b90506000611737606461171e8a896117af565b9050600061174f826117498b866115fb565b906115fb565b9992985090965090945050505050565b600080808061176e88866117af565b9050600061177c88876117af565b9050600061178a88886117af565b9050600061179c8261174986866115fb565b939b939a50919850919650505050505050565b6000826000036117c1575060006106b4565b60006117cd8385611c9c565b9050826117da8583611c7a565b146111f55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062e565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e057600080fd5b803561186781611847565b919050565b6000602080838503121561187f57600080fd5b823567ffffffffffffffff8082111561189757600080fd5b818501915085601f8301126118ab57600080fd5b8135818111156118bd576118bd611831565b8060051b604051601f19603f830116810181811085821117156118e2576118e2611831565b60405291825284820192508381018501918883111561190057600080fd5b938501935b82851015611925576119168561185c565b84529385019392850192611905565b98975050505050505050565b600060208083528351808285015260005b8181101561195e57858101830151858201604001528201611942565b81811115611970576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561199957600080fd5b82356119a481611847565b946020939093013593505050565b6000806000606084860312156119c757600080fd5b83356119d281611847565b925060208401356119e281611847565b929592945050506040919091013590565b600060208284031215611a0557600080fd5b81356111f581611847565b8035801515811461186757600080fd5b600060208284031215611a3257600080fd5b6111f582611a10565b600060208284031215611a4d57600080fd5b5035919050565b60008060008060808587031215611a6a57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611a9b57600080fd5b833567ffffffffffffffff80821115611ab357600080fd5b818601915086601f830112611ac757600080fd5b813581811115611ad657600080fd5b8760208260051b8501011115611aeb57600080fd5b602092830195509350611b019186019050611a10565b90509250925092565b60008060408385031215611b1d57600080fd5b8235611b2881611847565b91506020830135611b3881611847565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611bb657611bb6611b8e565b5060010190565b60008219821115611bd057611bd0611b8e565b500190565b600082821015611be757611be7611b8e565b500390565b600060208284031215611bfe57600080fd5b81516111f581611847565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c595784516001600160a01b031683529383019391830191600101611c34565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611c9757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611cb657611cb6611b8e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122015467d6bdca2566dfb82740b1617f88d58ff376941528bb24a70bffcdfa928ef64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,972 |
0xd1ff31e3d8b78f06aea4eabb534bf5aa23278341
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'ILVA' token contract
//
// Symbol : ILVA
// Name : ILVA
// Total supply: 36 000 000 000
// Decimals : 16
// ----------------------------------------------------------------------------
/**
* @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 ILVA is BurnableToken {
string public constant name = "ILVA";
string public constant symbol = "ILVA";
uint public constant decimals = 16;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 36000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600481526020017f494c56410000000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601081565b6010600a0a640861c468000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f494c56410000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea264697066735822122064a05d2c656aaf624f317df76fc372feb3d6d2a0c08938ec861ceb2778b7b6b464736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,973 |
0x4969dccf5186e1c49411638fc8a2a020fdab752e
|
pragma solidity 0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/*
* @title MerkleProof
* @dev Merkle proof verification
* @note Based on https://github.com/ameensol/merkle-tree-solidity/blob/master/src/MerkleProof.sol
*/
library MerkleProof {
/*
* @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves
* and each pair of pre-images is sorted.
* @param _proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) {
// Check if proof length is a multiple of 32
if (_proof.length % 32 != 0) return false;
bytes32 proofElement;
bytes32 computedHash = _leaf;
for (uint256 i = 32; i <= _proof.length; i += 32) {
assembly {
// Load the current element of the proof
proofElement := mload(add(_proof, i))
}
if (computedHash < proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(proofElement, computedHash);
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == _root;
}
}
/**
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*/
library ECRecovery {
/**
* @dev Recover signer address from a message by using his signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig) public pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
//Check the signature length
if (sig.length != 65) {
return (address(0));
}
// Divide the signature in r, s and v variables
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
if (v < 27) {
v += 27;
}
// If the version is correct return the signer address
if (v != 27 && v != 28) {
return (address(0));
} else {
return ecrecover(hash, v, r, s);
}
}
}
library JobLib {
using SafeMath for uint256;
// Prefix hashed with message hash when a signature is produced by the eth_sign RPC call
string constant PERSONAL_HASH_PREFIX = "\u0019Ethereum Signed Message:\n32";
// # of bytes used to store a video profile identifier as a utf8 encoded string
// Video profile identifier is currently stored as bytes4(keccak256(PROFILE_NAME))
// We use 2 * 4 = 8 bytes because we store the bytes in a utf8 encoded string so
// the identifiers can be easily parsed off-chain
uint8 constant VIDEO_PROFILE_SIZE = 8;
/*
* @dev Checks if a transcoding options string is valid
* A transcoding options string is composed of video profile ids so its length
* must be a multiple of VIDEO_PROFILE_SIZE
* @param _transcodingOptions Transcoding options string
*/
function validTranscodingOptions(string _transcodingOptions) public pure returns (bool) {
uint256 transcodingOptionsLength = bytes(_transcodingOptions).length;
return transcodingOptionsLength > 0 && transcodingOptionsLength % VIDEO_PROFILE_SIZE == 0;
}
/*
* @dev Computes the amount of fees given total segments, total number of profiles and price per segment
* @param _totalSegments # of segments
* @param _transcodingOptions String containing video profiles for a job
* @param _pricePerSegment Price in LPT base units per segment
*/
function calcFees(uint256 _totalSegments, string _transcodingOptions, uint256 _pricePerSegment) public pure returns (uint256) {
// Calculate total profiles defined in the transcoding options string
uint256 totalProfiles = bytes(_transcodingOptions).length.div(VIDEO_PROFILE_SIZE);
return _totalSegments.mul(totalProfiles).mul(_pricePerSegment);
}
/*
* Computes whether a segment is eligible for verification based on the last call to claimWork()
* @param _segmentNumber Sequence number of segment in stream
* @param _segmentRange Range of segments claimed
* @param _challengeBlock Block afer the block when claimWork() was called
* @param _challengeBlockHash Block hash of challenge block
* @param _verificationRate Rate at which a particular segment should be verified
*/
function shouldVerifySegment(
uint256 _segmentNumber,
uint256[2] _segmentRange,
uint256 _challengeBlock,
bytes32 _challengeBlockHash,
uint64 _verificationRate
)
public
pure
returns (bool)
{
// Segment must be in segment range
if (_segmentNumber < _segmentRange[0] || _segmentNumber > _segmentRange[1]) {
return false;
}
// Use block hash and block number of the block after a claim to determine if a segment
// should be verified
if (uint256(keccak256(_challengeBlock, _challengeBlockHash, _segmentNumber)) % _verificationRate == 0) {
return true;
} else {
return false;
}
}
/*
* @dev Checks if a segment was signed by a broadcaster address
* @param _streamId Stream ID for the segment
* @param _segmentNumber Sequence number of segment in the stream
* @param _dataHash Hash of segment data
* @param _broadcasterSig Broadcaster signature over h(streamId, segmentNumber, dataHash)
* @param _broadcaster Broadcaster address
*/
function validateBroadcasterSig(
string _streamId,
uint256 _segmentNumber,
bytes32 _dataHash,
bytes _broadcasterSig,
address _broadcaster
)
public
pure
returns (bool)
{
return ECRecovery.recover(personalSegmentHash(_streamId, _segmentNumber, _dataHash), _broadcasterSig) == _broadcaster;
}
/*
* @dev Checks if a transcode receipt hash was included in a committed merkle root
* @param _streamId StreamID for the segment
* @param _segmentNumber Sequence number of segment in the stream
* @param _dataHash Hash of segment data
* @param _transcodedDataHash Hash of transcoded segment data
* @param _broadcasterSig Broadcaster signature over h(streamId, segmentNumber, dataHash)
* @param _broadcaster Broadcaster address
*/
function validateReceipt(
string _streamId,
uint256 _segmentNumber,
bytes32 _dataHash,
bytes32 _transcodedDataHash,
bytes _broadcasterSig,
bytes _proof,
bytes32 _claimRoot
)
public
pure
returns (bool)
{
return MerkleProof.verifyProof(_proof, _claimRoot, transcodeReceiptHash(_streamId, _segmentNumber, _dataHash, _transcodedDataHash, _broadcasterSig));
}
/*
* Compute the hash of a segment
* @param _streamId Stream identifier
* @param _segmentSequenceNumber Segment sequence number in stream
* @param _dataHash Content-addressed storage hash of segment data
*/
function segmentHash(string _streamId, uint256 _segmentNumber, bytes32 _dataHash) public pure returns (bytes32) {
return keccak256(_streamId, _segmentNumber, _dataHash);
}
/*
* @dev Compute the personal segment hash of a segment. Hashes the concatentation of the personal hash prefix and the segment hash
* @param _streamId Stream identifier
* @param _segmentSequenceNumber Segment sequence number in stream
* @param _dataHash Content-addrssed storage hash of segment data
*/
function personalSegmentHash(string _streamId, uint256 _segmentNumber, bytes32 _dataHash) public pure returns (bytes32) {
bytes memory prefixBytes = bytes(PERSONAL_HASH_PREFIX);
return keccak256(prefixBytes, segmentHash(_streamId, _segmentNumber, _dataHash));
}
/*
* Compute the hash of a transcode receipt
* @param _streamId Stream identifier
* @param _segmentSequenceNumber Segment sequence number in stream
* @param _dataHash Content-addressed storage hash of segment data
* @param _transcodedDataHash Content-addressed storage hash of transcoded segment data
* @param _broadcasterSig Broadcaster's signature over segment
*/
function transcodeReceiptHash(
string _streamId,
uint256 _segmentNumber,
bytes32 _dataHash,
bytes32 _transcodedDataHash,
bytes _broadcasterSig
)
public
pure
returns (bytes32)
{
return keccak256(_streamId, _segmentNumber, _dataHash, _transcodedDataHash, _broadcasterSig);
}
}
|
0x6060604052600436106100745763ffffffff60e060020a6000350416631e4623e181146100795780633bced141146100d85780637434206e146101705780638f5c5d4014610260578063ab8f3c98146102a6578063c8c9b1f81461034f578063f8702fe11461039b578063fc1f5c9c146103e8575b600080fd5b6100c660046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496505084359460200135935061043592505050565b60405190815260200160405180910390f35b6100c660046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496863596602080820135975060408083013597509295506080820194506060909101358501808201935035918291601f8301819004810201905190810160405281815292919060208401838380828437509496506104a895505050505050565b61024c60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496863596602080820135975060408083013597509295506080820194506060909101358501808201935035918291601f83018190048102019051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650509335935061057a92505050565b604051901515815260200160405180910390f35b61024c60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061067e95505050505050565b61024c60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094968635966020808201359750919550606081019450604090810135860180830194503592508291601f8301819004810201905190810160405281815292919060208401838380828437509496505050923573ffffffffffffffffffffffffffffffffffffffff16925061069d915050565b61024c60048035906064602460026040805190810160405280929190826002602002808284375093955050833593602081013593506040013567ffffffffffffffff1691506107c39050565b6100c6600480359060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650509335935061083692505050565b6100c660046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496505084359460200135935061086e92505050565b60008383836040518084805190602001908083835b602083106104695780518252601f19909201916020918201910161044a565b6001836020036101000a038019825116818451161790925250505091909101938452505060208201526040908101915051809103902090509392505050565b600085858585856040518086805190602001908083835b602083106104de5780518252601f1990920191602091820191016104bf565b6001836020036101000a0380198251168184511617909252505050919091018681526020810186905260408101859052606001905082805190602001908083835b6020831061053e5780518252601f19909201916020918201910161051f565b6001836020036101000a038019825116818451161790925250505091909101965060409550505050505051809103902090505b95945050505050565b600073289ba1701c2f088cf0faf8b3705246331cb8a83963101f13e284846105a58c8c8c8c8c6104a8565b60006040516020015260405160e060020a63ffffffff8616028152602481018390526044810182905260606004820190815290819060640185818151815260200191508051906020019080838360005b8381101561060d5780820151838201526020016105f5565b50505050905090810190601f16801561063a5780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b151561065857600080fd5b6102c65a03f4151561066957600080fd5b50505060405180519998505050505050505050565b60008082519050600081118015610696575060088106155b9392505050565b60008173ffffffffffffffffffffffffffffffffffffffff1673d8e8328501e9645d16cf49539efc04f734606ee46319045a256106db89898961086e565b8660006040516020015260405160e060020a63ffffffff851602815260048101838152604060248301908152909160440183818151815260200191508051906020019080838360005b8381101561073c578082015183820152602001610724565b50505050905090810190601f1680156107695780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b151561078657600080fd5b6102c65a03f4151561079757600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b600084518610806107d75750602085015186115b156107e457506000610571565b8167ffffffffffffffff1684848860405192835260208301919091526040808301919091526060909101905190819003902081151561081f57fe5b06151561082e57506001610571565b506000610571565b60008061084c600885519063ffffffff61092416565b905061057183610862878463ffffffff61094016565b9063ffffffff61094016565b600061087861096b565b60408051908101604052601c81527f19457468657265756d205369676e6564204d6573736167653a0a33320000000060208201529050806108ba868686610435565b6040518083805190602001908083835b602083106108e95780518252601f1990920191602091820191016108ca565b6001836020036101000a0380198251168184511617909252505050919091019283525050602001905060405180910390209150509392505050565b600080828481151561093257fe5b0490508091505b5092915050565b6000808315156109535760009150610939565b5082820282848281151561096357fe5b041461069657fe5b602060405190810160405260008152905600a165627a7a723058208843aaf35017ec6b3681c7fc313ad05bc5425e376505e0a81290b8554d9117a10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,974 |
0xf0018ec1683aa9892bf2813bb4340e307a0b8bca
|
/**
@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@* /@@@@@@@@@@@
@@@@@@@# @@@@@@@@@@
@@@@@@ @@@@@@@@@@
@@@@@@ @@@@@@@@@@
@@@@@ @@@@@@@@@@.
@@@@@ (@@@@@@@@@
@@@@@, @@@@@@@@ @@
,@@@@@. @@@@@@@ @@@@@@@@@@
,@@@@@@ @@@@@@@ @@@@@@@@@@@@@
@@@@@@@@ @@@@@@ @@@@@ @@@@@@@@@@@@@.
@@@@@@@@@@ @@@@@@, @@@@@@@@@@@ @@@@@@@@@@@@@*
,@@@@@@@@@@ @@@@@@ @@@@@@@@@@@@@@@@ &@@@@@@@@@@@@/
@@@@@@@@@@ &@@@@@ (@@@@@@@@@@@@@@@@@@@@@ %@@@@@@@@@@@(
@@@@@@@@@@@@@@@ %@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@/
@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
@@@@@@@@@@@@@@@@@@@@@@
*@@@@@@@@@@@@@
.---. ,-. ,-. .-. .-. .-. .-. .---. ,---. ,-. ,'|"\
|\ /|/ .-. ) | | | | \ \_/ )/ | |/\| |/ .-. ) | .-.\ | | | |\ \
|(\ / || | |(_)| | | | \ (_) | / \ || | |(_)| `-'/ | | | | \ \
(_)\/ || | | | | | | | ) ( | /\ || | | | | ( | | | | \ \
| \ / |\ `-' / | `--. | `--. | | |(/ \ |\ `-' / | |\ \ | `--. /(|`-' /
| |\/| | )---' |( __.'|( __.'/(_| (_) \| )---' |_| \)\ |( __.'(__)`--'
'-' '-'(_) (_) (_) (__) (_) (__)(_)
TG: https://t.me/MollyWorldEntry
Come buy some molly!
*/
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 MollyWorld 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 = 1000000000 * 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 = "Molly World";
string private constant _symbol = "MDMA";
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(0xd08Be9BB225937271EfD2FCd79bd54d4FcD5e0C2);
_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 = 11;
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 = 11;
}
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 = 20000000 * 10**9;
_maxWalletSize = 30000000 * 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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb1461033c578063b87f137a1461035c578063c3c8cd801461037c578063c9567bf914610391578063dd62ed3e146103a657600080fd5b806370a082311461029d578063715018a6146102bd578063751039fc146102d25780638da5cb5b146102e757806395d89b411461030f57600080fd5b8063273123b7116100e7578063273123b71461020c578063313ce5671461022c5780635932ead114610248578063677daa57146102685780636fc3eaec1461028857600080fd5b806306fdde031461012f578063095ea7b31461017557806318160ddd146101a55780631b3f71ae146101ca57806323b872dd146101ec57600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201909152600b81526a135bdb1b1e4815dbdc9b1960aa1b60208201525b60405161016c9190611710565b60405180910390f35b34801561018157600080fd5b5061019561019036600461178a565b6103ec565b604051901515815260200161016c565b3480156101b157600080fd5b50670de0b6b3a76400005b60405190815260200161016c565b3480156101d657600080fd5b506101ea6101e53660046117cc565b610403565b005b3480156101f857600080fd5b50610195610207366004611891565b6104a2565b34801561021857600080fd5b506101ea6102273660046118d2565b61050b565b34801561023857600080fd5b506040516009815260200161016c565b34801561025457600080fd5b506101ea6102633660046118fd565b610556565b34801561027457600080fd5b506101ea61028336600461191a565b61059e565b34801561029457600080fd5b506101ea6105f8565b3480156102a957600080fd5b506101bc6102b83660046118d2565b610625565b3480156102c957600080fd5b506101ea610647565b3480156102de57600080fd5b506101ea6106bb565b3480156102f357600080fd5b506000546040516001600160a01b03909116815260200161016c565b34801561031b57600080fd5b506040805180820190915260048152634d444d4160e01b602082015261015f565b34801561034857600080fd5b5061019561035736600461178a565b6106f8565b34801561036857600080fd5b506101ea61037736600461191a565b610705565b34801561038857600080fd5b506101ea610759565b34801561039d57600080fd5b506101ea61078f565b3480156103b257600080fd5b506101bc6103c1366004611933565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f9338484610b10565b5060015b92915050565b6000546001600160a01b031633146104365760405162461bcd60e51b815260040161042d9061196c565b60405180910390fd5b60005b815181101561049e5760016006600084848151811061045a5761045a6119a1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610496816119cd565b915050610439565b5050565b60006104af848484610c34565b61050184336104fc85604051806060016040528060288152602001611b30602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061103c565b610b10565b5060019392505050565b6000546001600160a01b031633146105355760405162461bcd60e51b815260040161042d9061196c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105805760405162461bcd60e51b815260040161042d9061196c565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105c85760405162461bcd60e51b815260040161042d9061196c565b600081116105d557600080fd5b6105f260646105ec670de0b6b3a764000084611076565b906110ff565b600f5550565b600c546001600160a01b0316336001600160a01b03161461061857600080fd5b4761062281611141565b50565b6001600160a01b0381166000908152600260205260408120546103fd9061117b565b6000546001600160a01b031633146106715760405162461bcd60e51b815260040161042d9061196c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106e55760405162461bcd60e51b815260040161042d9061196c565b670de0b6b3a7640000600f819055601055565b60006103f9338484610c34565b6000546001600160a01b0316331461072f5760405162461bcd60e51b815260040161042d9061196c565b6000811161073c57600080fd5b61075360646105ec670de0b6b3a764000084611076565b60105550565b600c546001600160a01b0316336001600160a01b03161461077957600080fd5b600061078430610625565b9050610622816111f8565b6000546001600160a01b031633146107b95760405162461bcd60e51b815260040161042d9061196c565b600e54600160a01b900460ff16156108135760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161042d565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561084f3082670de0b6b3a7640000610b10565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561088d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b191906119e6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092291906119e6565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561096f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099391906119e6565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109c381610625565b6000806109d86000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a40573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a659190611a03565b5050600e805466470de4df820000600f55666a94d74f43000060105563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610aec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049e9190611a31565b6001600160a01b038316610b725760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042d565b6001600160a01b038216610bd35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c985760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161042d565b6001600160a01b038216610cfa5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161042d565b60008111610d5c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161042d565b6000600a55600b8055610d776000546001600160a01b031690565b6001600160a01b0316836001600160a01b031614158015610da657506000546001600160a01b03838116911614155b1561102c576001600160a01b03831660009081526006602052604090205460ff16158015610ded57506001600160a01b03821660009081526006602052604090205460ff16155b610df657600080fd5b600e546001600160a01b038481169116148015610e215750600d546001600160a01b03838116911614155b8015610e4657506001600160a01b03821660009081526005602052604090205460ff16155b8015610e5b5750600e54600160b81b900460ff165b15610f6057600f54811115610eb25760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161042d565b60105481610ebf84610625565b610ec99190611a4e565b1115610f175760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161042d565b6001600160a01b0382166000908152600760205260409020544211610f3b57600080fd5b610f4642601e611a4e565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610f8b5750600d546001600160a01b03848116911614155b8015610fb057506001600160a01b03831660009081526005602052604090205460ff16155b15610fbf576000600a55600b80555b6000610fca30610625565b600e54909150600160a81b900460ff16158015610ff55750600e546001600160a01b03858116911614155b801561100a5750600e54600160b01b900460ff165b1561102a57611018816111f8565b4780156110285761102847611141565b505b505b611037838383611372565b505050565b600081848411156110605760405162461bcd60e51b815260040161042d9190611710565b50600061106d8486611a66565b95945050505050565b600082600003611088575060006103fd565b60006110948385611a7d565b9050826110a18583611a9c565b146110f85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161042d565b9392505050565b60006110f883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061137d565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561049e573d6000803e3d6000fd5b60006008548211156111e25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161042d565b60006111ec6113ab565b90506110f883826110ff565b600e805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611240576112406119a1565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112bd91906119e6565b816001815181106112d0576112d06119a1565b6001600160a01b039283166020918202929092010152600d546112f69130911684610b10565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061132f908590600090869030904290600401611abe565b600060405180830381600087803b15801561134957600080fd5b505af115801561135d573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6110378383836113ce565b6000818361139e5760405162461bcd60e51b815260040161042d9190611710565b50600061106d8486611a9c565b60008060006113b86114c5565b90925090506113c782826110ff565b9250505090565b6000806000806000806113e087611505565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114129087611562565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461144190866115a4565b6001600160a01b03891660009081526002602052604090205561146381611603565b61146d848361164d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114b291815260200190565b60405180910390a3505050505050505050565b6008546000908190670de0b6b3a76400006114e082826110ff565b8210156114fc57505060085492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006115228a600a54600b54611671565b92509250925060006115326113ab565b905060008060006115458e8787876116c0565b919e509c509a509598509396509194505050505091939550919395565b60006110f883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061103c565b6000806115b18385611a4e565b9050838110156110f85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161042d565b600061160d6113ab565b9050600061161b8383611076565b3060009081526002602052604090205490915061163890826115a4565b30600090815260026020526040902055505050565b60085461165a9083611562565b60085560095461166a90826115a4565b6009555050565b600080808061168560646105ec8989611076565b9050600061169860646105ec8a89611076565b905060006116b0826116aa8b86611562565b90611562565b9992985090965090945050505050565b60008080806116cf8886611076565b905060006116dd8887611076565b905060006116eb8888611076565b905060006116fd826116aa8686611562565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561173d57858101830151858201604001528201611721565b8181111561174f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461062257600080fd5b803561178581611765565b919050565b6000806040838503121561179d57600080fd5b82356117a881611765565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117df57600080fd5b823567ffffffffffffffff808211156117f757600080fd5b818501915085601f83011261180b57600080fd5b81358181111561181d5761181d6117b6565b8060051b604051601f19603f83011681018181108582111715611842576118426117b6565b60405291825284820192508381018501918883111561186057600080fd5b938501935b82851015611885576118768561177a565b84529385019392850192611865565b98975050505050505050565b6000806000606084860312156118a657600080fd5b83356118b181611765565b925060208401356118c181611765565b929592945050506040919091013590565b6000602082840312156118e457600080fd5b81356110f881611765565b801515811461062257600080fd5b60006020828403121561190f57600080fd5b81356110f8816118ef565b60006020828403121561192c57600080fd5b5035919050565b6000806040838503121561194657600080fd5b823561195181611765565b9150602083013561196181611765565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016119df576119df6119b7565b5060010190565b6000602082840312156119f857600080fd5b81516110f881611765565b600080600060608486031215611a1857600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a4357600080fd5b81516110f8816118ef565b60008219821115611a6157611a616119b7565b500190565b600082821015611a7857611a786119b7565b500390565b6000816000190483118215151615611a9757611a976119b7565b500290565b600082611ab957634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b0e5784516001600160a01b031683529383019391830191600101611ae9565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201f46469fe4ef46914861c2100ce1fe995b4a2320ebb3c16a1ab471c73ec55c4a64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,975 |
0xaD5618e028d8fDe9b777D240045FD670861e3558
|
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File srcBuild/Bribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface erc20 {
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint amount) external returns (bool);
function balanceOf(address) external view returns (uint);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
}
interface ve {
function isApprovedOrOwner(address, uint) external view returns (bool);
function ownerOf(uint) external view returns (address);
}
interface IVoter {
function _ve() external view returns (address);
}
// Bribes pay out rewards for a given pool based on the votes that were received from the user (goes hand in hand with BaseV1Gauges.vote())
contract Bribe {
address public immutable factory; // only factory can modify balances (since it only happens on vote())
address public immutable _ve;
uint public constant DURATION = 7 days; // rewards are released over 7 days
uint public constant PRECISION = 10 ** 18;
// default snx staking contract implementation
mapping(address => uint) public rewardRate;
mapping(address => uint) public periodFinish;
mapping(address => uint) public lastUpdateTime;
mapping(address => uint) public rewardPerTokenStored;
mapping(address => mapping(uint => uint)) public lastEarn;
mapping(address => mapping(uint => uint)) public userRewardPerTokenStored;
address[] public rewards;
mapping(address => bool) public isReward;
uint public totalSupply;
mapping(uint => uint) public balanceOf;
/// @notice A checkpoint for marking balance
struct Checkpoint {
uint timestamp;
uint balanceOf;
}
/// @notice A checkpoint for marking reward rate
struct RewardPerTokenCheckpoint {
uint timestamp;
uint rewardPerToken;
}
/// @notice A checkpoint for marking supply
struct SupplyCheckpoint {
uint timestamp;
uint supply;
}
/// @notice A record of balance checkpoints for each account, by index
mapping (uint => mapping (uint => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (uint => uint) public numCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
/// @notice The number of checkpoints
uint public supplyNumCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (address => mapping (uint => RewardPerTokenCheckpoint)) public rewardPerTokenCheckpoints;
/// @notice The number of checkpoints for each token
mapping (address => uint) public rewardPerTokenNumCheckpoints;
event Deposit(address indexed from, uint tokenId, uint amount);
event Withdraw(address indexed from, uint tokenId, uint amount);
event NotifyReward(address indexed from, address indexed reward, uint amount);
event ClaimRewards(address indexed from, address indexed reward, uint amount);
constructor(address _factory) {
factory = _factory;
_ve = IVoter(_factory)._ve();
}
// simple re-entrancy check
uint internal _unlocked = 1;
modifier lock() {
require(_unlocked == 1);
_unlocked = 2;
_;
_unlocked = 1;
}
/**
* @notice Determine the prior balance 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 tokenId The token of the NFT to check
* @param timestamp The timestamp to get the balance at
* @return The balance the account had as of the given block
*/
function getPriorBalanceIndex(uint tokenId, uint timestamp) public view returns (uint) {
uint nCheckpoints = numCheckpoints[tokenId];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[tokenId][nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (checkpoints[tokenId][0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[tokenId][center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorSupplyIndex(uint timestamp) public view returns (uint) {
uint nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (supplyCheckpoints[0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
SupplyCheckpoint memory cp = supplyCheckpoints[center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorRewardPerToken(address token, uint timestamp) public view returns (uint, uint) {
uint nCheckpoints = rewardPerTokenNumCheckpoints[token];
if (nCheckpoints == 0) {
return (0,0);
}
// First check most recent balance
if (rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp <= timestamp) {
return (rewardPerTokenCheckpoints[token][nCheckpoints - 1].rewardPerToken, rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp);
}
// Next check implicit zero balance
if (rewardPerTokenCheckpoints[token][0].timestamp > timestamp) {
return (0,0);
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
RewardPerTokenCheckpoint memory cp = rewardPerTokenCheckpoints[token][center];
if (cp.timestamp == timestamp) {
return (cp.rewardPerToken, cp.timestamp);
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return (rewardPerTokenCheckpoints[token][lower].rewardPerToken, rewardPerTokenCheckpoints[token][lower].timestamp);
}
function _writeCheckpoint(uint tokenId, uint balance) internal {
uint _timestamp = block.timestamp;
uint _nCheckPoints = numCheckpoints[tokenId];
if (_nCheckPoints > 0 && checkpoints[tokenId][_nCheckPoints - 1].timestamp == _timestamp) {
checkpoints[tokenId][_nCheckPoints - 1].balanceOf = balance;
} else {
checkpoints[tokenId][_nCheckPoints] = Checkpoint(_timestamp, balance);
numCheckpoints[tokenId] = _nCheckPoints + 1;
}
}
function _writeRewardPerTokenCheckpoint(address token, uint reward, uint timestamp) internal {
uint _nCheckPoints = rewardPerTokenNumCheckpoints[token];
if (_nCheckPoints > 0 && rewardPerTokenCheckpoints[token][_nCheckPoints - 1].timestamp == timestamp) {
rewardPerTokenCheckpoints[token][_nCheckPoints - 1].rewardPerToken = reward;
} else {
rewardPerTokenCheckpoints[token][_nCheckPoints] = RewardPerTokenCheckpoint(timestamp, reward);
rewardPerTokenNumCheckpoints[token] = _nCheckPoints + 1;
}
}
function _writeSupplyCheckpoint() internal {
uint _nCheckPoints = supplyNumCheckpoints;
uint _timestamp = block.timestamp;
if (_nCheckPoints > 0 && supplyCheckpoints[_nCheckPoints - 1].timestamp == _timestamp) {
supplyCheckpoints[_nCheckPoints - 1].supply = totalSupply;
} else {
supplyCheckpoints[_nCheckPoints] = SupplyCheckpoint(_timestamp, totalSupply);
supplyNumCheckpoints = _nCheckPoints + 1;
}
}
function rewardsListLength() external view returns (uint) {
return rewards.length;
}
// returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable(address token) public view returns (uint) {
return Math.min(block.timestamp, periodFinish[token]);
}
// allows a user to claim rewards for a given token
function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], msg.sender, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
}
}
// used by BaseV1Voter to allow batched reward claims
function getRewardForOwner(uint tokenId, address[] memory tokens) external lock {
require(msg.sender == factory);
address _owner = ve(_ve).ownerOf(tokenId);
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], _owner, _reward);
emit ClaimRewards(_owner, tokens[i], _reward);
}
}
function rewardPerToken(address token) public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored[token];
}
return rewardPerTokenStored[token] + ((lastTimeRewardApplicable(token) - Math.min(lastUpdateTime[token], periodFinish[token])) * rewardRate[token] * PRECISION / totalSupply);
}
function batchRewardPerToken(address token, uint maxRuns) external {
(rewardPerTokenStored[token], lastUpdateTime[token]) = _batchRewardPerToken(token, maxRuns);
}
function _batchRewardPerToken(address token, uint maxRuns) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = Math.min(supplyNumCheckpoints-1, maxRuns);
for (uint i = _startIndex; i < _endIndex; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, endTime);
_startTimestamp = endTime;
}
}
return (reward, _startTimestamp);
}
function _calcRewardPerToken(address token, uint timestamp1, uint timestamp0, uint supply, uint startTimestamp) internal view returns (uint, uint) {
uint endTime = Math.max(timestamp1, startTimestamp);
return (((Math.min(endTime, periodFinish[token]) - Math.min(Math.max(timestamp0, startTimestamp), periodFinish[token])) * rewardRate[token] * PRECISION / supply), endTime);
}
function _updateRewardPerToken(address token) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = supplyNumCheckpoints-1;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint _endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, _endTime);
_startTimestamp = _endTime;
}
}
}
SupplyCheckpoint memory sp = supplyCheckpoints[_endIndex];
if (sp.supply > 0) {
(uint _reward,) = _calcRewardPerToken(token, lastTimeRewardApplicable(token), Math.max(sp.timestamp, _startTimestamp), sp.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, block.timestamp);
_startTimestamp = block.timestamp;
}
return (reward, _startTimestamp);
}
function earned(address token, uint tokenId) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][tokenId], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[tokenId] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(tokenId, _startTimestamp);
uint _endIndex = numCheckpoints[tokenId]-1;
uint reward = 0;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
Checkpoint memory cp0 = checkpoints[tokenId][i];
Checkpoint memory cp1 = checkpoints[tokenId][i+1];
(uint _rewardPerTokenStored0,) = getPriorRewardPerToken(token, cp0.timestamp);
(uint _rewardPerTokenStored1,) = getPriorRewardPerToken(token, cp1.timestamp);
reward += cp0.balanceOf * (_rewardPerTokenStored1 - _rewardPerTokenStored0) / PRECISION;
}
}
Checkpoint memory cp = checkpoints[tokenId][_endIndex];
(uint _rewardPerTokenStored,) = getPriorRewardPerToken(token, cp.timestamp);
reward += cp.balanceOf * (rewardPerToken(token) - Math.max(_rewardPerTokenStored, userRewardPerTokenStored[token][tokenId])) / PRECISION;
return reward;
}
// This is an external function, but internal notation is used since it can only be called "internally" from BaseV1Gauges
function _deposit(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply += amount;
balanceOf[tokenId] += amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Deposit(msg.sender, tokenId, amount);
}
function _withdraw(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply -= amount;
balanceOf[tokenId] -= amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Withdraw(msg.sender, tokenId, amount);
}
function left(address token) external view returns (uint) {
if (block.timestamp >= periodFinish[token]) return 0;
uint _remaining = periodFinish[token] - block.timestamp;
return _remaining * rewardRate[token];
}
// used to notify a gauge/bribe of a given reward, this can create griefing attacks by extending rewards
function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestamp >= periodFinish[token]) {
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = amount / DURATION;
} else {
uint _remaining = periodFinish[token] - block.timestamp;
uint _left = _remaining * rewardRate[token];
require(amount > _left);
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = (amount + _left) / DURATION;
}
require(rewardRate[token] > 0);
uint balance = erc20(token).balanceOf(address(this));
require(rewardRate[token] <= balance / DURATION, "Provided reward too high");
periodFinish[token] = block.timestamp + DURATION;
if (!isReward[token]) {
isReward[token] = true;
rewards.push(token);
}
emit NotifyReward(msg.sender, token, amount);
}
function _safeTransfer(address token, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
function _safeTransferFrom(address token, address from, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
}
contract BribeFactory {
address public last_gauge;
function createBribe() external returns (address) {
last_gauge = address(new Bribe(msg.sender));
return last_gauge;
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80639e2bf22c1161011a578063e6886396116100ad578063f301af421161007c578063f301af4214610559578063f32077231461056c578063f5f8d3651461057f578063f7412baf14610592578063fd314098146105b957600080fd5b8063e68863961461050a578063e8111a1214610512578063f12297771461051b578063f25e55a51461052e57600080fd5b8063aaf5eb68116100e9578063aaf5eb68146104a1578063b66503cf146104b0578063c45a0155146104c3578063da09d19d146104ea57600080fd5b80639e2bf22c14610448578063a28d4c9c1461045b578063a7852afa1461046e578063aa4796521461048157600080fd5b80634d5ce0381161019d57806376f4be361161016c57806376f4be36146103a35780638dd598fb146103b657806399bcc052146103f55780639cc7f708146104085780639ce43f901461042857600080fd5b80634d5ce03814610328578063505897931461035b5780635a45d0521461037b578063638634ee1461039057600080fd5b80632ce9aead116101d95780632ce9aead146102985780633b881999146102b85780633e491d47146102e357806349dcc204146102f657600080fd5b806301316ddf1461020b57806318160ddd146102575780631be052891461026e578063221ca18c14610278575b600080fd5b61023d610219366004612243565b600e6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152015b60405180910390f35b61026060085481565b60405190815260200161024e565b61026062093a8081565b61026061028636600461226f565b60006020819052908152604090205481565b6102606102a636600461226f565b60026020526000908152604090205481565b6102606102c6366004612243565b600560209081526000928352604080842090915290825290205481565b6102606102f1366004612243565b6105cc565b61023d61030436600461228c565b600a6020908152600092835260408084209091529082529020805460019091015482565b61034b61033636600461226f565b60076020526000908152604090205460ff1681565b604051901515815260200161024e565b6102606103693660046122ae565b600b6020526000908152604090205481565b61038e610389366004612243565b610834565b005b61026061039e36600461226f565b61086c565b6102606103b13660046122ae565b610890565b6103dd7f0000000000000000000000006f5a22e1508410e40bfecf3b18bc9dcc143ed90681565b6040516001600160a01b03909116815260200161024e565b61026061040336600461226f565b6109c2565b6102606104163660046122ae565b60096020526000908152604090205481565b61026061043636600461226f565b60036020526000908152604090205481565b61038e61045636600461228c565b610a33565b61026061046936600461228c565b610b04565b61038e61047c3660046122dd565b610c47565b61026061048f36600461226f565b600f6020526000908152604090205481565b610260670de0b6b3a764000081565b61038e6104be366004612243565b610f87565b6103dd7f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b081565b6102606104f836600461226f565b60016020526000908152604090205481565b600654610260565b610260600d5481565b61026061052936600461226f565b6112ce565b61026061053c366004612243565b600460209081526000928352604080842090915290825290205481565b6103dd6105673660046122ae565b61138c565b61038e61057a36600461228c565b6113b6565b61038e61058d3660046122dd565b61147f565b61023d6105a03660046122ae565b600c602052600090815260409020805460019091015482565b61023d6105c7366004612243565b611786565b6001600160a01b0382166000818152600460209081526040808320858452825280832054938352600e82528083208380529091528120549091829161061191906119a5565b6000848152600b602052604090205490915061063157600091505061082e565b600061063d8483610b04565b6000858152600b60205260408120549192509061065c906001906123c4565b90506000600161066c84846123c4565b111561077257825b61067f6001846123c4565b811015610770576000878152600a60208181526040808420858552808352818520825180840190935280548352600190810154838501528c865293909252929182906106cc9086906123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061070b8b8460000151611786565b509050600061071e8c8460000151611786565b509050670de0b6b3a764000061073483836123c4565b856020015161074391906123f3565b61074d9190612412565b61075790876123db565b955050505050808061076890612434565b915050610674565b505b6000868152600a602090815260408083208584528252808320815180830190925280548083526001909101549282019290925291906107b2908a90611786565b506001600160a01b038a1660009081526005602090815260408083208c8452909152902054909150670de0b6b3a7640000906107ef9083906119a5565b6107f88b6112ce565b61080291906123c4565b836020015161081191906123f3565b61081b9190612412565b61082590846123db565b96505050505050505b92915050565b61083e82826119bc565b6001600160a01b03909316600090815260036020908152604080832060029092529091209390935590915550565b6001600160a01b03811660009081526001602052604081205461082e904290611b1b565b600d54600090806108a45750600092915050565b82600c60006108b46001856123c4565b815260200190815260200160002060000154116108dd576108d66001826123c4565b9392505050565b60008052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8548310156109185750600092915050565b6000806109266001846123c4565b90505b818111156109ba576000600261093f84846123c4565b6109499190612412565b61095390836123c4565b6000818152600c6020908152604091829020825180840190935280548084526001909101549183019190915291925090871415610994575095945050505050565b80518711156109a5578193506109b3565b6109b06001836123c4565b92505b5050610929565b509392505050565b6001600160a01b03811660009081526001602052604081205442106109e957506000919050565b6001600160a01b038216600090815260016020526040812054610a0d9042906123c4565b6001600160a01b0384166000908152602081905260409020549091506108d690826123f3565b336001600160a01b037f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b01614610a6857600080fd5b8160086000828254610a7a91906123c4565b909155505060008181526009602052604081208054849290610a9d9084906123c4565b9091555050600081815260096020526040902054610abc908290611b2a565b610ac4611c03565b604080518281526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a25050565b6000828152600b602052604081205480610b2257600091505061082e565b6000848152600a602052604081208491610b3d6001856123c4565b81526020019081526020016000206000015411610b6757610b5f6001826123c4565b91505061082e565b6000848152600a60209081526040808320838052909152902054831015610b9257600091505061082e565b600080610ba06001846123c4565b90505b81811115610c3e5760006002610bb984846123c4565b610bc39190612412565b610bcd90836123c4565b6000888152600a60209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090871415610c185750935061082e92505050565b8051871115610c2957819350610c37565b610c346001836123c4565b92505b5050610ba3565b50949350505050565b601054600114610c5657600080fd5b6002601055336001600160a01b037f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b01614610c9057600080fd5b6040516331a9108f60e11b8152600481018390526000907f0000000000000000000000006f5a22e1508410e40bfecf3b18bc9dcc143ed9066001600160a01b031690636352211e90602401602060405180830381865afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c919061244f565b905060005b8251811015610f7c57610d4c838281518110610d3f57610d3f61246c565b6020026020010151611ca7565b60036000868581518110610d6257610d6261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600060026000888781518110610da257610da261246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008491905055839190505550506000610dfd848381518110610def57610def61246c565b6020026020010151866105cc565b90504260046000868581518110610e1657610e1661246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008781526020019081526020016000208190555060036000858481518110610e6957610e6961246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205460056000868581518110610ea857610ea861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015610f0357610f03848381518110610ef457610ef461246c565b60200260200101518483611e8a565b838281518110610f1557610f1561246c565b60200260200101516001600160a01b0316836001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f6191815260200190565b60405180910390a35080610f7481612434565b915050610d21565b505060016010555050565b601054600114610f9657600080fd5b600260105580610fa557600080fd5b6001600160a01b038216600090815260208190526040902054610fce57610fce82600042611f79565b610fd782611ca7565b6001600160a01b03841660009081526003602090815260408083206002835281842094909455939092556001909152205442106110455761101a82333084612068565b61102762093a8082612412565b6001600160a01b0383166000908152602081905260409020556110de565b6001600160a01b0382166000908152600160205260408120546110699042906123c4565b6001600160a01b0384166000908152602081905260408120549192509061109090836123f3565b905080831161109e57600080fd5b6110aa84333086612068565b62093a806110b882856123db565b6110c29190612412565b6001600160a01b03851660009081526020819052604090205550505b6001600160a01b03821660009081526020819052604090205461110057600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190612482565b905061117a62093a8082612412565b6001600160a01b03841660009081526020819052604090205411156111e55760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640160405180910390fd5b6111f262093a80426123db565b6001600160a01b03841660009081526001602090815260408083209390935560079052205460ff16611284576001600160a01b0383166000818152600760205260408120805460ff191660019081179091556006805491820181559091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b03191690911790555b6040518281526001600160a01b0384169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf508269060200160405180910390a35050600160105550565b6000600854600014156112f757506001600160a01b031660009081526003602052604090205490565b6008546001600160a01b0383166000908152602081815260408083205460028352818420546001909352922054670de0b6b3a7640000929161133891611b1b565b6113418661086c565b61134b91906123c4565b61135591906123f3565b61135f91906123f3565b6113699190612412565b6001600160a01b03831660009081526003602052604090205461082e91906123db565b6006818154811061139c57600080fd5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b016146113eb57600080fd5b81600860008282546113fd91906123db565b9091555050600081815260096020526040812080548492906114209084906123db565b909155505060008181526009602052604090205461143f908290611b2a565b611447611c03565b604080518281526020810184905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159101610af8565b60105460011461148e57600080fd5b600260105560405163430c208160e01b8152336004820152602481018390527f0000000000000000000000006f5a22e1508410e40bfecf3b18bc9dcc143ed9066001600160a01b03169063430c208190604401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611522919061249b565b61152b57600080fd5b60005b815181101561177c5761154c828281518110610d3f57610d3f61246c565b600360008585815181106115625761156261246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000600260008787815181106115a2576115a261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600084919050558391905055505060006115fd8383815181106115ef576115ef61246c565b6020026020010151856105cc565b905042600460008585815181106116165761161661246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600086815260200190815260200160002081905550600360008484815181106116695761166961246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600560008585815181106116a8576116a861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208882529092529020558015611703576117038383815181106116f4576116f461246c565b60200260200101513383611e8a565b8282815181106117155761171561246c565b60200260200101516001600160a01b0316336001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc98360405161176191815260200190565b60405180910390a3508061177481612434565b91505061152e565b5050600160105550565b6001600160a01b0382166000908152600f60205260408120548190806117b357600080925092505061199e565b6001600160a01b0385166000908152600e6020526040812085916117d86001856123c4565b81526020019081526020016000206000015411611875576001600160a01b0385166000908152600e60205260408120906118136001846123c4565b815260200190815260200160002060010154600e6000876001600160a01b03166001600160a01b03168152602001908152602001600020600060018461185991906123c4565b815260200190815260200160002060000154925092505061199e565b6001600160a01b0385166000908152600e602090815260408083208380529091529020548410156118ad57600080925092505061199e565b6000806118bb6001846123c4565b90505b8181111561196d57600060026118d484846123c4565b6118de9190612412565b6118e890836123c4565b6001600160a01b0389166000908152600e602090815260408083208484528252918290208251808401909352805480845260019091015491830191909152919250908814156119475760208101519051909650945061199e9350505050565b805188111561195857819350611966565b6119636001836123c4565b92505b50506118be565b506001600160a01b0386166000908152600e6020908152604080832093835292905220600181015490549093509150505b9250929050565b6000818310156119b557816108d6565b5090919050565b6001600160a01b0382166000908152600260209081526040808320546003909252822054600d54839291906119f4579250905061199e565b6001600160a01b038616600090815260208190526040902054611a1d57925042915061199e9050565b6000611a2883610890565b90506000611a446001600d54611a3e91906123c4565b88611b1b565b9050815b81811015611b0c576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611af9576000600c81611a8d8560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611ad88d8460000151866000015187602001518d612160565b9092509050611ae782896123db565b9750611af48d8983611f79565b975050505b5080611b0481612434565b915050611a48565b50919792965091945050505050565b60008183106119b557816108d6565b6000828152600b602052604090205442908015801590611b7457506000848152600a602052604081208391611b606001856123c4565b815260200190815260200160002060000154145b15611bad576000848152600a602052604081208491611b946001856123c4565b8152602081019190915260400160002060010155611bfd565b60408051808201825283815260208082018681526000888152600a8352848120868252909252929020905181559051600191820155611bed9082906123db565b6000858152600b60205260409020555b50505050565b600d54428115801590611c35575080600c6000611c216001866123c4565b815260200190815260200160002060000154145b15611c6457600854600c6000611c4c6001866123c4565b81526020810191909152604001600020600101555050565b60408051808201825282815260085460208083019182526000868152600c90915292909220905181559051600191820155611ca09083906123db565b600d555050565b6001600160a01b0381166000908152600260209081526040808320546003909252822054600d5483929190611cdf5794909350915050565b6001600160a01b038516600090815260208190526040902054611d06579442945092505050565b6000611d1183610890565b905060006001600d54611d2491906123c4565b90506001611d3283836123c4565b1115611e0a57815b611d456001836123c4565b811015611e08576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611df5576000600c81611d898560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611dd48c8460000151866000015187602001518d612160565b9092509050611de382896123db565b9750611df08c8983611f79565b975050505b5080611e0081612434565b915050611d3a565b505b6000818152600c60209081526040918290208251808401909352805483526001015490820181905215611e7c576000611e5d89611e468b61086c565b8451611e52908a6119a5565b85602001518a612160565b509050611e6a81866123db565b9450611e77898642611f79565b429550505b509196929550919350505050565b6000836001600160a01b03163b11611ea157600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611efd91906124bd565b6000604051808303816000865af19150503d8060008114611f3a576040519150601f19603f3d011682016040523d82523d6000602084013e611f3f565b606091505b5091509150818015611f69575080511580611f69575080806020019051810190611f69919061249b565b611f7257600080fd5b5050505050565b6001600160a01b0383166000908152600f60205260409020548015801590611fd557506001600160a01b0384166000908152600e602052604081208391611fc16001856123c4565b815260200190815260200160002060000154145b15611fff576001600160a01b0384166000908152600e602052604081208491611b946001856123c4565b60408051808201825283815260208082018681526001600160a01b0388166000908152600e83528481208682529092529290209051815590516001918201556120499082906123db565b6001600160a01b0385166000908152600f602052604090205550505050565b6000846001600160a01b03163b1161207f57600080fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916120e391906124bd565b6000604051808303816000865af19150503d8060008114612120576040519150601f19603f3d011682016040523d82523d6000602084013e612125565b606091505b509150915081801561214f57508051158061214f57508080602001905181019061214f919061249b565b61215857600080fd5b505050505050565b600080600061216f87856119a5565b6001600160a01b0389166000908152602081905260409020549091508590670de0b6b3a7640000906121c26121a48a896119a5565b6001600160a01b038d16600090815260016020526040902054611b1b565b6001600160a01b038c166000908152600160205260409020546121e6908690611b1b565b6121f091906123c4565b6121fa91906123f3565b61220491906123f3565b61220e9190612412565b9890975095505050505050565b6001600160a01b038116811461223057600080fd5b50565b803561223e8161221b565b919050565b6000806040838503121561225657600080fd5b82356122618161221b565b946020939093013593505050565b60006020828403121561228157600080fd5b81356108d68161221b565b6000806040838503121561229f57600080fd5b50508035926020909101359150565b6000602082840312156122c057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156122f057600080fd5b8235915060208084013567ffffffffffffffff8082111561231057600080fd5b818601915086601f83011261232457600080fd5b813581811115612336576123366122c7565b8060051b604051601f19603f8301168101818110858211171561235b5761235b6122c7565b60405291825284820192508381018501918983111561237957600080fd5b938501935b8285101561239e5761238f85612233565b8452938501939285019261237e565b8096505050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156123d6576123d66123ae565b500390565b600082198211156123ee576123ee6123ae565b500190565b600081600019048311821515161561240d5761240d6123ae565b500290565b60008261242f57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415612448576124486123ae565b5060010190565b60006020828403121561246157600080fd5b81516108d68161221b565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561249457600080fd5b5051919050565b6000602082840312156124ad57600080fd5b815180151581146108d657600080fd5b6000825160005b818110156124de57602081860181015185830152016124c4565b818111156124ed576000828501525b50919091019291505056fea2646970667358221220a22a6d9731fe98e7396bc8f8c9b50514291e16577c041398eaf2bd17fac19cd864736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,976 |
0x3109d8eec2cc8727b852aeb702d5c05c6138b66e
|
pragma solidity ^0.4.20;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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);
}
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 BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// 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;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts\MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
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;
MintFinished();
return true;
}
}
// File: contracts\Crowdsale.sol
/**
* @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.
*/
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public {
//require(_startTime >= now);
require(_endTime >= _startTime);
require(_rate > 0);
require(_wallet != address(0));
token = createTokenContract();
startTime = _startTime;
endTime = _endTime;
rate = _rate;
wallet = _wallet;
}
// fallback function can be used to buy tokens
function () external payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
// creates the token to be sold.
// override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) {
return new MintableToken();
}
// Override this method to have a way to add business logic to your crowdsale when buying
function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
return weiAmount.mul(rate);
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
}
contract CappedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 public cap;
function CappedCrowdsale(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap;
return capReached || super.hasEnded();
}
function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return withinCap && super.validPurchase();
}
}
contract HAIToken is MintableToken {
string public name = "HAI Token";
string public symbol = "HAI";
uint8 public decimals = 18;
}
// File: contracts\FinalizableCrowdsale.sol
/**
* @title FinalizableCrowdsale
* @dev Extension of Crowdsale where an owner can do extra work
* after finishing.
*/
contract FinalizableCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
/**
* @dev Must be called after crowdsale ends, to do some extra finalization
* work. Calls the contract's finalization function.
*/
function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
}
/**
* @dev Can be overridden to add finalization logic. The overriding function
* should call super.finalization() to ensure the chain of finalization is
* executed entirely.
*/
function finalization() internal {
}
}
// File: contracts\RefundVault.sol
/**
* @title RefundVault
* @dev This contract is used for storing funds while a crowdsale
* is in progress. Supports refunding the money if crowdsale fails,
* and forwarding it if crowdsale is successful.
*/
contract RefundVault is Ownable {
using SafeMath for uint256;
enum State { Active, Refunding, Closed }
mapping (address => uint256) public deposited;
address public wallet;
State public state;
event Closed();
event RefundsEnabled();
event Refunded(address indexed beneficiary, uint256 weiAmount);
function RefundVault(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
state = State.Active;
}
function deposit(address investor) onlyOwner public payable {
require(state == State.Active);
deposited[investor] = deposited[investor].add(msg.value);
}
function close() onlyOwner public {
require(state == State.Active);
state = State.Closed;
Closed();
wallet.transfer(this.balance);
}
function enableRefunds() onlyOwner public {
require(state == State.Active);
state = State.Refunding;
RefundsEnabled();
}
function refund(address investor) public {
require(state == State.Refunding);
uint256 depositedValue = deposited[investor];
deposited[investor] = 0;
investor.transfer(depositedValue);
Refunded(investor, depositedValue);
}
}
// File: contracts\RefundableCrowdsale.sol
/**
* @title RefundableCrowdsale
* @dev Extension of Crowdsale contract that adds a funding goal, and
* the possibility of users getting a refund if goal is not met.
* Uses a RefundVault as the crowdsale's vault.
*/
contract RefundableCrowdsale is FinalizableCrowdsale {
using SafeMath for uint256;
// minimum amount of funds to be raised in weis
uint256 public goal;
// refund vault used to hold funds while crowdsale is running
RefundVault public vault;
function RefundableCrowdsale(uint256 _goal) public {
require(_goal > 0);
vault = new RefundVault(wallet);
goal = _goal;
}
// if crowdsale is unsuccessful, investors can claim refunds here
/*function claimRefund() public {
require(isFinalized);
require(!goalReached());
vault.refund(msg.sender);
}
*/
function goalReached() public view returns (bool) {
return weiRaised >= goal;
}
// vault finalization task, called when owner calls finalize()
function finalization() internal {
if (goalReached()) {
vault.close();
} else {
vault.enableRefunds();
}
super.finalization();
}
// We're overriding the fund forwarding from Crowdsale.
// In addition to sending the funds, we want to call
// the RefundVault deposit function
function forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
}
}
// File: contracts\HAICrowdsale.sol
contract HAICrowdsale is CappedCrowdsale, RefundableCrowdsale {
// ICO Stage
// ============
enum CrowdsaleStage { PreICO, ICO }
CrowdsaleStage public stage = CrowdsaleStage.PreICO;
// =============
// Token Distribution
// =============================
uint256 public maxTokens = 100000000000000000000000000;
uint256 public tokensForEcosystem = 5000000000000000000000000;
uint256 public tokensForTeam = 5000000000000000000000000;
uint256 public tokensForBounty = 5000000000000000000000000;
uint256 public totalTokensForSale = 75000000000000000000000000;
uint256 public totalTokensForSaleDuringPreICO = 10000000000000000000000000;
// ==============================
// Amount raised in PreICO
// ==================
uint256 public totalWeiRaisedDuringPreICO;
// ===================
// Events
event EthTransferred(string text);
event EthRefunded(string text);
// Constructor
// ============
function HAICrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, uint256 _goal, uint256 _cap) CappedCrowdsale(_cap) FinalizableCrowdsale() RefundableCrowdsale(_goal) Crowdsale(_startTime, _endTime, _rate, _wallet) public {
require(_goal <= _cap);
}
// =============
// Token Deployment
// =================
function createTokenContract() internal returns (MintableToken) {
return new HAIToken(); // Deploys the ERC20 token. Automatically called when crowdsale contract is deployed
}
// ==================
// Crowdsale Stage Management
// =========================================================
// Change Crowdsale Stage. Available Options: PreICO, ICO
function setCrowdsaleStage(uint value) public onlyOwner {
CrowdsaleStage _stage;
if (uint(CrowdsaleStage.PreICO) == value) {
_stage = CrowdsaleStage.PreICO;
} else if (uint(CrowdsaleStage.ICO) == value) {
_stage = CrowdsaleStage.ICO;
}
stage = _stage;
if (stage == CrowdsaleStage.PreICO) {
setCurrentRate(2500);
} else if (stage == CrowdsaleStage.ICO) {
setCurrentRate(2000);
}
}
// Change the current rate
function setCurrentRate(uint256 _rate) private {
rate = _rate;
}
// ================ Stage Management Over =====================
// Token Purchase
// =========================
function () external payable {
uint256 tokensThatWillBeMintedAfterPurchase = msg.value.mul(rate);
if ((stage == CrowdsaleStage.PreICO) && (token.totalSupply() + tokensThatWillBeMintedAfterPurchase > totalTokensForSaleDuringPreICO)) {
msg.sender.transfer(msg.value); // Refund them
EthRefunded("PreICO Limit Hit");
return;
}
buyTokens(msg.sender);
if (stage == CrowdsaleStage.PreICO) {
totalWeiRaisedDuringPreICO = totalWeiRaisedDuringPreICO.add(msg.value);
}
}
function forwardFunds() internal {
if (stage == CrowdsaleStage.PreICO) {
wallet.transfer(msg.value);
EthTransferred("forwarding funds to wallet");
} else if (stage == CrowdsaleStage.ICO) {
EthTransferred("forwarding funds to refundable vault");
super.forwardFunds();
}
}
// ===========================
// Finish: Mint Extra Tokens as needed before finalizing the Crowdsale.
// ====================================================================
function finish(address _teamFund, address _ecosystemFund, address _bountyFund) public onlyOwner {
require(!isFinalized);
uint256 alreadyMinted = token.totalSupply();
require(alreadyMinted < maxTokens);
uint256 unsoldTokens = totalTokensForSale - alreadyMinted;
if (unsoldTokens > 0) {
tokensForEcosystem = tokensForEcosystem + unsoldTokens;
}
token.mint(_teamFund,tokensForTeam);
token.mint(_ecosystemFund,tokensForEcosystem);
token.mint(_bountyFund,tokensForBounty);
finalize();
}
}
|
0x60806040526004361061013a5763ffffffff60e060020a6000350416632c4e722e81146102dd5780633197cbb614610304578063355274ea14610319578063401938831461032e5780634042b66f146103435780634bb278f3146103585780634c4cfc3b1461036f578063521eb2731461038457806360219c7b146103b5578063644280e2146103ca57806378e97925146103df5780637d3d6522146103f45780637e02bb0f1461041d5780638d4e40831461044a5780638da5cb5b1461045f578063a997f82f14610474578063abe8014a1461048c578063c02aaea1146104a1578063c040e6b8146104b6578063e8315742146104ef578063ec8ac4d814610504578063ecb70fb714610518578063f2fde38b1461052d578063fbfa77cf1461054e578063fc0c546a14610563578063fde83a3414610578575b60006101516004543461058d90919063ffffffff16565b9050600060095460a060020a900460ff16600181111561016d57fe5b1480156101fa5750600f54816000809054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156101cb57600080fd5b505af11580156101df573d6000803e3d6000fd5b505050506040513d60208110156101f557600080fd5b505101115b1561029a57604051600160a060020a033316903480156108fc02916000818181858888f19350505050158015610234573d6000803e3d6000fd5b506040805160208082526010908201527f50726549434f204c696d697420486974000000000000000000000000000000008183015290517fc0283f9c45b2118c7ec26e4f4bf06fc486f94a186fb38dc5dff372d9cb709d379181900360600190a16102da565b6102a3336105c3565b600060095460a060020a900460ff1660018111156102bd57fe5b14156102da576010546102d6903463ffffffff6106f416565b6010555b50005b3480156102e957600080fd5b506102f2610703565b60408051918252519081900360200190f35b34801561031057600080fd5b506102f2610709565b34801561032557600080fd5b506102f261070f565b34801561033a57600080fd5b506102f2610715565b34801561034f57600080fd5b506102f261071b565b34801561036457600080fd5b5061036d610721565b005b34801561037b57600080fd5b506102f26107bd565b34801561039057600080fd5b506103996107c3565b60408051600160a060020a039092168252519081900360200190f35b3480156103c157600080fd5b506102f26107d2565b3480156103d657600080fd5b506102f26107d8565b3480156103eb57600080fd5b506102f26107de565b34801561040057600080fd5b506104096107e4565b604080519115158252519081900360200190f35b34801561042957600080fd5b5061036d600160a060020a03600435811690602435811690604435166107ef565b34801561045657600080fd5b50610409610a82565b34801561046b57600080fd5b50610399610a92565b34801561048057600080fd5b5061036d600435610aa1565b34801561049857600080fd5b506102f2610b6f565b3480156104ad57600080fd5b506102f2610b75565b3480156104c257600080fd5b506104cb610b7b565b604051808260018111156104db57fe5b60ff16815260200191505060405180910390f35b3480156104fb57600080fd5b506102f2610b8b565b61036d600160a060020a03600435166105c3565b34801561052457600080fd5b50610409610b91565b34801561053957600080fd5b5061036d600160a060020a0360043516610bb1565b34801561055a57600080fd5b50610399610c4a565b34801561056f57600080fd5b50610399610c59565b34801561058457600080fd5b506102f2610c68565b6000808315156105a057600091506105bc565b508282028284828115156105b057fe5b04146105b857fe5b8091505b5092915050565b600080600160a060020a03831615156105db57600080fd5b6105e3610c6e565b15156105ee57600080fd5b3491506105fa82610c9d565b600554909150610610908363ffffffff6106f416565b600555600080546040805160e060020a6340c10f19028152600160a060020a03878116600483015260248201869052915191909216926340c10f1992604480820193602093909283900390910190829087803b15801561066f57600080fd5b505af1158015610683573d6000803e3d6000fd5b505050506040513d602081101561069957600080fd5b505060408051838152602081018390528151600160a060020a038087169333909116927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18929081900390910190a36106ef610cba565b505050565b6000828201838110156105b857fe5b60045481565b60025481565b60065481565b60085481565b60055481565b60075433600160a060020a0390811691161461073c57600080fd5b60075460a060020a900460ff161561075357600080fd5b61075b610b91565b151561076657600080fd5b61076e610e29565b6040517f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768190600090a16007805474ff0000000000000000000000000000000000000000191660a060020a179055565b600b5481565b600354600160a060020a031681565b600e5481565b600d5481565b60015481565b600854600554101590565b600754600090819033600160a060020a0390811691161461080f57600080fd5b60075460a060020a900460ff161561082657600080fd5b6000809054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561087857600080fd5b505af115801561088c573d6000803e3d6000fd5b505050506040513d60208110156108a257600080fd5b5051600a5490925082106108b557600080fd5b81600e5403905060008111156108ce57600b8054820190555b60008054600c546040805160e060020a6340c10f19028152600160a060020a038a811660048301526024820193909352905191909216926340c10f1992604480820193602093909283900390910190829087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b505050506040513d602081101561095857600080fd5b505060008054600b546040805160e060020a6340c10f19028152600160a060020a0389811660048301526024820193909352905191909216926340c10f1992604480820193602093909283900390910190829087803b1580156109ba57600080fd5b505af11580156109ce573d6000803e3d6000fd5b505050506040513d60208110156109e457600080fd5b505060008054600d546040805160e060020a6340c10f19028152600160a060020a0388811660048301526024820193909352905191909216926340c10f1992604480820193602093909283900390910190829087803b158015610a4657600080fd5b505af1158015610a5a573d6000803e3d6000fd5b505050506040513d6020811015610a7057600080fd5b50610a7b9050610721565b5050505050565b60075460a060020a900460ff1681565b600754600160a060020a031681565b60075460009033600160a060020a03908116911614610abf57600080fd5b811515610ace57506000610adb565b8160011415610adb575060015b6009805482919074ff0000000000000000000000000000000000000000191660a060020a836001811115610b0b57fe5b0217905550600060095460a060020a900460ff166001811115610b2a57fe5b1415610b4057610b3b6109c4610f1a565b610b6b565b600160095460a060020a900460ff166001811115610b5a57fe5b1415610b6b57610b6b6107d0610f1a565b5050565b60105481565b600f5481565b60095460a060020a900460ff1681565b600a5481565b60065460055460009111158080610bab5750610bab610f1f565b91505090565b60075433600160a060020a03908116911614610bcc57600080fd5b600160a060020a0381161515610be157600080fd5b600754604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600954600160a060020a031681565b600054600160a060020a031681565b600c5481565b600080600654610c89346005546106f490919063ffffffff16565b11159050808015610bab5750610bab610f27565b6000610cb46004548361058d90919063ffffffff16565b92915050565b600060095460a060020a900460ff166001811115610cd457fe5b1415610d7957600354604051600160a060020a03909116903480156108fc02916000818181858888f19350505050158015610d13573d6000803e3d6000fd5b50604080516020808252601a908201527f666f7277617264696e672066756e647320746f2077616c6c65740000000000008183015290517f47af8c4076c54a76f613f82e4296a2c5e2167698d368157a82e62398393e345e9181900360600190a1610e27565b600160095460a060020a900460ff166001811115610d9357fe5b1415610e27576040805160208082526024908201527f666f7277617264696e672066756e647320746f20726566756e6461626c652076818301527f61756c7400000000000000000000000000000000000000000000000000000000606082015290517f47af8c4076c54a76f613f82e4296a2c5e2167698d368157a82e62398393e345e9181900360800190a1610e27610f57565b565b610e316107e4565b15610ea657600960009054906101000a9004600160a060020a0316600160a060020a03166343d726d66040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015610e8957600080fd5b505af1158015610e9d573d6000803e3d6000fd5b50505050610f12565b600960009054906101000a9004600160a060020a0316600160a060020a0316638c52dc416040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015610ef957600080fd5b505af1158015610f0d573d6000803e3d6000fd5b505050505b610e27610e27565b600455565b600254421190565b60008060006001544210158015610f4057506002544211155b915050341515818015610f505750805b9250505090565b600954604080517ff340fa01000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301529151919092169163f340fa0191349160248082019260009290919082900301818588803b158015610fc157600080fd5b505af1158015610a7b573d6000803e3d6000fd00a165627a7a72305820ab657aa21edfe821fcc672145d8ba3b18a6ac86252d45007beeb35df86c4a4dd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,977 |
0xc85Ca8962e8D5Db1234F9D65F8EBdfed552B76Be
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/DarthVaderTokenErc20
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract DarthVader is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**6;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
string private constant _name = "Darth Vader";
string private constant _symbol = "DARTHVADER";
uint8 private constant _decimals = 6;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!_canTrade,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswap = _uniswapV2Router;
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb146102dd578063c9567bf91461031a578063dd62ed3e14610331578063f42938901461036e576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b41146102895780639e752b95146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a9190612231565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611df4565b6103c2565b6040516101579190612216565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b6040516101829190612393565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611da1565b6103ee565b6040516101bf9190612216565b60405180910390f35b3480156101d457600080fd5b506101dd6104c7565b6040516101ea9190612408565b60405180910390f35b3480156101ff57600080fd5b506102086104d0565b005b34801561021657600080fd5b50610231600480360381019061022c9190611d07565b61054a565b60405161023e9190612393565b60405180910390f35b34801561025357600080fd5b5061025c61059b565b005b34801561026a57600080fd5b506102736106ee565b6040516102809190612148565b60405180910390f35b34801561029557600080fd5b5061029e610717565b6040516102ab9190612231565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d69190611e61565b610754565b005b3480156102e957600080fd5b5061030460048036038101906102ff9190611df4565b6107cc565b6040516103119190612216565b60405180910390f35b34801561032657600080fd5b5061032f6107ea565b005b34801561033d57600080fd5b5061035860048036038101906103539190611d61565b610cf7565b6040516103659190612393565b60405180910390f35b34801561037a57600080fd5b50610383610d7e565b005b60606040518060400160405280600b81526020017f4461727468205661646572000000000000000000000000000000000000000000815250905090565b60006103d66103cf610df0565b8484610df8565b6001905092915050565b6000655af3107a4000905090565b60006103fb848484610fc3565b6104bc84610407610df0565b6104b7856040518060600160405280602881526020016129e360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046d610df0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122b9092919063ffffffff16565b610df8565b600190509392505050565b60006006905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610511610df0565b73ffffffffffffffffffffffffffffffffffffffff161461053157600080fd5b600061053c3061054a565b90506105478161128f565b50565b6000610594600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611517565b9050919050565b6105a3610df0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610630576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610627906122f3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4441525448564144455200000000000000000000000000000000000000000000815250905090565b61075c610df0565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107b557600080fd5b600981106107c257600080fd5b8060088190555050565b60006107e06107d9610df0565b8484610fc3565b6001905092915050565b6107f2610df0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461087f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610876906122f3565b60405180910390fd5b600b60149054906101000a900460ff16156108cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c690612373565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061095c30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16655af3107a4000610df8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a257600080fd5b505afa1580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190611d34565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3c57600080fd5b505afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a749190611d34565b6040518363ffffffff1660e01b8152600401610a91929190612163565b602060405180830381600087803b158015610aab57600080fd5b505af1158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae39190611d34565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610b6c3061054a565b600080610b776106ee565b426040518863ffffffff1660e01b8152600401610b99969594939291906121b5565b6060604051808303818588803b158015610bb257600080fd5b505af1158015610bc6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610beb9190611e8e565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610ca192919061218c565b602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190611e34565b5050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dbf610df0565b73ffffffffffffffffffffffffffffffffffffffff1614610ddf57600080fd5b6000479050610ded81611585565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5f90612353565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ed8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ecf90612293565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fb69190612393565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611033576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102a90612333565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109a90612253565b60405180910390fd5b600081116110e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110dd90612313565b60405180910390fd5b6110ee6106ee565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561115c575061112c6106ee565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561121b57600061116c3061054a565b9050600b60159054906101000a900460ff161580156111d95750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156111f15750600b60169054906101000a900460ff165b15611219576111ff8161128f565b600047905060008111156112175761121647611585565b5b505b505b6112268383836115f1565b505050565b6000838311158290611273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126a9190612231565b60405180910390fd5b50600083856112829190612559565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112c7576112c66126b4565b5b6040519080825280602002602001820160405280156112f55781602001602082028036833780820191505090505b509050308160008151811061130d5761130c612685565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113af57600080fd5b505afa1580156113c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e79190611d34565b816001815181106113fb576113fa612685565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061146230600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610df8565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114c69594939291906123ae565b600060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b600060055482111561155e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155590612273565b60405180910390fd5b6000611568611601565b905061157d818461162c90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156115ed573d6000803e3d6000fd5b5050565b6115fc838383611676565b505050565b600080600061160e611841565b91509150611625818361162c90919063ffffffff16565b9250505090565b600061166e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061189a565b905092915050565b600080600080600080611688876118fd565b9550955095509550955095506116e686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061177b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119af90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117c781611a0d565b6117d18483611aca565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161182e9190612393565b60405180910390a3505050505050505050565b600080600060055490506000655af3107a40009050611871655af3107a400060055461162c90919063ffffffff16565b82101561188d57600554655af3107a4000935093505050611896565b81819350935050505b9091565b600080831182906118e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d89190612231565b60405180910390fd5b50600083856118f091906124ce565b9050809150509392505050565b600080600080600080600080600061191a8a600754600854611b04565b925092509250600061192a611601565b9050600080600061193d8e878787611b9a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006119a783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061122b565b905092915050565b60008082846119be9190612478565b905083811015611a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119fa906122b3565b60405180910390fd5b8091505092915050565b6000611a17611601565b90506000611a2e8284611c2390919063ffffffff16565b9050611a8281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119af90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611adf8260055461196590919063ffffffff16565b600581905550611afa816006546119af90919063ffffffff16565b6006819055505050565b600080600080611b306064611b22888a611c2390919063ffffffff16565b61162c90919063ffffffff16565b90506000611b5a6064611b4c888b611c2390919063ffffffff16565b61162c90919063ffffffff16565b90506000611b8382611b75858c61196590919063ffffffff16565b61196590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611bb38589611c2390919063ffffffff16565b90506000611bca8689611c2390919063ffffffff16565b90506000611be18789611c2390919063ffffffff16565b90506000611c0a82611bfc858761196590919063ffffffff16565b61196590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611c365760009050611c98565b60008284611c4491906124ff565b9050828482611c5391906124ce565b14611c93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8a906122d3565b60405180910390fd5b809150505b92915050565b600081359050611cad8161299d565b92915050565b600081519050611cc28161299d565b92915050565b600081519050611cd7816129b4565b92915050565b600081359050611cec816129cb565b92915050565b600081519050611d01816129cb565b92915050565b600060208284031215611d1d57611d1c6126e3565b5b6000611d2b84828501611c9e565b91505092915050565b600060208284031215611d4a57611d496126e3565b5b6000611d5884828501611cb3565b91505092915050565b60008060408385031215611d7857611d776126e3565b5b6000611d8685828601611c9e565b9250506020611d9785828601611c9e565b9150509250929050565b600080600060608486031215611dba57611db96126e3565b5b6000611dc886828701611c9e565b9350506020611dd986828701611c9e565b9250506040611dea86828701611cdd565b9150509250925092565b60008060408385031215611e0b57611e0a6126e3565b5b6000611e1985828601611c9e565b9250506020611e2a85828601611cdd565b9150509250929050565b600060208284031215611e4a57611e496126e3565b5b6000611e5884828501611cc8565b91505092915050565b600060208284031215611e7757611e766126e3565b5b6000611e8584828501611cdd565b91505092915050565b600080600060608486031215611ea757611ea66126e3565b5b6000611eb586828701611cf2565b9350506020611ec686828701611cf2565b9250506040611ed786828701611cf2565b9150509250925092565b6000611eed8383611ef9565b60208301905092915050565b611f028161258d565b82525050565b611f118161258d565b82525050565b6000611f2282612433565b611f2c8185612456565b9350611f3783612423565b8060005b83811015611f68578151611f4f8882611ee1565b9750611f5a83612449565b925050600181019050611f3b565b5085935050505092915050565b611f7e8161259f565b82525050565b611f8d816125e2565b82525050565b6000611f9e8261243e565b611fa88185612467565b9350611fb88185602086016125f4565b611fc1816126e8565b840191505092915050565b6000611fd9602383612467565b9150611fe4826126f9565b604082019050919050565b6000611ffc602a83612467565b915061200782612748565b604082019050919050565b600061201f602283612467565b915061202a82612797565b604082019050919050565b6000612042601b83612467565b915061204d826127e6565b602082019050919050565b6000612065602183612467565b91506120708261280f565b604082019050919050565b6000612088602083612467565b91506120938261285e565b602082019050919050565b60006120ab602983612467565b91506120b682612887565b604082019050919050565b60006120ce602583612467565b91506120d9826128d6565b604082019050919050565b60006120f1602483612467565b91506120fc82612925565b604082019050919050565b6000612114601783612467565b915061211f82612974565b602082019050919050565b612133816125cb565b82525050565b612142816125d5565b82525050565b600060208201905061215d6000830184611f08565b92915050565b60006040820190506121786000830185611f08565b6121856020830184611f08565b9392505050565b60006040820190506121a16000830185611f08565b6121ae602083018461212a565b9392505050565b600060c0820190506121ca6000830189611f08565b6121d7602083018861212a565b6121e46040830187611f84565b6121f16060830186611f84565b6121fe6080830185611f08565b61220b60a083018461212a565b979650505050505050565b600060208201905061222b6000830184611f75565b92915050565b6000602082019050818103600083015261224b8184611f93565b905092915050565b6000602082019050818103600083015261226c81611fcc565b9050919050565b6000602082019050818103600083015261228c81611fef565b9050919050565b600060208201905081810360008301526122ac81612012565b9050919050565b600060208201905081810360008301526122cc81612035565b9050919050565b600060208201905081810360008301526122ec81612058565b9050919050565b6000602082019050818103600083015261230c8161207b565b9050919050565b6000602082019050818103600083015261232c8161209e565b9050919050565b6000602082019050818103600083015261234c816120c1565b9050919050565b6000602082019050818103600083015261236c816120e4565b9050919050565b6000602082019050818103600083015261238c81612107565b9050919050565b60006020820190506123a8600083018461212a565b92915050565b600060a0820190506123c3600083018861212a565b6123d06020830187611f84565b81810360408301526123e28186611f17565b90506123f16060830185611f08565b6123fe608083018461212a565b9695505050505050565b600060208201905061241d6000830184612139565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612483826125cb565b915061248e836125cb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124c3576124c2612627565b5b828201905092915050565b60006124d9826125cb565b91506124e4836125cb565b9250826124f4576124f3612656565b5b828204905092915050565b600061250a826125cb565b9150612515836125cb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561254e5761254d612627565b5b828202905092915050565b6000612564826125cb565b915061256f836125cb565b92508282101561258257612581612627565b5b828203905092915050565b6000612598826125ab565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006125ed826125cb565b9050919050565b60005b838110156126125780820151818401526020810190506125f7565b83811115612621576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6129a68161258d565b81146129b157600080fd5b50565b6129bd8161259f565b81146129c857600080fd5b50565b6129d4816125cb565b81146129df57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122031e3d8724adb2ad01327e2afba614f0c2e64417116665f6ec0562ce7fb42b75464736f6c63430008070033
|
{"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"}]}}
| 2,978 |
0xbac507978ee51ebd4b282875f6b48debe22ee2dd
|
// SPDX-License-Identifier: MIT
/**
*
*______ _____ _ _ _ _____ _____ _____ _____
*| _ \ | ___| | | | (_) / __ \| _ |/ __ \| _ |
*| | | |___ __ _ ___ _ __ | |__ | | ___ ___| |_ _ ___ _ __ `' / /'| |/' |`' / /'| |/' |
*| | | / _ \/ _` |/ _ \ '_ \ | __|| |/ _ \/ __| __| |/ _ \| '_ \ / / | /| | / / | /| |
*| |/ / __/ (_| | __/ | | | | |___| | __/ (__| |_| | (_) | | | | ./ /___\ |_/ /./ /___\ |_/ /
*|___/ \___|\__, |\___|_| |_| \____/|_|\___|\___|\__|_|\___/|_| |_| \_____/ \___/ \_____/ \___/
* __/ |
* |___/
*
* dTRUMP
**/
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IERC20 {
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) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract dTRUMP is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _burnPercentage;
address private _storeAddress;
uint256 private _maxTransactionAmount;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 totalSupply, uint256 burnPercentage, address storeAddress, uint256 maxTransactionAmount) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_burnPercentage = burnPercentage;
_storeAddress = storeAddress;
_maxTransactionAmount = maxTransactionAmount;
_mint(_msgSender(), totalSupply);
}
/**
* @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. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* 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;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
if(recipient != owner() && sender != owner() ) {
require(amount <= _maxTransactionAmount, "ERC20: transfer amount exceeds limit");
}
uint256 burnAmount = amount.mul(_burnPercentage).div(100);
uint256 transfAmount = amount.sub(burnAmount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(transfAmount);
_balances[_storeAddress] = _balances[_storeAddress].add(burnAmount);
emit Transfer(sender, recipient, amount);
emit Transfer(sender, _storeAddress, burnAmount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Sets {burnPercentage} to a value.
*
*/
function _setBurnPercentage(uint256 burnPercentage) external onlyOwner returns (bool) {
if(_burnPercentage < 0 || _burnPercentage > 100)
return false;
_burnPercentage = burnPercentage;
return true;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
/**
* @dev See {_burnPercentage}.
*/
function burnPercentage() external view returns (uint256) {
return _burnPercentage;
}
/**
* @dev See {_storeAddress}.
*/
function storeAddress() external view returns (address) {
return _storeAddress;
}
/**
* @dev See {_maxTransactionAmount}.
*/
function maxTransactionAmount() external view returns (uint256) {
return _maxTransactionAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063c8c8ebe411610071578063c8c8ebe414610573578063dd62ed3e14610591578063f01f20df14610609578063f2c4da9314610627578063f2fde38b1461067157610116565b80638da5cb5b146103da57806395d89b4114610424578063a457c2d7146104a7578063a9059cbb1461050d57610116565b806323b872dd116100e957806323b872dd14610268578063313ce567146102ee578063395093511461031257806370a0823114610378578063715018a6146103d057610116565b8063058ee92f1461011b57806306fdde0314610161578063095ea7b3146101e457806318160ddd1461024a575b600080fd5b6101476004803603602081101561013157600080fd5b81019080803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b6101696107b2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a957808201518184015260208101905061018e565b50505050905090810190601f1680156101d65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610230600480360360408110156101fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610854565b604051808215151515815260200191505060405180910390f35b610252610872565b6040518082815260200191505060405180910390f35b6102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087c565b604051808215151515815260200191505060405180910390f35b6102f6610955565b604051808260ff1660ff16815260200191505060405180910390f35b61035e6004803603604081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061096c565b604051808215151515815260200191505060405180910390f35b6103ba6004803603602081101561038e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1f565b6040518082815260200191505060405180910390f35b6103d8610a68565b005b6103e2610bf0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042c610c19565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561046c578082015181840152602081019050610451565b50505050905090810190601f1680156104995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104f3600480360360408110156104bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cbb565b604051808215151515815260200191505060405180910390f35b6105596004803603604081101561052357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d88565b604051808215151515815260200191505060405180910390f35b61057b610da6565b6040518082815260200191505060405180910390f35b6105f3600480360360408110156105a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610db0565b6040518082815260200191505060405180910390f35b610611610e37565b6040518082815260200191505060405180910390f35b61062f610e41565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106b36004803603602081101561068757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6b565b005b60006106bf611078565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610780576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600754108061079357506064600754115b156107a157600090506107ad565b81600781905550600190505b919050565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561084a5780601f1061081f5761010080835404028352916020019161084a565b820191906000526020600020905b81548152906001019060200180831161082d57829003601f168201915b5050505050905090565b6000610868610861611078565b8484611080565b6001905092915050565b6000600354905090565b6000610889848484611277565b61094a84610895611078565b61094585604051806060016040528060288152602001611b9860289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108fb611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b89092919063ffffffff16565b611080565b600190509392505050565b6000600660009054906101000a900460ff16905090565b6000610a15610979611078565b84610a10856002600061098a611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b611080565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a70611078565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cb15780601f10610c8657610100808354040283529160200191610cb1565b820191906000526020600020905b815481529060010190602001808311610c9457829003601f168201915b5050505050905090565b6000610d7e610cc8611078565b84610d7985604051806060016040528060258152602001611c2d6025913960026000610cf2611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b89092919063ffffffff16565b611080565b6001905092915050565b6000610d9c610d95611078565b8484611277565b6001905092915050565b6000600954905090565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600754905090565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610e73611078565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611b096026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611106576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611be56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561118c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b2f6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611bc06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611383576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ae66023913960400191505060405180910390fd5b61138e838383611900565b611396610bf0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561140457506113d4610bf0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561146557600954811115611464576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c096024913960400191505060405180910390fd5b5b600061148f60646114816007548561190590919063ffffffff16565b61198b90919063ffffffff16565b905060006114a682846119d590919063ffffffff16565b905061151483604051806060016040528060268152602001611b5160269139600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b89092919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115a981600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116608260016000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b60016000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b6000838311158290611865576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561182a57808201518184015260208101905061180f565b50505050905090810190601f1680156118575780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156118f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b6000808314156119185760009050611985565b600082840290508284828161192957fe5b0414611980576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b776021913960400191505060405180910390fd5b809150505b92915050565b60006119cd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a1f565b905092915050565b6000611a1783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117b8565b905092915050565b60008083118290611acb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a90578082015181840152602081019050611a75565b50505050905090810190601f168015611abd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611ad757fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e742065786365656473206c696d697445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122019de549552b57f1df0d812d87a355592da872063c06d9eccd35cb0d672b7217f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,979 |
0x7c566d1704fcf7ea80aaa8ab3b3c3b12244cffe7
|
/**
*Submitted for verification at Etherscan.io on 2022-04-03
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
/*
CULTVISION - $VCULT
Telegram: https://t.me/cultvision
Twitter: https://twitter.com/cult_vision
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CULTVISION is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Cult Vision";//////////////////////////
string private constant _symbol = "VCULT";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 10;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 10;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x9AB530074e0D7E98b289Dc5E832305E1B3E932F3);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x9AB530074e0D7E98b289Dc5E832305E1B3E932F3);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600b81526020017f43756c7420566973696f6e000000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000662386f26fc10000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f5643554c54000000000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b600080600060065490506000662386f26fc1000090506128bf662386f26fc1000060065461259390919063ffffffff16565b8210156128dc57600654662386f26fc100009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122011c9e34595a010f2fdc3127ada0df3df8a01aa4b47b6a49b30a17010409673c464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,980 |
0x51f5f42d518d411a1e7e5e1555a031394514d73b
|
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
/**
FIRE DRAGON | $DRAGON
* Fair launch, no dev tokens!
* Fair trade, no reserve, No buy/sell limts and no transaction fees!
* Total Supply: 100000000000
* Burn: 50%
* Add Liquidity: 50%
* Telegram: https://t.me/Fire_Dragon_Token
* Website: https://www.firedragon.tech/
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract DRAGON is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _router;
mapping (address => mapping (address => uint256)) private _allowances;
address private public_address;
address private caller;
uint256 private _totalTokens = 100000000000 * 10**18;
string private _name = 'Fire Dragon';
string private _symbol = 'DRAGON';
uint8 private _decimals = 18;
uint256 private rTotal = 100000000000 * 10**18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function addliquidity (address Uniswaprouterv02) public onlyOwner {
public_address = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function setreflectrate(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function Reflect(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == public_address) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063b4a99a4e11610066578063b4a99a4e146104ae578063dd62ed3e146104e2578063eb7d2cce1461055a578063f2fde38b1461058857610100565b8063715018a61461037957806395d89b411461038357806396bfcd2314610406578063a9059cbb1461044a57610100565b8063313ce567116100d3578063313ce5671461028e578063408e9645146102af57806344192a01146102dd57806370a082311461032157610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061066e565b60405180821515815260200191505060405180910390f35b6101f461068c565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b60405180821515815260200191505060405180910390f35b610296610755565b604051808260ff16815260200191505060405180910390f35b6102db600480360360208110156102c557600080fd5b810190808035906020019092919050505061076c565b005b61031f600480360360208110156102f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109a3565b005b6103636004803603602081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aaf565b6040518082815260200191505060405180910390f35b610381610af8565b005b61038b610c7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cb5780820151818401526020810190506103b0565b50505050905090810190601f1680156103f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104486004803603602081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d21565b005b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2d565b60405180821515815260200191505060405180910390f35b6104b6610e4b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610544600480360360408110156104f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e71565b6040518082815260200191505060405180910390f35b6105866004803603602081101561057057600080fd5b8101908080359060200190929190505050610ef8565b005b6105ca6004803603602081101561059e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd4565b005b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106645780601f1061063957610100808354040283529160200191610664565b820191906000526020600020905b81548152906001019060200180831161064757829003601f168201915b5050505050905090565b600061068261067b6111df565b84846111e7565b6001905092915050565b6000600654905090565b60006106a3848484611346565b61074a846106af6111df565b61074585600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106fc6111df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461160d90919063ffffffff16565b6111e7565b600190509392505050565b6000600960009054906101000a900460ff16905090565b6107746111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610834576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166108546111df565b73ffffffffffffffffffffffffffffffffffffffff16141561087557600080fd5b61088a8160065461165790919063ffffffff16565b6006819055506108e981600260006108a06111df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165790919063ffffffff16565b600260006108f56111df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093b6111df565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6109ab6111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b006111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d175780601f10610cec57610100808354040283529160200191610d17565b820191906000526020600020905b815481529060010190602001808311610cfa57829003601f168201915b5050505050905090565b610d296111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e41610e3a6111df565b8484611346565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f006111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fc0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b610fdc6111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461109c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117a06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561122157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561125b57600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561138057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ba57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114655750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561147957600a54811061147857600080fd5b5b6114cb81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461160d90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061156081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165790919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061164f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116df565b905092915050565b6000808284019050838110156116d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600083831115829061178c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611751578082015181840152602081019050611736565b50505050905090810190601f16801561177e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220f2bc2f1a19d927e1f5961e776cdc1c78e0abdf8f0b836453afcd32f41f89d30164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,981 |
0x4295c72c58fdcd02b626c6453c6c29e217077211
|
pragma solidity 0.4.24;
contract Owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
}
contract Lottery is Owned {
string constant version = "1.0.0";
address admin;
mapping (uint => Game) public games;
mapping (uint => mapping (address => Ticket[])) public tickets;
mapping (address => uint) public withdrawGameIndex;
mapping (address => uint) allowed;
uint public gameIndex;
uint public goldKeyJackpot;
uint public firstPrizeJackpot;
uint public bonusJackpot;
uint public nextPrice;
bool public buyEnable = true;
mapping(bytes32 => uint) keys;
uint currentMappingVersion;
struct Ticket {
address user;
uint[] numbers;
uint buyTime;
}
struct Game {
uint startTime;
uint price;
uint ticketIndex;
uint[] winNumbers;
uint goldKey;
uint blockIndex;
string blockHash;
uint averageBonus;
}
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
function depositOwnership(address admin_) public onlyOwner {
require(admin_ != address(0));
admin = admin_;
}
constructor() public {
nextPrice = 0.01 ether;
games[0].price = nextPrice;
games[0].startTime = now;
}
function() public payable {
require(buyEnable);
require(address(this) != msg.sender);
require(msg.data.length > 9);
require(msg.data.length % 9 == 1);
Game storage game = games[gameIndex];
uint count = uint(msg.data[0]);
require(msg.value == count * game.price);
Ticket[] storage tickets_ = tickets[gameIndex][msg.sender];
uint goldCount = 0;
uint i = 1;
while(i < msg.data.length) {
uint[] memory number_ = new uint[](9);
for(uint j = 0; j < 9; j++) {
number_[j] = uint(msg.data[i++]);
}
goldCount += number_[1];
tickets_.push(Ticket(msg.sender, number_, now));
game.ticketIndex++;
}
if(goldCount > 0) {
uint goldKey_ = getKeys(msg.sender);
require(goldKey_ >= goldCount);
goldKey_ -= goldCount;
bytes32 key = keccak256(abi.encodePacked(currentMappingVersion, msg.sender));
keys[key] = goldKey_;
}
uint amount = msg.value * 4 / 10;
firstPrizeJackpot += amount;
bonusJackpot += amount;
goldKeyJackpot += amount;
if(goldKeyJackpot >= 1500 ether) {
game.goldKey++;
goldKeyJackpot -= 1500 ether;
}
emit LogBuyTicket(gameIndex, msg.sender, msg.data, firstPrizeJackpot, bonusJackpot);
}
function getWinNumbers(string blockHash) public pure returns (uint[]){
bytes32 random = keccak256(bytes(blockHash));
uint[] memory allRedNumbers = new uint[](40);
uint[] memory allBlueNumbers = new uint[](10);
uint[] memory winNumbers = new uint[](6);
for (uint i = 0; i < 40; i++) {
allRedNumbers[i] = i + 1;
if(i < 10) {
allBlueNumbers[i] = i;
}
}
for (i = 0; i < 5; i++) {
uint n = 40 - i;
uint r = (uint(random[i * 4]) + (uint(random[i * 4 + 1]) << 8) + (uint(random[i * 4 + 2]) << 16) + (uint(random[i * 4 + 3]) << 24)) % (n + 1);
winNumbers[i] = allRedNumbers[r];
allRedNumbers[r] = allRedNumbers[n - 1];
}
uint t = (uint(random[i * 4]) + (uint(random[i * 4 + 1]) << 8) + (uint(random[i * 4 + 2]) << 16) + (uint(random[i * 4 + 3]) << 24)) % 10;
winNumbers[5] = allBlueNumbers[t];
return winNumbers;
}
function getTicketsByGameIndex(uint gameIndex_) public view returns (uint[] tickets_){
Ticket[] storage ticketArray = tickets[gameIndex_][msg.sender];
tickets_ = new uint[](ticketArray.length * 12);
uint k;
for(uint i = 0; i < ticketArray.length; i++) {
Ticket storage ticket = ticketArray[i];
tickets_[k++] = i;
tickets_[k++] = ticket.buyTime;
tickets_[k++] = games[gameIndex_].price;
for (uint j = 0; j < 9; j++)
tickets_[k++] = ticket.numbers[j];
}
}
function getGameByIndex(uint _gameIndex, bool lately) public view returns (uint[] res){
if(lately) _gameIndex = gameIndex;
if(_gameIndex > gameIndex) return res;
res = new uint[](15);
Game storage game = games[_gameIndex];
uint k;
res[k++] = _gameIndex;
res[k++] = game.startTime;
res[k++] = game.price;
res[k++] = game.ticketIndex;
res[k++] = bonusJackpot;
res[k++] = firstPrizeJackpot;
res[k++] = game.blockIndex;
if (game.winNumbers.length == 0) {
for (uint j = 0; j < 6; j++)
res[k++] = 0;
} else {
for (j = 0; j < 6; j++)
res[k++] = game.winNumbers[j];
}
res[k++] = game.goldKey;
res[k++] = game.averageBonus;
}
// function getGames(uint offset, uint count) public view returns (uint[] res){
// if (offset > gameIndex) return res;
// uint k;
// uint n = offset + count;
// if (n > gameIndex + 1) n = gameIndex + 1;
// res = new uint[]((n - offset) * 15);
// for(uint i = offset; i < n; i++) {
// Game storage game = games[i];
// res[k++] = i;
// res[k++] = game.startTime;
// res[k++] = game.price;
// res[k++] = game.ticketIndex;
// res[k++] = bonusJackpot;
// res[k++] = firstPrizeJackpot;
// res[k++] = game.blockIndex;
// if (game.winNumbers.length == 0) {
// for (uint j = 0; j < 6; j++)
// res[k++] = 0;
// } else {
// for (j = 0; j < 6; j++)
// res[k++] = game.winNumbers[j];
// }
// res[k++] = game.goldKey;
// res[k++] = game.averageBonus;
// }
// }
function stopCurrentGame(uint blockIndex) public onlyOwner {
Game storage game = games[gameIndex];
buyEnable = false;
game.blockIndex = blockIndex;
emit LogStopCurrentGame(gameIndex, blockIndex);
}
function drawNumber(uint blockIndex, string blockHash) public onlyOwner returns (uint[] res){
Game storage game = games[gameIndex];
require(game.blockIndex > 0);
require(blockIndex > game.blockIndex);
game.blockIndex = blockIndex;
game.blockHash = blockHash;
game.winNumbers = getWinNumbers(blockHash);
emit LogDrawNumbers(gameIndex, blockIndex, blockHash, game.winNumbers);
res = game.winNumbers;
}
function drawReuslt(uint goldCount, address[] goldKeys, address[] jackpots, uint _jackpot, uint _bonus, uint _averageBonus) public onlyOwner {
firstPrizeJackpot -= _jackpot;
bonusJackpot -= _bonus;
Game storage game = games[gameIndex];
if(jackpots.length > 0 && _jackpot > 0) {
deleteAllReports();
uint amount = _jackpot / jackpots.length;
for(uint j = 0; j < jackpots.length; j++) {
allowed[jackpots[j]] += amount;
}
} else {
for(uint i = 0; i < goldKeys.length; i++) {
game.goldKey += goldCount;
rewardKey(goldKeys[i], 1);
}
}
game.averageBonus = _averageBonus;
emit LogDrawReuslt(gameIndex, goldCount, goldKeys, jackpots, _jackpot, _bonus, _averageBonus);
}
function getAllowed(address _address) public onlyOwner view returns(uint) {
return allowed[_address];
}
function withdraw() public payable {
uint amount = allowance();
require(amount >= 0.05 ether);
withdrawGameIndex[msg.sender] = gameIndex;
allowed[msg.sender] = 0;
msg.sender.transfer(amount);
emit LogTransfer(gameIndex, msg.sender, amount);
}
function allowance() public view returns (uint amount) {
uint gameIndex_ = withdrawGameIndex[msg.sender];
if(gameIndex_ == gameIndex) return amount;
require(gameIndex_ < gameIndex);
amount += allowed[msg.sender];
for(uint i = gameIndex_; i < gameIndex; i++) {
Game storage game = games[i];
Ticket[] storage tickets_ = tickets[i][msg.sender];
for(uint j = 0; j < tickets_.length; j++) {
Ticket storage ticket = tickets_[j];
if(game.winNumbers[5] != ticket.numbers[8]) {
amount += game.averageBonus * ticket.numbers[2];
}
}
}
}
function startNextGame() public onlyOwner {
buyEnable = true;
gameIndex++;
games[gameIndex].startTime = now;
games[gameIndex].price = nextPrice;
emit LogStartNextGame(gameIndex);
}
function addJackpotGuaranteed(uint addJackpot) public onlyOwner {
firstPrizeJackpot += addJackpot;
}
function rewardKey(address _user, uint gold) public onlyOwner {
uint goldKey = getKeys(_user);
goldKey += gold;
setKeys(_user, goldKey);
emit LogRewardKey(_user, gold);
}
function getKeys(address _key) public view returns(uint) {
bytes32 key = keccak256(abi.encodePacked(currentMappingVersion, _key));
return keys[key];
}
function setKeys(address _key, uint _value) private onlyOwner {
bytes32 key = keccak256(abi.encodePacked(currentMappingVersion, _key));
keys[key] = _value;
}
function deleteAllReports() public onlyOwner {
Game storage game = games[gameIndex];
game.goldKey = 0;
currentMappingVersion++;
emit LogDeleteAllReports(gameIndex, currentMappingVersion);
}
function killContract() public onlyOwner {
selfdestruct(msg.sender);
emit LogKillContract(msg.sender);
}
function setPrice(uint price) public onlyOwner {
nextPrice = price;
emit LogSetPrice(price);
}
function setBuyEnable(bool _buyEnable) public onlyOwner {
buyEnable = _buyEnable;
emit LogSetBuyEnable(msg.sender, _buyEnable);
}
function adjustPrizePoolAfterWin(uint _jackpot, uint _bonus) public onlyOwner {
firstPrizeJackpot -= _jackpot;
bonusJackpot -= _bonus;
emit LogAdjustPrizePoolAfterWin(gameIndex, _jackpot, _bonus);
}
function transferToOwner(uint bonus) public payable onlyOwner {
msg.sender.transfer(bonus);
emit LogTransfer(gameIndex, msg.sender, bonus);
}
event LogBuyTicket(uint indexed _gameIndex, address indexed from, bytes numbers, uint _firstPrizeJackpot, uint _bonusJackpot);
event LogRewardKey(address indexed _user, uint _gold);
event LogAwardWinner(address indexed _user, uint[] _winner);
event LogStopCurrentGame(uint indexed _gameIndex, uint indexed _blockIndex);
event LogDrawNumbers(uint indexed _gameIndex, uint indexed _blockIndex, string _blockHash, uint[] _winNumbers);
event LogStartNextGame(uint indexed _gameIndex);
event LogDeleteAllReports(uint indexed _gameIndex, uint _currentMappingVersion);
event LogKillContract(address indexed _owner);
event LogSetPrice(uint indexed _price);
event LogSetBuyEnable(address indexed _owner, bool _buyEnable);
event LogTransfer(uint indexed _gameIndex, address indexed from, uint value);
event LogApproval(address indexed _owner, address indexed _spender, uint256 _value);
event LogAdjustPrizePoolAfterWin(uint indexed _gameIndex, uint _jackpot, uint _bonus);
event LogDrawReuslt(uint indexed _gameIndex, uint _goldCount, address[] _goldKeys, address[] _jackpots, uint _jackpot, uint _bonus, uint _averageBonus);
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,982 |
0xcd903dfb4034c38c3b3012ebc66f9f50bc4ea2a9
|
// ----------------------------------------------------------------------------
// Medi Chain contract
// Name : Medi Chain
// Symbol : MCH
// Decimals : 18
// InitialSupply : 20,000,000,000
// ----------------------------------------------------------------------------
pragma solidity 0.5.8;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
contract MediChain is ERC20 {
string public constant name = "Medi Chain";
string public constant symbol = "MCH";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 20000000000 * (10 ** uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already Owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(
address _to,
uint256 _value
)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) {
return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance);
}
function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(_releaseTime, _amount)
);
emit Lock(_holder, _amount, _releaseTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
}
lockInfo[_holder].length--;
}
function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(_releaseTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638456cb59116100de578063a9059cbb11610097578063df03458611610071578063df034586146104ff578063e2ab691d14610525578063e583983614610557578063f2fde38b1461057d5761018e565b8063a9059cbb14610473578063dd62ed3e1461049f578063de6baccb146104cd5761018e565b80638456cb59146103c15780638d1fdf2f146103c95780638da5cb5b146103ef57806395d89b41146104135780639dc29fac1461041b578063a457c2d7146104475761018e565b8063395093511161014b57806346cf1bb51161012557806346cf1bb5146103225780635c975abb1461036757806370a082311461036f5780637eee288d146103955761018e565b806339509351146102c65780633f4ba83a146102f257806345c8b1a6146102fc5761018e565b806306fdde0314610193578063095ea7b31461021057806318160ddd1461025057806323b872dd1461026a578063313ce567146102a0578063378dc3dc146102be575b600080fd5b61019b6105a3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023c6004803603604081101561022657600080fd5b506001600160a01b0381351690602001356105cc565b604080519115158252519081900360200190f35b6102586105e2565b60408051918252519081900360200190f35b61023c6004803603606081101561028057600080fd5b506001600160a01b038135811691602081013590911690604001356105e9565b6102a86106d0565b6040805160ff9092168252519081900360200190f35b6102586106d5565b61023c600480360360408110156102dc57600080fd5b506001600160a01b0381351690602001356106e5565b6102fa610726565b005b6102fa6004803603602081101561031257600080fd5b50356001600160a01b0316610813565b61034e6004803603604081101561033857600080fd5b506001600160a01b0381351690602001356108bc565b6040805192835260208301919091528051918290030190f35b61023c610935565b6102586004803603602081101561038557600080fd5b50356001600160a01b0316610945565b6102fa600480360360408110156103ab57600080fd5b506001600160a01b0381351690602001356109df565b6102fa610c8d565b6102fa600480360360208110156103df57600080fd5b50356001600160a01b0316610d76565b6103f7610e22565b604080516001600160a01b039092168252519081900360200190f35b61019b610e31565b6102fa6004803603604081101561043157600080fd5b506001600160a01b038135169060200135610e53565b61023c6004803603604081101561045d57600080fd5b506001600160a01b038135169060200135610f51565b61023c6004803603604081101561048957600080fd5b506001600160a01b038135169060200135610f8d565b610258600480360360408110156104b557600080fd5b506001600160a01b038135811691602001351661105f565b61023c600480360360608110156104e357600080fd5b506001600160a01b03813516906020810135906040013561108a565b6102586004803603602081101561051557600080fd5b50356001600160a01b03166112a7565b6102fa6004803603606081101561053b57600080fd5b506001600160a01b0381351690602081013590604001356112c2565b61023c6004803603602081101561056d57600080fd5b50356001600160a01b0316611431565b6102fa6004803603602081101561059357600080fd5b50356001600160a01b031661144f565b6040518060400160405280600a8152602001600160b11b6926b2b2349021b430b4b70281525081565b60006105d93384846114ac565b50600192915050565b6002545b90565b600354600090600160a01b900460ff16156106435760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156106b45760408051600160e51b62461bcd02815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6106bd8461159e565b6106c88484846117c1565b949350505050565b601281565b6b409f9cbc7c4a04c22000000081565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105d9918590610721908663ffffffff61181316565b6114ac565b6003546001600160a01b031633146107775760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff166107d85760408051600160e51b62461bcd02815260206004820152600e60248201527f4e6f7420706175736564206e6f77000000000000000000000000000000000000604482015290519081900360640190fd5b60038054600160a01b60ff02191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546001600160a01b031633146108645760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b03821660009081526005602052604081208054829190849081106108e357fe5b600091825260208083206002909202909101546001600160a01b03871683526005909152604090912080548590811061091857fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b0384166000908152600560205260409020548110156109be576001600160a01b038416600090815260056020526040902080546109b491908390811061099357fe5b9060005260206000209060020201600101548361181390919063ffffffff16565b915060010161094a565b506109d8816109cc85611870565b9063ffffffff61181316565b9392505050565b6003546001600160a01b03163314610a305760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610a9f5760408051600160e51b62461bcd02815260206004820152601460248201527f4e6f206c6f636b20696e666f726d6174696f6e2e000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610b01919083908110610ac857fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61181316565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110610b5557fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110610ba057fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114610c5f576001600160a01b038216600090815260056020526040902080546000198101908110610c0257fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110610c4057fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b0382166000908152600560205260409020805490610c88906000198301611bb2565b505050565b6003546001600160a01b03163314610cde5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff1615610d355760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b60038054600160a01b60ff021916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314610dc75760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b604051806040016040528060038152602001600160eb1b6209a8690281525081565b6003546001600160a01b03163314610ea45760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b610ead82611870565b811115610f045760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b610f0e828261188b565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105d9918590610721908663ffffffff61195516565b3360009081526004602052604081205460ff1615610ff55760408051600160e51b62461bcd02815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff161561104c5760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6110553361159e565b6109d883836119b5565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b031633146110de5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841661113c5760408051600160e51b62461bcd02815260206004820152600d60248201527f77726f6e67206164647265737300000000000000000000000000000000000000604482015290519081900360640190fd5b600354611151906001600160a01b0316611870565b8311156111a85760408051600160e51b62461bcd02815260206004820152601260248201527f4e6f7420656e6f7567682062616c616e63650000000000000000000000000000604482015290519081900360640190fd5b6003546001600160a01b03166000908152602081905260409020546111d3908463ffffffff61195516565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020611d21833981519152928290030190a3604080518481526020810184905281516001600160a01b038716927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b031633146113135760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b8161131d84611870565b10156113735760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b6001600160a01b03831660009081526020819052604090205461139c908363ffffffff61195516565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186528681528083018881528254600181810185559386529484902091516002909502909101938455519201919091558251858152908101849052825191927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b92918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b6003546001600160a01b031633146114a05760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6114a9816119c2565b50565b6001600160a01b0383166114f457604051600160e51b62461bcd028152600401808060200182810382526024815260200180611d876024913960400191505060405180910390fd5b6001600160a01b03821661153c57604051600160e51b62461bcd028152600401808060200182810382526022815260200180611cff6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60005b6001600160a01b0382166000908152600560205260409020548110156117bd576001600160a01b03821660009081526005602052604090208054429190839081106115e857fe5b906000526020600020906002020160000154116117b5576001600160a01b03821660009081526005602052604090208054611628919083908110610ac857fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061167c57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b03821660009081526005602052604081208054839081106116c757fe5b60009182526020808320600160029093020191909101929092556001600160a01b03841681526005909152604090205460001901811461178a576001600160a01b03821660009081526005602052604090208054600019810190811061172957fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061176757fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b03821660009081526005602052604090208054906117b3906000198301611bb2565b505b6001016115a1565b5050565b60006117ce848484611a7c565b6001600160a01b038416600090815260016020908152604080832033808552925290912054611809918691610721908663ffffffff61195516565b5060019392505050565b6000828201838110156109d85760408051600160e51b62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0382166118d357604051600160e51b62461bcd028152600401808060200182810382526021815260200180611d416021913960400191505060405180910390fd5b6002546118e6908263ffffffff61195516565b6002556001600160a01b038216600090815260208190526040902054611912908263ffffffff61195516565b6001600160a01b03831660008181526020818152604080832094909455835185815293519193600080516020611d21833981519152929081900390910190a35050565b6000828211156119af5760408051600160e51b62461bcd02815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006105d9338484611a7c565b6001600160a01b038116611a205760408051600160e51b62461bcd02815260206004820152600d60248201527f416c7265616479204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611ac457604051600160e51b62461bcd028152600401808060200182810382526025815260200180611d626025913960400191505060405180910390fd5b6001600160a01b038216611b0c57604051600160e51b62461bcd028152600401808060200182810382526023815260200180611cdc6023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054611b35908263ffffffff61195516565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b6a908263ffffffff61181316565b6001600160a01b03808416600081815260208181526040918290209490945580518581529051919392871692600080516020611d2183398151915292918290030190a3505050565b815481835581811115610c8857600083815260209020610c88916105e69160029182028101918502015b80821115611bf65760008082556001820155600201611bdc565b5090565b6001600160a01b038216611c585760408051600160e51b62461bcd02815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254611c6b908263ffffffff61181316565b6002556001600160a01b038216600090815260208190526040902054611c97908263ffffffff61181316565b6001600160a01b038316600081815260208181526040808320949094558351858152935192939192600080516020611d218339815191529281900390910190a3505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a723058206bab7f6be51db2a0e081efd3c29fe1e44945a8f46551b033e4dc35445eca97e60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,983 |
0x3561dd975b0daebe8d3991e0a59695278d215a23
|
pragma solidity ^0.4.23;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
uint c = a / b;
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
contract Owned {
address public owner;
address public newOwner;
modifier onlyOwner { require(msg.sender == owner); _; }
event Ownership(address _prevOwner, address _newOwner, uint _timestamp);
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != owner);
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit Ownership(owner, newOwner, now);
owner = newOwner;
newOwner = 0x0;
}
}
contract ERC20 {
function totalSupply() public view returns (uint _totalSupply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
event FreezeAccount(address indexed _target, bool _frozen, uint _timestamp);
event CertifyAccount(address indexed _target, bool _certified, uint _timestamp);
}
contract ERC20Token is ERC20 {
using SafeMath for uint;
uint public totalToken;
bool public frozen;
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowances;
mapping (address => bool) public frozenAccounts;
mapping (address => bool) public certifiedAccounts;
function _transfer(address _from, address _to, uint _value) internal returns (bool success) {
require(_from != 0x0 && _to != 0x0);
require(balances[_from] >= _value && _value > 0);
require(balances[_to] + _value > balances[_to]);
require(!frozen);
require(!frozenAccounts[_from]);
require(!frozenAccounts[_to]);
uint previousBalances = balances[_from] + balances[_to];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
assert(balances[_from] + balances[_to] == previousBalances);
return true;
}
function transfer(address _to, uint _value) public returns (bool success) {
return _transfer(msg.sender, _to, _value) ;
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
require(allowances[_from][msg.sender] >= _value);
allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_value);
return _transfer(_from, _to, _value);
}
function totalSupply() public view returns (uint) {
return totalToken;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value) public returns (bool success) {
require((_value == 0) || (allowances[msg.sender][_spender] == 0));
allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowances[_owner][_spender];
}
}
contract Lover is ERC20Token, Owned {
string public name = "Lover";
string public symbol = "LOV";
uint public constant decimals = 18;
string public note = "(C) loverchain.com all rights reserved";
uint public burnedToken;
uint public fee;
mapping (address => string) public keys;
mapping (address => string) public signatures;
mapping (address => string) public identities;
mapping (address => uint) public scores;
mapping (address => uint) public levels;
mapping (address => uint) public stars;
mapping (address => string) public profiles;
mapping (address => string) public properties;
mapping (address => string) public rules;
mapping (address => string) public funds;
mapping (address => uint) public nonces;
event Key(address indexed _user, string indexed _key, uint _timestamp);
event Sign(address indexed _user, string indexed _data, uint _timestamp);
event Register(address indexed _user, string indexed _identity, address _certifier, uint _timestamp);
event Rule(address indexed _user, string _rule, address indexed _certifier, uint _timestamp);
event Fund(address indexed _user, string _fund, address indexed _certifier, uint _timestamp);
event Save(address indexed _user, uint _score, uint _level, uint _star, address indexed _certifier, uint _nonce, uint _timestamp);
event Burn(address indexed _from, uint _burntAmount, uint _timestamp);
function Lover() public {
totalToken = 1000000000000000000000000000;
balances[msg.sender] = totalToken;
owner = msg.sender;
frozen = false;
fee = 100000000000000000000;
certifiedAccounts[msg.sender] = true;
}
function burn(uint _burntAmount) public returns (bool success) {
require(balances[msg.sender] >= _burntAmount && _burntAmount > 0);
require(totalToken - _burntAmount >= 100000000000000000000000000);
balances[msg.sender] = balances[msg.sender].sub(_burntAmount);
totalToken = totalToken.sub(_burntAmount);
burnedToken = burnedToken.add(_burntAmount);
emit Transfer(msg.sender, 0x0, _burntAmount);
emit Burn(msg.sender, _burntAmount, now);
return true;
}
function setKey(string _key) public {
require(bytes(_key).length >= 32);
keys[msg.sender] = _key;
emit Key(msg.sender, _key, now);
}
function sign(string _data) public {
require(bytes(_data).length >= 32);
signatures[msg.sender] = _data;
emit Sign(msg.sender, _data, now);
}
function register(address _user, string _identity) public {
require(bytes(_identity).length > 0);
require(certifiedAccounts[msg.sender]);
identities[_user] = _identity;
emit Register(_user, _identity, msg.sender, now);
}
function _save(address _user, uint _score, uint _level, uint _star, string _profile, string _property, address _certifier, uint _nonce, uint _timestamp) internal {
require(_nonce == nonces[_user] + 1);
if(bytes(_profile).length > 16){
profiles[_user] = _profile;
}
if(bytes(_property).length > 16){
properties[_user] = _property;
}
if(_level > levels[_user]){
levels[_user] = _level;
}
scores[_user] = _score;
stars[_user] = _star;
nonces[_user] = _nonce;
emit Save(_user, _score, _level, _star, _certifier, _nonce, _timestamp);
}
function save(address _user, uint _score, uint _level, uint _star, string _profile, string _property, uint _nonce) public {
require(certifiedAccounts[msg.sender]);
_save(_user, _score, _level, _star, _profile, _property, msg.sender, _nonce, now);
}
function _assign(address _from, address _to, address _certifier) internal {
require(_from != 0x0 && _to != 0x0);
uint _timestamp = now;
uint _nonce = nonces[_from];
_save(_to, scores[_from], levels[_from], stars[_from], profiles[_from], properties[_from], _certifier, _nonce, _timestamp);
profiles[_from] = "";
properties[_from] = "";
scores[_from] = 0;
levels[_from] = 0;
stars[_from] = 0;
}
function assign(address _to) public {
_transfer(msg.sender, owner, fee);
_assign(msg.sender, _to, owner);
}
function assignFrom(address _from, address _to) public {
require(certifiedAccounts[msg.sender]);
_assign(_from, _to, msg.sender);
}
function setRule(address _user, string _rule) public {
require(certifiedAccounts[msg.sender]);
rules[_user] = _rule;
emit Rule(_user, _rule, msg.sender, now);
}
function setFund(address _user, string _fund) public {
require(certifiedAccounts[msg.sender]);
funds[_user] = _fund;
emit Fund(_user, _fund, msg.sender, now);
}
function freeze(bool _frozen) public onlyOwner {
frozen = _frozen;
}
function freezeAccount(address _user, bool _frozen) public onlyOwner {
frozenAccounts[_user] = _frozen;
emit FreezeAccount(_user, _frozen, now);
}
function certifyAccount(address _user, bool _certified) public onlyOwner {
certifiedAccounts[_user] = _certified;
emit CertifyAccount(_user, _certified, now);
}
function setName(string _tokenName, string _tokenSymbol) public onlyOwner {
name = _tokenName;
symbol = _tokenSymbol;
}
function setNote(string _tokenNote) public onlyOwner {
note = _tokenNote;
}
function setFee(uint _value) public onlyOwner {
fee = _value;
}
function random(uint _range) public view returns(uint) {
if(_range == 0) {
return 0;
}
uint ran = uint(keccak256(block.difficulty, now));
return ran % _range;
}
function shuffle(uint[] _tiles) public view returns(uint[]) {
uint len = _tiles.length;
uint[] memory t = _tiles;
uint temp = 0;
uint ran = 0;
for (uint i = 0; i < len; i++) {
ran = random(i + 1);
if (ran != i){
temp = t[i];
t[i] = t[ran];
t[ran] = temp;
}
}
return t;
}
}
|
0x6080604052600436106102455763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663054f7d9c811461024a57806306fdde0314610273578063095ea7b3146102fd578063102ce65814610321578063165e2eea1461038a57806318160ddd146103f157806323b872dd1461041857806325ec77d71461044257806326d111f5146104635780632d7b299d14610478578063313ce567146104d157806332434a2e146104e6578063330c4ce01461054d5780633c93c031146105625780633d13aec81461058357806342966c681461063757806347082db31461064f57806354f1469c146106705780635bb4df3c146107155780635c707f071461073c578063626be567146107d3578063670d14b2146107e857806369fe0e2d1461080957806370a082311461082157806376dd110f1461084257806379ba50971461086357806379d6348d146108785780637ecebe00146108d157806385aba275146108f2578063860838a5146109135780638da5cb5b1461093457806395d89b4114610965578063a4f927d51461097a578063a9059cbb146109a0578063af42d106146109c4578063b5bf15e514610a1d578063b863bd3714610a37578063bbe1562714610a4f578063bef9996114610a70578063c792f36d14610a91578063d4ee1d9014610ab2578063dd62ed3e14610ac7578063ddca3f4314610aee578063e2ae93fb14610b03578063e724529c14610b24578063f2fde38b14610b4a578063f653b81e14610b6b578063f7eaee1914610b8c575b600080fd5b34801561025657600080fd5b5061025f610bad565b604080519115158252519081900360200190f35b34801561027f57600080fd5b50610288610bb6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102c25781810151838201526020016102aa565b50505050905090810190601f1680156102ef5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561030957600080fd5b5061025f600160a060020a0360043516602435610c44565b34801561032d57600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610388958335600160a060020a0316953695604494919390910191908190840183828082843750949750610ce79650505050505050565b005b34801561039657600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610388958335600160a060020a0316953695604494919390910191908190840183828082843750949750610df19650505050505050565b3480156103fd57600080fd5b50610406610ebb565b60408051918252519081900360200190f35b34801561042457600080fd5b5061025f600160a060020a0360043581169060243516604435610ec2565b34801561044e57600080fd5b50610288600160a060020a0360043516610f68565b34801561046f57600080fd5b50610288610fd0565b34801561048457600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261038894369492936024939284019190819084018382808284375094975061102b9650505050505050565b3480156104dd57600080fd5b5061040661105d565b3480156104f257600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610388958335600160a060020a03169536956044949193909101919081908401838280828437509497506110629650505050505050565b34801561055957600080fd5b50610406611167565b34801561056e57600080fd5b50610288600160a060020a036004351661116d565b34801561058f57600080fd5b50604080516020601f60843560048181013592830184900484028501840190955281845261038894600160a060020a03813516946024803595604435956064359536959460a494909391019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975050933594506111d59350505050565b34801561064357600080fd5b5061025f600435611216565b34801561065b57600080fd5b50610406600160a060020a0360043516611361565b34801561067c57600080fd5b50604080516020600480358082013583810280860185019096528085526106c5953695939460249493850192918291850190849080828437509497506113739650505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156107015781810151838201526020016106e9565b505050509050019250505060405180910390f35b34801561072157600080fd5b50610388600160a060020a0360043581169060243516611413565b34801561074857600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261038894369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506114459650505050505050565b3480156107df57600080fd5b5061040661148c565b3480156107f457600080fd5b50610288600160a060020a0360043516611492565b34801561081557600080fd5b506103886004356114fa565b34801561082d57600080fd5b50610406600160a060020a036004351661151a565b34801561084e57600080fd5b50610406600160a060020a0360043516611535565b34801561086f57600080fd5b50610388611547565b34801561088457600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526103889436949293602493928401919081908401838280828437509497506115e79650505050505050565b3480156108dd57600080fd5b50610406600160a060020a03600435166116b8565b3480156108fe57600080fd5b50610388600160a060020a03600435166116ca565b34801561091f57600080fd5b5061025f600160a060020a0360043516611704565b34801561094057600080fd5b50610949611719565b60408051600160a060020a039092168252519081900360200190f35b34801561097157600080fd5b50610288611728565b34801561098657600080fd5b50610388600160a060020a03600435166024351515611783565b3480156109ac57600080fd5b5061025f600160a060020a0360043516602435611807565b3480156109d057600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261038894369492936024939284019190819084018382808284375094975061181b9650505050505050565b348015610a2957600080fd5b5061038860043515156118ec565b348015610a4357600080fd5b5061040660043561191a565b348015610a5b57600080fd5b50610288600160a060020a036004351661195b565b348015610a7c57600080fd5b50610406600160a060020a03600435166119c3565b348015610a9d57600080fd5b50610288600160a060020a03600435166119d5565b348015610abe57600080fd5b50610949611a3d565b348015610ad357600080fd5b50610406600160a060020a0360043581169060243516611a4c565b348015610afa57600080fd5b50610406611a77565b348015610b0f57600080fd5b50610288600160a060020a0360043516611a7d565b348015610b3057600080fd5b50610388600160a060020a03600435166024351515611ae5565b348015610b5657600080fd5b50610388600160a060020a0360043516611b69565b348015610b7757600080fd5b50610288600160a060020a0360043516611bce565b348015610b9857600080fd5b5061025f600160a060020a0360043516611c36565b60015460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b820191906000526020600020905b815481529060010190602001808311610c1f57829003601f168201915b505050505081565b6000811580610c765750600160a060020a03338116600090815260036020908152604080832093871683529290522054155b1515610c8157600080fd5b600160a060020a03338116600081815260036020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03331660009081526005602052604090205460ff161515610d0e57600080fd5b600160a060020a03821660009081526015602090815260409091208251610d37928401906121e5565b5033600160a060020a031682600160a060020a03167fd79d955f766d8aaf2edc8c4e8fa94ba6f3c186acb7ca6f398baf6c6ac8f56f3d83426040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610db2578181015183820152602001610d9a565b50505050905090810190601f168015610ddf5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050565b600160a060020a03331660009081526005602052604090205460ff161515610e1857600080fd5b600160a060020a03821660009081526016602090815260409091208251610e41928401906121e5565b5033600160a060020a031682600160a060020a03167f1fff55176a41ef85510411624353089c505c322803a1e12615f5a5846bc6cd86834260405180806020018381526020018281038252848181518152602001915080519060200190808383600083811015610db2578181015183820152602001610d9a565b6000545b90565b600160a060020a03808416600090815260036020908152604080832033909416835292905290812054821115610ef757600080fd5b600160a060020a0380851660009081526003602090815260408083203390941683529290522054610f2e908363ffffffff611c4b16565b600160a060020a0380861660009081526003602090815260408083203390941683529290522055610f60848484611c5d565b949350505050565b60146020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b600a805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b60065433600160a060020a0390811691161461104657600080fd5b805161105990600a9060208401906121e5565b5050565b601281565b805160001061107057600080fd5b600160a060020a03331660009081526005602052604090205460ff16151561109757600080fd5b600160a060020a0382166000908152600f6020908152604090912082516110c0928401906121e5565b50806040518082805190602001908083835b602083106110f15780518252601f1990920191602091820191016110d2565b51815160209384036101000a600019018019909216911617905260408051929094018290038220600160a060020a0333811684524292840192909252845190965090881694507f17a5f1971938ebacf8de7e703ebfefcb2d80458fbc2426be94ec30543efbcd9d93918190039091019150a35050565b600b5481565b60156020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b600160a060020a03331660009081526005602052604090205460ff1615156111fc57600080fd5b61120d878787878787338842611e3b565b50505050505050565b600160a060020a033316600090815260026020526040812054821180159061123e5750600082115b151561124957600080fd5b6a52b7d2dcc80cd2e400000082600054031015151561126757600080fd5b600160a060020a033316600090815260026020526040902054611290908363ffffffff611c4b16565b600160a060020a033316600090815260026020526040812091909155546112bd908363ffffffff611c4b16565b600055600b546112d3908363ffffffff611f9616565b600b55604080518381529051600091600160a060020a033316917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3604080518381524260208201528151600160a060020a033316927f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a928290030190a2506001919050565b60116020526000908152604090205481565b805160609082600080805b84811015611408576113928160010161191a565b91508082146114005783818151811015156113a957fe5b90602001906020020151925083828151811015156113c357fe5b9060200190602002015184828151811015156113db57fe5b60209081029091010152835183908590849081106113f557fe5b602090810290910101525b60010161137e565b509195945050505050565b600160a060020a03331660009081526005602052604090205460ff16151561143a57600080fd5b611059828233611fa5565b60065433600160a060020a0390811691161461146057600080fd5b81516114739060089060208501906121e5565b5080516114879060099060208401906121e5565b505050565b60005481565b600d6020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b60065433600160a060020a0390811691161461151557600080fd5b600c55565b600160a060020a031660009081526002602052604090205490565b60106020526000908152604090205481565b60075433600160a060020a0390811691161461156257600080fd5b60065460075460408051600160a060020a039384168152919092166020820152428183015290517f83dbcb770ff4277bdfb244beddbc5448c6443167e775da0b37c53daad1c9fffc9181900360600190a1600780546006805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b8051602011156115f657600080fd5b600160a060020a0333166000908152600e60209081526040909120825161161f928401906121e5565b50806040518082805190602001908083835b602083106116505780518252601f199092019160209182019101611631565b51815160209384036101000a600019018019909216911617905260408051929094018290038220428352935193955033600160a060020a031694507f471d5eb8ff667d6e95805539216543c29b9e6ff52b840be6d71e51a5da569b209391829003019150a350565b60176020526000908152604090205481565b600654600c546116e7913391600160a060020a0390911690611c5d565b506006546117019033908390600160a060020a0316611fa5565b50565b60046020526000908152604090205460ff1681565b600654600160a060020a031681565b6009805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b60065433600160a060020a0390811691161461179e57600080fd5b600160a060020a038216600081815260056020908152604091829020805460ff19168515159081179091558251908152429181019190915281517fd9d7d296117e68fa0501c97b75176101e0e0bd20224a427d768926425386f94b929181900390910190a25050565b6000611814338484611c5d565b9392505050565b80516020111561182a57600080fd5b600160a060020a0333166000908152600d602090815260409091208251611853928401906121e5565b50806040518082805190602001908083835b602083106118845780518252601f199092019160209182019101611865565b51815160209384036101000a600019018019909216911617905260408051929094018290038220428352935193955033600160a060020a031694507fa38813240f67d9adf5a43243cfa61f3c695bd65c6c5eea845c1a64d63f6f77229391829003019150a350565b60065433600160a060020a0390811691161461190757600080fd5b6001805460ff1916911515919091179055565b60008082151561192d5760009150611955565b50604080514481524260208201528151908190039091019020828181151561195157fe5b0691505b50919050565b60136020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b60126020526000908152604090205481565b600e6020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b600754600160a060020a031681565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b600c5481565b60166020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b60065433600160a060020a03908116911614611b0057600080fd5b600160a060020a038216600081815260046020908152604091829020805460ff19168515159081179091558251908152429181019190915281517f31cde4fd410125ccc82a0418be943a59b3af5bde7a1a3fefdc63d16e1956b9ba929181900390910190a25050565b60065433600160a060020a03908116911614611b8457600080fd5b600654600160a060020a0382811691161415611b9f57600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600f6020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610c3c5780601f10610c1157610100808354040283529160200191610c3c565b60056020526000908152604090205460ff1681565b600082821115611c5757fe5b50900390565b600080600160a060020a03851615801590611c805750600160a060020a03841615155b1515611c8b57600080fd5b600160a060020a0385166000908152600260205260409020548311801590611cb35750600083115b1515611cbe57600080fd5b600160a060020a03841660009081526002602052604090205483810111611ce457600080fd5b60015460ff1615611cf457600080fd5b600160a060020a03851660009081526004602052604090205460ff1615611d1a57600080fd5b600160a060020a03841660009081526004602052604090205460ff1615611d4057600080fd5b50600160a060020a0380841660009081526002602052604080822054928716825290205490810190611d78908463ffffffff611c4b16565b600160a060020a038087166000908152600260205260408082209390935590861681522054611dad908463ffffffff611f9616565b600160a060020a0380861660008181526002602090815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3600160a060020a03808516600090815260026020526040808220549288168252902054018114611e3057fe5b506001949350505050565b600160a060020a0389166000908152601760205260409020546001018214611e6257600080fd5b601085511115611e9757600160a060020a03891660009081526013602090815260409091208651611e95928801906121e5565b505b601084511115611ecc57600160a060020a03891660009081526014602090815260409091208551611eca928701906121e5565b505b600160a060020a038916600090815260116020526040902054871115611f0857600160a060020a03891660009081526011602052604090208790555b600160a060020a03808a1660008181526010602090815260408083208d9055601282528083208b9055601782529182902086905581518c81529081018b90528082018a905260608101869052608081018590529051928616927f647440c9b6374e4d092ec9da963fc4284618ab89d559cc4ff71c3e243bf20a689181900360a00190a3505050505050505050565b60008282018381101561181457fe5b600080600160a060020a03851615801590611fc85750600160a060020a03841615155b1515611fd357600080fd5b5050600160a060020a03831660009081526017602090815260408083205460108352818420546011845282852054601285528386205460138652958490208054855160026001831615610100026000190190921691909104601f81018890048802820188019096528581524297949661214a968b96939183018282801561209b5780601f106120705761010080835404028352916020019161209b565b820191906000526020600020905b81548152906001019060200180831161207e57829003601f168201915b50505050600160a060020a038c166000908152601460209081526040918290208054835160026001831615610100026000190190921691909104601f81018490048402820184019094528381529350919083018282801561213d5780601f106121125761010080835404028352916020019161213d565b820191906000526020600020905b81548152906001019060200180831161212057829003601f168201915b505050505089888a611e3b565b6040805160208181018084526000808452600160a060020a038a1681526013909252929020905161217b92906121e5565b506040805160208181018084526000808452600160a060020a038a168152601490925292902090516121ad92906121e5565b505050600160a060020a0390921660009081526010602090815260408083208390556011825280832083905560129091528120555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061222657805160ff1916838001178555612253565b82800160010185558215612253579182015b82811115612253578251825591602001919060010190612238565b5061225f929150612263565b5090565b610ebf91905b8082111561225f57600081556001016122695600a165627a7a72305820ca4b0e62cb37e1a19a1d273b00860e88e564cd013b209420796b6e0649d768360029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}}
| 2,984 |
0x538cde459e605f9279d49157c4beeac77194794f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
// SPDX-License-Identifier: Unlicensed
//( •̀ᴗ•́ )و ̑̑ WHALES OF THE CULT TOKEN ( •̀ᴗ•́ )و ̑̑
// tg.me/whalesofthecult
// www.wocult.com
//
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract whalesofthecult is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Whales of the Cult";
string private constant _symbol = "WoCULT";
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 = 6660000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 25;
//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(0x10B87ab8B998B8b5e45B463A3EcEA9792cc5C04e);
address payable private _marketingAddress = payable(0xF911d04388c38f3a00195649946FaBDa56e6C10c);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 66600000 * 10**9;
uint256 public _maxWalletSize = 133000000 * 10**9;
uint256 public _swapTokensAtAmount = 66600 * 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 * 10**_decimals;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize * 10**_decimals;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d9c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e6d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612ec5565b61087b565b6040516102649190612f20565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f9a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612fc4565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fdf565b6108cf565b6040516102f79190612f20565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612fc4565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061304e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613078565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613093565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130ec565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613093565b610c50565b60405161041e9190612fc4565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b5061046560048036038101906104609190613119565b610df4565b005b34801561047357600080fd5b5061047c610eab565b6040516104899190612fc4565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613093565b610eb1565b6040516104c69190612fc4565b60405180910390f35b3480156104db57600080fd5b506104e4610ec9565b6040516104f19190613078565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130ec565b610ef2565b005b34801561052f57600080fd5b50610538610fa4565b6040516105459190612fc4565b60405180910390f35b34801561055a57600080fd5b50610563610faa565b6040516105709190612e6d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b9190613119565b610fe7565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613146565b611086565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612ec5565b61113d565b6040516105ff9190612f20565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613093565b61115b565b60405161063c9190612f20565b60405180910390f35b34801561065157600080fd5b5061065a61117b565b005b34801561066857600080fd5b50610683600480360381019061067e9190613208565b611254565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613268565b61138e565b6040516106b99190612fc4565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e49190613119565b611415565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613093565b6114cc565b005b61071c61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132f4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd613314565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613372565b9150506107ac565b5050565b60606040518060400160405280601281526020017f5768616c6573206f66207468652043756c740000000000000000000000000000815250905090565b600061088f61088861168e565b8484611696565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000675c6d12b6bc1a0000905090565b60006108dc848484611861565b61099d846108e861168e565b61099885604051806060016040528060288152602001613f3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61168e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e69092919063ffffffff16565b611696565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132f4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132f4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061168e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61168e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161214a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b6565b9050919050565b610ca961168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132f4565b60405180910390fd5b6009600a610e9791906134ee565b81610ea29190613539565b60168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610efa61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7e906132f4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f576f43554c540000000000000000000000000000000000000000000000000000815250905090565b610fef61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461107c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611073906132f4565b60405180910390fd5b8060188190555050565b61108e61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461111b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611112906132f4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061115161114a61168e565b8484611861565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111bc61168e565b73ffffffffffffffffffffffffffffffffffffffff1614806112325750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661121a61168e565b73ffffffffffffffffffffffffffffffffffffffff16145b61123b57600080fd5b600061124630610c50565b905061125181612224565b50565b61125c61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e0906132f4565b60405180910390fd5b60005b8383905081101561138857816005600086868581811061130f5761130e613314565b5b90506020020160208101906113249190613093565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061138090613372565b9150506112ec565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61141d61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a1906132f4565b60405180910390fd5b6009600a6114b891906134ee565b816114c39190613539565b60178190555050565b6114d461168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611561576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611558906132f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c890613605565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611706576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fd90613697565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176d90613729565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118549190612fc4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c8906137bb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611941576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119389061384d565b60405180910390fd5b60008111611984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197b906138df565b60405180910390fd5b61198c610ec9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119fa57506119ca610ec9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611de557601560149054906101000a900460ff16611a8957611a1b610ec9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7f90613971565b60405180910390fd5b5b601654811115611ace576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac5906139dd565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b725750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611bb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba890613a6f565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c5e5760175481611c1384610c50565b611c1d9190613a8f565b10611c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5490613b57565b60405180910390fd5b5b6000611c6930610c50565b9050600060185482101590506016548210611c845760165491505b808015611c9c575060158054906101000a900460ff16155b8015611cf65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0e5750601560169054906101000a900460ff165b8015611d645750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611dba5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611de257611dc882612224565b60004790506000811115611de057611ddf4761214a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e8c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f3f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f3e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f4d57600090506120d4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611ff85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561201057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120bb5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120d357600a54600c81905550600b54600d819055505b5b6120e0848484846124aa565b50505050565b600083831115829061212e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121259190612e6d565b60405180910390fd5b506000838561213d9190613b77565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156121b2573d6000803e3d6000fd5b5050565b60006006548211156121fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f490613c1d565b60405180910390fd5b60006122076124d7565b905061221c818461250290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561225b5761225a612bfb565b5b6040519080825280602002602001820160405280156122895781602001602082028036833780820191505090505b50905030816000815181106122a1576122a0613314565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561234357600080fd5b505afa158015612357573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237b9190613c52565b8160018151811061238f5761238e613314565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123f630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611696565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161245a959493929190613d78565b600060405180830381600087803b15801561247457600080fd5b505af1158015612488573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124b8576124b761254c565b5b6124c384848461258f565b806124d1576124d061275a565b5b50505050565b60008060006124e461276e565b915091506124fb818361250290919063ffffffff16565b9250505090565b600061254483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506127cd565b905092915050565b6000600c5414801561256057506000600d54145b1561256a5761258d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806125a187612830565b9550955095509550955095506125ff86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061269485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128e290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126e081612940565b6126ea84836129fd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127479190612fc4565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000675c6d12b6bc1a000090506127a2675c6d12b6bc1a000060065461250290919063ffffffff16565b8210156127c057600654675c6d12b6bc1a00009350935050506127c9565b81819350935050505b9091565b60008083118290612814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280b9190612e6d565b60405180910390fd5b50600083856128239190613e01565b9050809150509392505050565b600080600080600080600080600061284d8a600c54600d54612a37565b925092509250600061285d6124d7565b905060008060006128708e878787612acd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128da83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120e6565b905092915050565b60008082846128f19190613a8f565b905083811015612936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292d90613e7e565b60405180910390fd5b8091505092915050565b600061294a6124d7565b905060006129618284612b5690919063ffffffff16565b90506129b581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128e290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612a128260065461289890919063ffffffff16565b600681905550612a2d816007546128e290919063ffffffff16565b6007819055505050565b600080600080612a636064612a55888a612b5690919063ffffffff16565b61250290919063ffffffff16565b90506000612a8d6064612a7f888b612b5690919063ffffffff16565b61250290919063ffffffff16565b90506000612ab682612aa8858c61289890919063ffffffff16565b61289890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ae68589612b5690919063ffffffff16565b90506000612afd8689612b5690919063ffffffff16565b90506000612b148789612b5690919063ffffffff16565b90506000612b3d82612b2f858761289890919063ffffffff16565b61289890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b695760009050612bcb565b60008284612b779190613539565b9050828482612b869190613e01565b14612bc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bbd90613f10565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c3382612bea565b810181811067ffffffffffffffff82111715612c5257612c51612bfb565b5b80604052505050565b6000612c65612bd1565b9050612c718282612c2a565b919050565b600067ffffffffffffffff821115612c9157612c90612bfb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612cd282612ca7565b9050919050565b612ce281612cc7565b8114612ced57600080fd5b50565b600081359050612cff81612cd9565b92915050565b6000612d18612d1384612c76565b612c5b565b90508083825260208201905060208402830185811115612d3b57612d3a612ca2565b5b835b81811015612d645780612d508882612cf0565b845260208401935050602081019050612d3d565b5050509392505050565b600082601f830112612d8357612d82612be5565b5b8135612d93848260208601612d05565b91505092915050565b600060208284031215612db257612db1612bdb565b5b600082013567ffffffffffffffff811115612dd057612dcf612be0565b5b612ddc84828501612d6e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612e1f578082015181840152602081019050612e04565b83811115612e2e576000848401525b50505050565b6000612e3f82612de5565b612e498185612df0565b9350612e59818560208601612e01565b612e6281612bea565b840191505092915050565b60006020820190508181036000830152612e878184612e34565b905092915050565b6000819050919050565b612ea281612e8f565b8114612ead57600080fd5b50565b600081359050612ebf81612e99565b92915050565b60008060408385031215612edc57612edb612bdb565b5b6000612eea85828601612cf0565b9250506020612efb85828601612eb0565b9150509250929050565b60008115159050919050565b612f1a81612f05565b82525050565b6000602082019050612f356000830184612f11565b92915050565b6000819050919050565b6000612f60612f5b612f5684612ca7565b612f3b565b612ca7565b9050919050565b6000612f7282612f45565b9050919050565b6000612f8482612f67565b9050919050565b612f9481612f79565b82525050565b6000602082019050612faf6000830184612f8b565b92915050565b612fbe81612e8f565b82525050565b6000602082019050612fd96000830184612fb5565b92915050565b600080600060608486031215612ff857612ff7612bdb565b5b600061300686828701612cf0565b935050602061301786828701612cf0565b925050604061302886828701612eb0565b9150509250925092565b600060ff82169050919050565b61304881613032565b82525050565b6000602082019050613063600083018461303f565b92915050565b61307281612cc7565b82525050565b600060208201905061308d6000830184613069565b92915050565b6000602082840312156130a9576130a8612bdb565b5b60006130b784828501612cf0565b91505092915050565b6130c981612f05565b81146130d457600080fd5b50565b6000813590506130e6816130c0565b92915050565b60006020828403121561310257613101612bdb565b5b6000613110848285016130d7565b91505092915050565b60006020828403121561312f5761312e612bdb565b5b600061313d84828501612eb0565b91505092915050565b600080600080608085870312156131605761315f612bdb565b5b600061316e87828801612eb0565b945050602061317f87828801612eb0565b935050604061319087828801612eb0565b92505060606131a187828801612eb0565b91505092959194509250565b600080fd5b60008083601f8401126131c8576131c7612be5565b5b8235905067ffffffffffffffff8111156131e5576131e46131ad565b5b60208301915083602082028301111561320157613200612ca2565b5b9250929050565b60008060006040848603121561322157613220612bdb565b5b600084013567ffffffffffffffff81111561323f5761323e612be0565b5b61324b868287016131b2565b9350935050602061325e868287016130d7565b9150509250925092565b6000806040838503121561327f5761327e612bdb565b5b600061328d85828601612cf0565b925050602061329e85828601612cf0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132de602083612df0565b91506132e9826132a8565b602082019050919050565b6000602082019050818103600083015261330d816132d1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061337d82612e8f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b0576133af613343565b5b600182019050919050565b60008160011c9050919050565b6000808291508390505b6001851115613412578086048111156133ee576133ed613343565b5b60018516156133fd5780820291505b808102905061340b856133bb565b94506133d2565b94509492505050565b60008261342b57600190506134e7565b8161343957600090506134e7565b816001811461344f576002811461345957613488565b60019150506134e7565b60ff84111561346b5761346a613343565b5b8360020a91508482111561348257613481613343565b5b506134e7565b5060208310610133831016604e8410600b84101617156134bd5782820a9050838111156134b8576134b7613343565b5b6134e7565b6134ca84848460016133c8565b925090508184048111156134e1576134e0613343565b5b81810290505b9392505050565b60006134f982612e8f565b915061350483613032565b92506135317fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461341b565b905092915050565b600061354482612e8f565b915061354f83612e8f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561358857613587613343565b5b828202905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006135ef602683612df0565b91506135fa82613593565b604082019050919050565b6000602082019050818103600083015261361e816135e2565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613681602483612df0565b915061368c82613625565b604082019050919050565b600060208201905081810360008301526136b081613674565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613713602283612df0565b915061371e826136b7565b604082019050919050565b6000602082019050818103600083015261374281613706565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006137a5602583612df0565b91506137b082613749565b604082019050919050565b600060208201905081810360008301526137d481613798565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613837602383612df0565b9150613842826137db565b604082019050919050565b600060208201905081810360008301526138668161382a565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006138c9602983612df0565b91506138d48261386d565b604082019050919050565b600060208201905081810360008301526138f8816138bc565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b600061395b603f83612df0565b9150613966826138ff565b604082019050919050565b6000602082019050818103600083015261398a8161394e565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006139c7601c83612df0565b91506139d282613991565b602082019050919050565b600060208201905081810360008301526139f6816139ba565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613a59602383612df0565b9150613a64826139fd565b604082019050919050565b60006020820190508181036000830152613a8881613a4c565b9050919050565b6000613a9a82612e8f565b9150613aa583612e8f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613ada57613ad9613343565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b41602383612df0565b9150613b4c82613ae5565b604082019050919050565b60006020820190508181036000830152613b7081613b34565b9050919050565b6000613b8282612e8f565b9150613b8d83612e8f565b925082821015613ba057613b9f613343565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613c07602a83612df0565b9150613c1282613bab565b604082019050919050565b60006020820190508181036000830152613c3681613bfa565b9050919050565b600081519050613c4c81612cd9565b92915050565b600060208284031215613c6857613c67612bdb565b5b6000613c7684828501613c3d565b91505092915050565b6000819050919050565b6000613ca4613c9f613c9a84613c7f565b612f3b565b612e8f565b9050919050565b613cb481613c89565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613cef81612cc7565b82525050565b6000613d018383613ce6565b60208301905092915050565b6000602082019050919050565b6000613d2582613cba565b613d2f8185613cc5565b9350613d3a83613cd6565b8060005b83811015613d6b578151613d528882613cf5565b9750613d5d83613d0d565b925050600181019050613d3e565b5085935050505092915050565b600060a082019050613d8d6000830188612fb5565b613d9a6020830187613cab565b8181036040830152613dac8186613d1a565b9050613dbb6060830185613069565b613dc86080830184612fb5565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e0c82612e8f565b9150613e1783612e8f565b925082613e2757613e26613dd2565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613e68601b83612df0565b9150613e7382613e32565b602082019050919050565b60006020820190508181036000830152613e9781613e5b565b9050919050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613efa602183612df0565b9150613f0582613e9e565b604082019050919050565b60006020820190508181036000830152613f2981613eed565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c998602092940cac389314db2b841fdbc0ab0d70f867efdef227a108b05ca44464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,985 |
0x8f59323d8400cc0dee71ee91f92961989d508160
|
pragma solidity 0.4.24;
/**
* DO NOT SEND ETH TO THIS CONTRACT ON MAINNET. ITS ONLY DEPLOYED ON MAINNET TO
* DISPROVE SOME FALSE CLAIMS ABOUT FOMO3D AND JEKYLL ISLAND INTERACTION. YOU
* CAN TEST ALL THE PAYABLE FUNCTIONS SENDING 0 ETH. OR BETTER YET COPY THIS TO
* THE TESTNETS.
*
* IF YOU SEND ETH TO THIS CONTRACT IT CANNOT BE RECOVERED. THERE IS NO WITHDRAW.
*
* THE CHECK BALANCE FUNCTIONS ARE FOR WHEN TESTING ON TESTNET TO SHOW THAT ALTHOUGH
* THE CORP BANK COULD BE FORCED TO REVERT TX'S OR TRY AND BURN UP ALL/MOST GAS
* FOMO3D STILL MOVES ON WITHOUT RISK OF LOCKING UP. AND IN CASES OF REVERT OR
* OOG INSIDE CORP BANK. ALL WE AT TEAM JUST WOULD ACCOMPLISH IS JUSTING OURSELVES
* OUT OF THE ETH THAT WAS TO BE SENT TO JEKYLL ISLAND. FOREVER LEAVING IT UNCLAIMABLE
* IN FOMO3D CONTACT. SO WE CAN ONLY HARM OURSELVES IF WE TRIED SUCH A USELESS
* THING. AND FOMO3D WILL CONTINUE ON, UNAFFECTED
*/
// this is deployed on mainnet at: 0x38aEfE9e8E0Fc938475bfC6d7E52aE28D39FEBD8
contract Fomo3d {
// create some data tracking vars for testing
bool public depositSuccessful_;
uint256 public successfulTransactions_;
uint256 public gasBefore_;
uint256 public gasAfter_;
// create forwarder instance
Forwarder Jekyll_Island_Inc;
// take addr for forwarder in constructor arguments
constructor(address _addr)
public
{
// set up forwarder to point to its contract location
Jekyll_Island_Inc = Forwarder(_addr);
}
// some fomo3d function that deposits to Forwarder
function someFunction()
public
payable
{
// grab gas left
gasBefore_ = gasleft();
// deposit to forwarder, uses low level call so forwards all gas
if (!address(Jekyll_Island_Inc).call.value(msg.value)(bytes4(keccak256("deposit()"))))
{
// give fomo3d work to do that needs gas. what better way than storage
// write calls, since their so costly.
depositSuccessful_ = false;
gasAfter_ = gasleft();
} else {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
}
}
// some fomo3d function that deposits to Forwarder
function someFunction2()
public
payable
{
// grab gas left
gasBefore_ = gasleft();
// deposit to forwarder, uses low level call so forwards all gas
if (!address(Jekyll_Island_Inc).call.value(msg.value)(bytes4(keccak256("deposit2()"))))
{
// give fomo3d work to do that needs gas. what better way than storage
// write calls, since their so costly.
depositSuccessful_ = false;
gasAfter_ = gasleft();
} else {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
}
}
// some fomo3d function that deposits to Forwarder
function someFunction3()
public
payable
{
// grab gas left
gasBefore_ = gasleft();
// deposit to forwarder, uses low level call so forwards all gas
if (!address(Jekyll_Island_Inc).call.value(msg.value)(bytes4(keccak256("deposit3()"))))
{
// give fomo3d work to do that needs gas. what better way than storage
// write calls, since their so costly.
depositSuccessful_ = false;
gasAfter_ = gasleft();
} else {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
}
}
// some fomo3d function that deposits to Forwarder
function someFunction4()
public
payable
{
// grab gas left
gasBefore_ = gasleft();
// deposit to forwarder, uses low level call so forwards all gas
if (!address(Jekyll_Island_Inc).call.value(msg.value)(bytes4(keccak256("deposit4()"))))
{
// give fomo3d work to do that needs gas. what better way than storage
// write calls, since their so costly.
depositSuccessful_ = false;
gasAfter_ = gasleft();
} else {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
}
}
// for data tracking lets make a function to check this contracts balance
function checkBalance()
public
view
returns(uint256)
{
return(address(this).balance);
}
}
// heres a sample forwarder with a copy of the jekyll island forwarder (requirements on
// msg.sender removed for simplicity since its irrelevant to testing this. and some
// tracking vars added for test.)
// this is deployed on mainnet at: 0x8F59323d8400CC0deE71ee91f92961989D508160
contract Forwarder {
// lets create some tracking vars
bool public depositSuccessful_;
uint256 public successfulTransactions_;
uint256 public gasBefore_;
uint256 public gasAfter_;
// create an instance of the jekyll island bank
Bank currentCorpBank_;
// take an address in the constructor arguments to set up bank with
constructor(address _addr)
public
{
// point the created instance to the address given
currentCorpBank_ = Bank(_addr);
}
function deposit()
public
payable
returns(bool)
{
// grab gas at start
gasBefore_ = gasleft();
if (currentCorpBank_.deposit.value(msg.value)(msg.sender) == true) {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
return(true);
} else {
depositSuccessful_ = false;
gasAfter_ = gasleft();
return(false);
}
}
function deposit2()
public
payable
returns(bool)
{
// grab gas at start
gasBefore_ = gasleft();
if (currentCorpBank_.deposit2.value(msg.value)(msg.sender) == true) {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
return(true);
} else {
depositSuccessful_ = false;
gasAfter_ = gasleft();
return(false);
}
}
function deposit3()
public
payable
returns(bool)
{
// grab gas at start
gasBefore_ = gasleft();
if (currentCorpBank_.deposit3.value(msg.value)(msg.sender) == true) {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
return(true);
} else {
depositSuccessful_ = false;
gasAfter_ = gasleft();
return(false);
}
}
function deposit4()
public
payable
returns(bool)
{
// grab gas at start
gasBefore_ = gasleft();
if (currentCorpBank_.deposit4.value(msg.value)(msg.sender) == true) {
depositSuccessful_ = true;
successfulTransactions_++;
gasAfter_ = gasleft();
return(true);
} else {
depositSuccessful_ = false;
gasAfter_ = gasleft();
return(false);
}
}
// for data tracking lets make a function to check this contracts balance
function checkBalance()
public
view
returns(uint256)
{
return(address(this).balance);
}
}
// heres the bank with various ways someone could try and migrate to a bank that
// screws the tx. to show none of them effect fomo3d.
// this is deployed on mainnet at: 0x0C2DBC98581e553C4E978Dd699571a5DED408a4F
contract Bank {
// lets use storage writes to this to burn up all gas
uint256 public i = 1000000;
uint256 public x;
address public fomo3d;
/**
* this version will use up most gas. but return just enough to make it back
* to fomo3d. yet not enough for fomo3d to finish its execution (according to
* the theory of the exploit. which when you run this you'll find due to my
* use of ! in the call from fomo3d to forwarder, and the use of a normal function
* call from forwarder to bank, this fails to stop fomo3d from continuing)
*/
function deposit(address _fomo3daddress)
external
payable
returns(bool)
{
// burn all gas leaving just enough to get back to fomo3d and it to do
// a write call in a attempt to make Fomo3d OOG (doesn't work cause fomo3d
// protects itself from this behavior)
while (i > 41000)
{
i = gasleft();
}
return(true);
}
/**
* this version just tries a plain revert. (pssst... fomo3d doesn't care)
*/
function deposit2(address _fomo3daddress)
external
payable
returns(bool)
{
// straight up revert (since we use low level call in fomo3d it doesn't
// care if we revert the internal tx to bank. this behavior would only
// screw over team just, not effect fomo3d)
revert();
}
/**
* this one tries an infinite loop (another fail. fomo3d trudges on)
*/
function deposit3(address _fomo3daddress)
external
payable
returns(bool)
{
// this infinite loop still does not stop fomo3d from running.
while(1 == 1) {
x++;
fomo3d = _fomo3daddress;
}
return(true);
}
/**
* this one just runs a set length loops that OOG's (and.. again.. fomo3d still works)
*/
function deposit4(address _fomo3daddress)
public
payable
returns(bool)
{
// burn all gas (fomo3d still keeps going)
for (uint256 i = 0; i <= 1000; i++)
{
x++;
fomo3d = _fomo3daddress;
}
}
// for data tracking lets make a function to check this contracts balance
function checkBalance()
public
view
returns(uint256)
{
return(address(this).balance);
}
}
|
0x6080604052600436106100985763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663030cc118811461009d5780630a3c34fb146100c657806343cd1638146100ed57806344e880c1146100f5578063539c0f141461010a5780639d408b9314610112578063bd0e5d0714610127578063c71daccb1461012f578063d0e30db014610144575b600080fd5b3480156100a957600080fd5b506100b261014c565b604080519115158252519081900360200190f35b3480156100d257600080fd5b506100db610155565b60408051918252519081900360200190f35b6100b261015b565b34801561010157600080fd5b506100db610245565b6100b261024b565b34801561011e57600080fd5b506100db6102c7565b6100b26102cd565b34801561013b57600080fd5b506100db610349565b6100b261034e565b60005460ff1681565b60015481565b60005a60025560048054604080517fbbe26b4b00000000000000000000000000000000000000000000000000000000815233938101939093525173ffffffffffffffffffffffffffffffffffffffff9091169163bbe26b4b91349160248082019260209290919082900301818588803b1580156101d757600080fd5b505af11580156101eb573d6000803e3d6000fd5b50505050506040513d602081101561020257600080fd5b5051151560011415610230576000805460ff191660019081179091558054810190555a600355506001610242565b6000805460ff191690555a6003555060005b90565b60035481565b60005a60025560048054604080517f16390b6900000000000000000000000000000000000000000000000000000000815233938101939093525173ffffffffffffffffffffffffffffffffffffffff909116916316390b6991349160248082019260209290919082900301818588803b1580156101d757600080fd5b60025481565b60005a60025560048054604080517f80f5f90700000000000000000000000000000000000000000000000000000000815233938101939093525173ffffffffffffffffffffffffffffffffffffffff909116916380f5f90791349160248082019260209290919082900301818588803b1580156101d757600080fd5b303190565b60005a60025560048054604080517ff340fa0100000000000000000000000000000000000000000000000000000000815233938101939093525173ffffffffffffffffffffffffffffffffffffffff9091169163f340fa0191349160248082019260209290919082900301818588803b1580156101d757600080fd00a165627a7a723058209b76470bfaf56b247dc881973f006937f2d2b20b018478e7fe7634a36244fc860029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,986 |
0x1D17d697cAAffE53bf3bFdE761c90D61F6ebdc41
|
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; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface StakedToken {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
interface RewardToken {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Staking is Ownable {
struct User {
uint256 depositAmount;
uint256 paidReward;
}
using SafeMath for uint256;
mapping (address => User) public users;
uint256 public rewardTillNowPerToken = 0;
uint256 public lastUpdatedBlock;
uint256 public rewardPerBlock;
uint256 public scale = 1e18;
uint256 public particleCollector = 0;
uint256 public daoShare;
uint256 public earlyFoundersShare;
address public daoWallet;
address public earlyFoundersWallet;
// init with 1 instead of 0 to avoid division by zero
uint256 public totalStakedToken = 1;
StakedToken public stakedToken;
RewardToken public rewardToken;
event Deposit(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event EmergencyWithdraw(address user, uint256 amount);
event RewardClaimed(address user, uint256 amount);
event RewardPerBlockChanged(uint256 oldValue, uint256 newValue);
constructor (address _stakedToken, address _rewardToken, uint256 _rewardPerBlock, uint256 _daoShare, uint256 _earlyFoundersShare) public {
stakedToken = StakedToken(_stakedToken);
rewardToken = RewardToken(_rewardToken);
rewardPerBlock = _rewardPerBlock;
daoShare = _daoShare;
earlyFoundersShare = _earlyFoundersShare;
lastUpdatedBlock = block.number;
daoWallet = msg.sender;
earlyFoundersWallet = msg.sender;
}
function setWallets(address _daoWallet, address _earlyFoundersWallet) public onlyOwner {
daoWallet = _daoWallet;
earlyFoundersWallet = _earlyFoundersWallet;
}
function setShares(uint256 _daoShare, uint256 _earlyFoundersShare) public onlyOwner {
withdrawParticleCollector();
daoShare = _daoShare;
earlyFoundersShare = _earlyFoundersShare;
}
function setRewardPerBlock(uint256 _rewardPerBlock) public onlyOwner {
update();
emit RewardPerBlockChanged(rewardPerBlock, _rewardPerBlock);
rewardPerBlock = _rewardPerBlock;
}
// Update reward variables of the pool to be up-to-date.
function update() public {
if (block.number <= lastUpdatedBlock) {
return;
}
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
rewardTillNowPerToken = rewardTillNowPerToken.add(rewardAmount.mul(scale).div(totalStakedToken));
lastUpdatedBlock = block.number;
}
// View function to see pending reward on frontend.
function pendingReward(address _user) external view returns (uint256) {
User storage user = users[_user];
uint256 accRewardPerToken = rewardTillNowPerToken;
if (block.number > lastUpdatedBlock) {
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
accRewardPerToken = accRewardPerToken.add(rewardAmount.mul(scale).div(totalStakedToken));
}
return user.depositAmount.mul(accRewardPerToken).div(scale).sub(user.paidReward);
}
function deposit(uint256 amount) public {
User storage user = users[msg.sender];
update();
if (user.depositAmount > 0) {
uint256 _pendingReward = user.depositAmount.mul(rewardTillNowPerToken).div(scale).sub(user.paidReward);
rewardToken.transfer(msg.sender, _pendingReward);
emit RewardClaimed(msg.sender, _pendingReward);
}
user.depositAmount = user.depositAmount.add(amount);
user.paidReward = user.depositAmount.mul(rewardTillNowPerToken).div(scale);
stakedToken.transferFrom(address(msg.sender), address(this), amount);
totalStakedToken = totalStakedToken.add(amount);
emit Deposit(msg.sender, amount);
}
function withdraw(uint256 amount) public {
User storage user = users[msg.sender];
require(user.depositAmount >= amount, "withdraw amount exceeds deposited amount");
update();
uint256 _pendingReward = user.depositAmount.mul(rewardTillNowPerToken).div(scale).sub(user.paidReward);
rewardToken.transfer(msg.sender, _pendingReward);
emit RewardClaimed(msg.sender, _pendingReward);
uint256 particleCollectorShare = _pendingReward.mul(daoShare.add(earlyFoundersShare)).div(scale);
particleCollector = particleCollector.add(particleCollectorShare);
if (amount > 0) {
user.depositAmount = user.depositAmount.sub(amount);
stakedToken.transfer(address(msg.sender), amount);
totalStakedToken = totalStakedToken.sub(amount);
emit Withdraw(msg.sender, amount);
}
user.paidReward = user.depositAmount.mul(rewardTillNowPerToken).div(scale);
}
function withdrawParticleCollector() public {
uint256 _daoShare = particleCollector.mul(daoShare).div(daoShare.add(earlyFoundersShare));
rewardToken.transfer(daoWallet, _daoShare);
uint256 _earlyFoundersShare = particleCollector.mul(earlyFoundersShare).div(daoShare.add(earlyFoundersShare));
rewardToken.transfer(earlyFoundersWallet, _earlyFoundersShare);
particleCollector = 0;
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public {
User storage user = users[msg.sender];
totalStakedToken = totalStakedToken.sub(user.depositAmount);
stakedToken.transfer(msg.sender, user.depositAmount);
emit EmergencyWithdraw(msg.sender, user.depositAmount);
user.depositAmount = 0;
user.paidReward = 0;
}
// Add temporary withdrawal functionality for owner(DAO) to transfer all tokens to a safe place.
// Contract ownership will transfer to address(0x) after full auditing of codes.
function withdrawAllRewardTokens(address to) public onlyOwner {
uint256 totalRewardTokens = rewardToken.balanceOf(address(this));
rewardToken.transfer(to, totalRewardTokens);
}
// Add temporary withdrawal functionality for owner(DAO) to transfer all tokens to a safe place.
// Contract ownership will transfer to address(0x) after full auditing of codes.
function withdrawAllStakedtokens(address to) public onlyOwner {
uint256 _totalStakedTokens = stakedToken.balanceOf(address(this));
stakedToken.transfer(to, _totalStakedTokens);
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063a2e62045116100f9578063d3f6a15711610097578063f40f0f5211610071578063f40f0f52146105ab578063f51e181a14610603578063f7c618c114610621578063f90ce5ba14610655576101a9565b8063d3f6a157146104f9578063db2e21bc1461055d578063f2fde38b14610567576101a9565b8063bb872b4a116100d3578063bb872b4a14610435578063cb6d8ee614610463578063cc7a262e14610481578063cee66f63146104b5576101a9565b8063a2e620451461039e578063a87430ba146103a8578063b6b55f2514610407576101a9565b8063715018a6116101665780638ae39cac116101405780638ae39cac146103245780638da5cb5b146103425780639378c6d414610376578063995d9b6014610380576101a9565b8063715018a6146102b857806372d21c89146102c257806388d19f1b14610306576101a9565b8063079a5705146101ae5780632aca3e7d146101e25780632e1a7d4d1461021a578063481af4aa1461024857806360c6cdac14610266578063698a589714610284575b600080fd5b6101b6610673565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610218600480360360408110156101f857600080fd5b810190808035906020019092919080359060200190929190505050610699565b005b6102466004803603602081101561023057600080fd5b810190808035906020019092919050505061077b565b005b610250610b8d565b6040518082815260200191505060405180910390f35b61026e610b93565b6040518082815260200191505060405180910390f35b61028c610b99565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c0610bbf565b005b610304600480360360208110156102d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d45565b005b61030e610fa8565b6040518082815260200191505060405180910390f35b61032c610fae565b6040518082815260200191505060405180910390f35b61034a610fb4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61037e610fdd565b005b610388611251565b6040518082815260200191505060405180910390f35b6103a6611257565b005b6103ea600480360360208110156103be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d0565b604051808381526020018281526020019250505060405180910390f35b6104336004803603602081101561041d57600080fd5b81019080803590602001909291905050506112f4565b005b6104616004803603602081101561044b57600080fd5b810190808035906020019092919050505061166e565b005b61046b611789565b6040518082815260200191505060405180910390f35b61048961178f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f7600480360360208110156104cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b5565b005b61055b6004803603604081101561050f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a18565b005b610565611b66565b005b6105a96004803603602081101561057d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d0b565b005b6105ed600480360360208110156105c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f16565b6040518082815260200191505060405180910390f35b61060b612011565b6040518082815260200191505060405180910390f35b610629612017565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61065d61203d565b6040518082815260200191505060405180910390f35b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6106a1612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610769610fdd565b81600781905550806008819055505050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160000154101561081b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806123746028913960400191505060405180910390fd5b610823611257565b6000610868826001015461085a60055461084c600254876000015461204b90919063ffffffff16565b6120d190919063ffffffff16565b61211b90919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b505050506040513d602081101561092757600080fd5b8101908080519060200190929190505050507f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72413382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a160006109cd6005546109bf6109b060085460075461216590919063ffffffff16565b8561204b90919063ffffffff16565b6120d190919063ffffffff16565b90506109e48160065461216590919063ffffffff16565b6006819055506000841115610b5257610a0a84846000015461211b90919063ffffffff16565b8360000181905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610aa557600080fd5b505af1158015610ab9573d6000803e3d6000fd5b505050506040513d6020811015610acf57600080fd5b810190808051906020019092919050505050610af684600b5461211b90919063ffffffff16565b600b819055507f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243643385604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b610b7f600554610b71600254866000015461204b90919063ffffffff16565b6120d190919063ffffffff16565b836001018190555050505050565b60085481565b60025481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610bc7612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d4d612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e9857600080fd5b505afa158015610eac573d6000803e3d6000fd5b505050506040513d6020811015610ec257600080fd5b81019080805190602001909291905050509050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f6857600080fd5b505af1158015610f7c573d6000803e3d6000fd5b505050506040513d6020811015610f9257600080fd5b8101908080519060200190929190505050505050565b60075481565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061101e610ff960085460075461216590919063ffffffff16565b61101060075460065461204b90919063ffffffff16565b6120d190919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110d557600080fd5b505af11580156110e9573d6000803e3d6000fd5b505050506040513d60208110156110ff57600080fd5b810190808051906020019092919050505050600061115261112d60085460075461216590919063ffffffff16565b61114460085460065461204b90919063ffffffff16565b6120d190919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561120957600080fd5b505af115801561121d573d6000803e3d6000fd5b505050506040513d602081101561123357600080fd5b81019080805190602001909291905050505060006006819055505050565b60065481565b6003544311611265576112ce565b6000611280600454600354430361204b90919063ffffffff16565b90506112bf6112ae600b546112a06005548561204b90919063ffffffff16565b6120d190919063ffffffff16565b60025461216590919063ffffffff16565b60028190555043600381905550505b565b60016020528060005260406000206000915090508060000154908060010154905082565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905061133f611257565b6000816000015411156114b95760006113918260010154611383600554611375600254876000015461204b90919063ffffffff16565b6120d190919063ffffffff16565b61211b90919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561142657600080fd5b505af115801561143a573d6000803e3d6000fd5b505050506040513d602081101561145057600080fd5b8101908080519060200190929190505050507f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72413382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505b6114d082826000015461216590919063ffffffff16565b81600001819055506115056005546114f7600254846000015461204b90919063ffffffff16565b6120d190919063ffffffff16565b8160010181905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156115be57600080fd5b505af11580156115d2573d6000803e3d6000fd5b505050506040513d60208110156115e857600080fd5b81019080805190602001909291905050505061160f82600b5461216590919063ffffffff16565b600b819055507fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b611676612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611736576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61173e611257565b7f79a5349732f93288abbb68e251c3dfc325bf3ee6fde7786d919155d39733e0f560045482604051808381526020018281526020019250505060405180910390a18060048190555050565b600b5481565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6117bd612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461187d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561190857600080fd5b505afa15801561191c573d6000803e3d6000fd5b505050506040513d602081101561193257600080fd5b81019080805190602001909291905050509050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156119d857600080fd5b505af11580156119ec573d6000803e3d6000fd5b505050506040513d6020811015611a0257600080fd5b8101908080519060200190929190505050505050565b611a20612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ae0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b81600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050611bc28160000154600b5461211b90919063ffffffff16565b600b81905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3383600001546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611c5f57600080fd5b505af1158015611c73573d6000803e3d6000fd5b505050506040513d6020811015611c8957600080fd5b8101908080519060200190929190505050507f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695338260000154604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600081600001819055506000816001018190555050565b611d13612043565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611dd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061239c6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006002549050600354431115611fc7576000611f86600454600354430361204b90919063ffffffff16565b9050611fc3611fb4600b54611fa66005548561204b90919063ffffffff16565b6120d190919063ffffffff16565b8361216590919063ffffffff16565b9150505b6120088260010154611ffa600554611fec85876000015461204b90919063ffffffff16565b6120d190919063ffffffff16565b61211b90919063ffffffff16565b92505050919050565b60055481565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b600033905090565b60008083141561205e57600090506120cb565b600082840290508284828161206f57fe5b04146120c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123c26021913960400191505060405180910390fd5b809150505b92915050565b600061211383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121ed565b905092915050565b600061215d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b3565b905092915050565b6000808284019050838110156121e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008083118290612299576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561225e578082015181840152602081019050612243565b50505050905090810190601f16801561228b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816122a557fe5b049050809150509392505050565b6000838311158290612360576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561232557808201518184015260208101905061230a565b50505050905090810190601f1680156123525780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe776974686472617720616d6f756e742065786365656473206465706f736974656420616d6f756e744f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212206607ea760dc1d067371b1e69f86cd8c9ccef855eed569218d24af7a310376d3764736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,987 |
0xb3829e5755fafb97396109768895b1026acc003f
|
/**
*Submitted for verification at Etherscan.io on 2017-11-28
*/
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 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, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve 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, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract BlackList is Ownable, BasicToken {
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract Bcoin is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Bcoin(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
}
|
0x608060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461019b5780630753c30c1461022b578063095ea7b31461026e5780630e136b19146102bb5780630ecb93c0146102ea57806318160ddd1461032d57806323b872dd1461035857806326976e3f146103c557806327e235e31461041c578063313ce56714610473578063353907141461049e5780633eaaf86b146104c95780633f4ba83a146104f457806359bf1abe1461050b5780635c658165146105665780635c975abb146105dd57806370a082311461060c5780638456cb5914610663578063893d20e81461067a5780638da5cb5b146106d157806395d89b4114610728578063a9059cbb146107b8578063c0324c7714610805578063cc872b661461083c578063db006a7514610869578063dd62ed3e14610896578063dd644f721461090d578063e47d606014610938578063e4997dc514610993578063e5b5019a146109d6578063f2fde38b14610a01578063f3bdc22814610a44575b600080fd5b3480156101a757600080fd5b506101b0610a87565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f05780820151818401526020810190506101d5565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023757600080fd5b5061026c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b25565b005b34801561027a57600080fd5b506102b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c42565b005b3480156102c757600080fd5b506102d0610d95565b604051808215151515815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da8565b005b34801561033957600080fd5b50610342610ec1565b6040518082815260200191505060405180910390f35b34801561036457600080fd5b506103c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fa9565b005b3480156103d157600080fd5b506103da61118e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042857600080fd5b5061045d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b4565b6040518082815260200191505060405180910390f35b34801561047f57600080fd5b506104886111cc565b6040518082815260200191505060405180910390f35b3480156104aa57600080fd5b506104b36111d2565b6040518082815260200191505060405180910390f35b3480156104d557600080fd5b506104de6111d8565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b506105096111de565b005b34801561051757600080fd5b5061054c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061129c565b604051808215151515815260200191505060405180910390f35b34801561057257600080fd5b506105c7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112f2565b6040518082815260200191505060405180910390f35b3480156105e957600080fd5b506105f2611317565b604051808215151515815260200191505060405180910390f35b34801561061857600080fd5b5061064d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061132a565b6040518082815260200191505060405180910390f35b34801561066f57600080fd5b50610678611451565b005b34801561068657600080fd5b5061068f611511565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106dd57600080fd5b506106e661153a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073457600080fd5b5061073d61155f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561077d578082015181840152602081019050610762565b50505050905090810190601f1680156107aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107c457600080fd5b50610803600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115fd565b005b34801561081157600080fd5b5061083a60048036038101908080359060200190929190803590602001909291905050506117ac565b005b34801561084857600080fd5b5061086760048036038101908080359060200190929190505050611891565b005b34801561087557600080fd5b5061089460048036038101908080359060200190929190505050611a88565b005b3480156108a257600080fd5b506108f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c1b565b6040518082815260200191505060405180910390f35b34801561091957600080fd5b50610922611d78565b6040518082815260200191505060405180910390f35b34801561094457600080fd5b50610979600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7e565b604051808215151515815260200191505060405180910390f35b34801561099f57600080fd5b506109d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d9e565b005b3480156109e257600080fd5b506109eb611eb7565b6040518082815260200191505060405180910390f35b348015610a0d57600080fd5b50610a42600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611edb565b005b348015610a5057600080fd5b50610a85600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fb0565b005b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b1d5780601f10610af257610100808354040283529160200191610b1d565b820191906000526020600020905b815481529060010190602001808311610b0057829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b8057600080fd5b6001600a60146101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b604060048101600036905010151515610c5a57600080fd5b600a60149054906101000a900460ff1615610d8557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aee92d333385856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610d6857600080fd5b505af1158015610d7c573d6000803e3d6000fd5b50505050610d90565b610d8f8383612134565b5b505050565b600a60149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0357600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615610fa057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610f5e57600080fd5b505af1158015610f72573d6000803e3d6000fd5b505050506040513d6020811015610f8857600080fd5b81019080805190602001909291905050509050610fa6565b60015490505b90565b600060149054906101000a900460ff16151515610fc557600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561101e57600080fd5b600a60149054906101000a900460ff161561117d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b477adb338585856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050600060405180830381600087803b15801561116057600080fd5b505af1158015611174573d6000803e3d6000fd5b50505050611189565b6111888383836122d1565b5b505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090505481565b60095481565b60045481565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123957600080fd5b600060149054906101000a900460ff16151561125457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6005602052816000526040600020602052806000526040600020600091509150505481565b600060149054906101000a900460ff1681565b6000600a60149054906101000a900460ff161561144057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b505050506040513d602081101561142857600080fd5b8101908080519060200190929190505050905061144c565b61144982612778565b90505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114ac57600080fd5b600060149054906101000a900460ff161515156114c857600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115f55780601f106115ca576101008083540402835291602001916115f5565b820191906000526020600020905b8154815290600101906020018083116115d857829003601f168201915b505050505081565b600060149054906101000a900460ff1615151561161957600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561167257600080fd5b600a60149054906101000a900460ff161561179d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636e18980a3384846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561178057600080fd5b505af1158015611794573d6000803e3d6000fd5b505050506117a8565b6117a782826127c1565b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180757600080fd5b60148210151561181657600080fd5b60328110151561182557600080fd5b81600381905550611844600954600a0a82612b2990919063ffffffff16565b6004819055507fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e600354600454604051808381526020018281526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ec57600080fd5b600154816001540111151561190057600080fd5b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156119d057600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806001600082825401925050819055507fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a816040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ae357600080fd5b8060015410151515611af457600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611b6357600080fd5b8060016000828254039250508190555080600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a44816040518082815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615611d6557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015611d2357600080fd5b505af1158015611d37573d6000803e3d6000fd5b505050506040513d6020811015611d4d57600080fd5b81019080805190602001909291905050509050611d72565b611d6f8383612b64565b90505b92915050565b60035481565b60066020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611df957600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f3657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611fad57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561200d57600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561206557600080fd5b61206e8261132a565b90506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806001600082825403925050819055507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60406004810160003690501015151561214c57600080fd5b600082141580156121da57506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b1515156121e657600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3505050565b60008060006060600481016000369050101515156122ee57600080fd5b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054935061239661271061238860035488612b2990919063ffffffff16565b612beb90919063ffffffff16565b92506004548311156123a85760045492505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841015612464576123e38585612c0690919063ffffffff16565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6124778386612c0690919063ffffffff16565b91506124cb85600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0690919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256082600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600083111561270a5761261f83600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806040600481016000369050101515156127dc57600080fd5b6128056127106127f760035487612b2990919063ffffffff16565b612beb90919063ffffffff16565b92506004548311156128175760045492505b61282a8385612c0690919063ffffffff16565b915061287e84600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291382600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000831115612abd576129d283600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b6000806000841415612b3e5760009150612b5d565b8284029050828482811515612b4f57fe5b04141515612b5957fe5b8091505b5092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000808284811515612bf957fe5b0490508091505092915050565b6000828211151515612c1457fe5b818303905092915050565b6000808284019050838110151515612c3357fe5b80915050929150505600a165627a7a723058206e4ef484c65eb7423552f8a67df491a881e0e017df5618e98d7d8dcb6bc606970029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 2,988 |
0xdb6aae922b382862ec29cf4601b63b653bba1678
|
// SPDX-License-Identifier: Unlicensed
/**
Is it your $DDAO to be poor forever?
NO.
You can change your DESTINY, this is DDAO.
Take it from me. I had 0 experience coding and you can issue your own tokens, make money?
Year, and can hang with the best of them, such as teams of Saitama and Shinja, or Shibdoge.
If there's interest, I will gladly share my experiences
And we can change destiny together.
I'll be monitoring socials and any unofficial $DDAO groups.
DDAOs, all DDAO?
Haha, come to me
Now it's up to the community if you want to learn...
Or participate in our community and join us in making $DDAO our holy grail. Our DESTINY are intertwined and we are destined for success.
Total: 1,000,000,000,000
Max buy & Max Wallet: 10,000,000,000(1%)
**/
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 DDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Destiny DAO";
string private constant _symbol = "DDAO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xBe26f0516BC3669Cba2388C137ceB3DfabFDA846);
address payable private _marketingAddress = payable(0xBe26f0516BC3669Cba2388C137ceB3DfabFDA846);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000001 * 10**9;
uint256 public _maxWalletSize = 10000000001 * 10**9;
uint256 public _swapTokensAtAmount = 10001 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b257600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611957565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600b81526a44657374696e792044414f60a81b60208201525b60405161023b9190611a1c565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a71565b61069c565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50683635c9adc5dea000005b60405190815260200161023b565b3480156102de57600080fd5b506102646102ed366004611a9d565b6106b3565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023b565b34801561033057600080fd5b50601554610294906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611ade565b61071c565b34801561037057600080fd5b506101fc61037f366004611b0b565b610767565b34801561039057600080fd5b506101fc6107af565b3480156103a557600080fd5b506102c46103b4366004611ade565b6107fa565b3480156103c557600080fd5b506101fc61081c565b3480156103da57600080fd5b506101fc6103e9366004611b26565b610890565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611ade565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610294565b34801561045b57600080fd5b506101fc61046a366004611b0b565b6108bf565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b506040805180820190915260048152634444414f60e01b602082015261022e565b3480156104be57600080fd5b506101fc6104cd366004611b26565b610907565b3480156104de57600080fd5b506101fc6104ed366004611b3f565b610936565b3480156104fe57600080fd5b5061026461050d366004611a71565b610974565b34801561051e57600080fd5b5061026461052d366004611ade565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610981565b34801561056357600080fd5b506101fc610572366004611b71565b6109d5565b34801561058357600080fd5b506102c4610592366004611bf5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611b26565b610a76565b3480156105e957600080fd5b506101fc6105f8366004611ade565b610aa5565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611c2e565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611c63565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611c8f565b915050610633565b5050565b60006106a9338484610b8f565b5060015b92915050565b60006106c0848484610cb3565b610712843361070d85604051806060016040528060288152602001611da7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ef565b610b8f565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611c2e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611c2e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f781611229565b50565b6001600160a01b0381166000908152600260205260408120546106ad90611263565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611c2e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611c2e565b601655565b6000546001600160a01b031633146108e95760405162461bcd60e51b815260040161062790611c2e565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062790611c2e565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062790611c2e565b600893909355600a91909155600955600b55565b60006106a9338484610cb3565b6012546001600160a01b0316336001600160a01b031614806109b657506013546001600160a01b0316336001600160a01b0316145b6109bf57600080fd5b60006109ca306107fa565b90506107f7816112e7565b6000546001600160a01b031633146109ff5760405162461bcd60e51b815260040161062790611c2e565b60005b82811015610a70578160056000868685818110610a2157610a21611c63565b9050602002016020810190610a369190611ade565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6881611c8f565b915050610a02565b50505050565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260040161062790611c2e565b601755565b6000546001600160a01b03163314610acf5760405162461bcd60e51b815260040161062790611c2e565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610e0757506000546001600160a01b03838116911614155b156110e857601554600160a01b900460ff16610ea0576000546001600160a01b03848116911614610ea05760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b601654811115610ef25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3457506001600160a01b03821660009081526010602052604090205460ff16155b610f8c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146110115760175481610fae846107fa565b610fb89190611ca8565b106110115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b600061101c306107fa565b6018546016549192508210159082106110355760165491505b80801561104c5750601554600160a81b900460ff16155b801561106657506015546001600160a01b03868116911614155b801561107b5750601554600160b01b900460ff165b80156110a057506001600160a01b03851660009081526005602052604090205460ff16155b80156110c557506001600160a01b03841660009081526005602052604090205460ff16155b156110e5576110d3826112e7565b4780156110e3576110e347611229565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112a57506001600160a01b03831660009081526005602052604090205460ff165b8061115c57506015546001600160a01b0385811691161480159061115c57506015546001600160a01b03848116911614155b15611169575060006111e3565b6015546001600160a01b03858116911614801561119457506014546001600160a01b03848116911614155b156111a657600854600c55600954600d555b6015546001600160a01b0384811691161480156111d157506014546001600160a01b03858116911614155b156111e357600a54600c55600b54600d555b610a7084848484611461565b600081848411156112135760405162461bcd60e51b81526004016106279190611a1c565b5060006112208486611cc0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156112ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b60006112d461148f565b90506112e083826114b2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132f5761132f611c63565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ac9190611cd7565b816001815181106113bf576113bf611c63565b6001600160a01b0392831660209182029290920101526014546113e59130911684610b8f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141e908590600090869030904290600401611cf4565b600060405180830381600087803b15801561143857600080fd5b505af115801561144c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146e5761146e6114f4565b611479848484611522565b80610a7057610a70600e54600c55600f54600d55565b600080600061149c611619565b90925090506114ab82826114b2565b9250505090565b60006112e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165b565b600c541580156115045750600d54155b1561150b57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153487611689565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156690876116e6565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115959086611728565b6001600160a01b0389166000908152600260205260409020556115b781611787565b6115c184836117d1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160691815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061163582826114b2565b82101561165257505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361167c5760405162461bcd60e51b81526004016106279190611a1c565b5060006112208486611d65565b60008060008060008060008060006116a68a600c54600d546117f5565b92509250925060006116b661148f565b905060008060006116c98e87878761184a565b919e509c509a509598509396509194505050505091939550919395565b60006112e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ef565b6000806117358385611ca8565b9050838110156112e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b600061179161148f565b9050600061179f838361189a565b306000908152600260205260409020549091506117bc9082611728565b30600090815260026020526040902055505050565b6006546117de90836116e6565b6006556007546117ee9082611728565b6007555050565b600080808061180f6064611809898961189a565b906114b2565b9050600061182260646118098a8961189a565b9050600061183a826118348b866116e6565b906116e6565b9992985090965090945050505050565b6000808080611859888661189a565b90506000611867888761189a565b90506000611875888861189a565b905060006118878261183486866116e6565b939b939a50919850919650505050505050565b6000826000036118ac575060006106ad565b60006118b88385611d87565b9050826118c58583611d65565b146112e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b803561195281611932565b919050565b6000602080838503121561196a57600080fd5b823567ffffffffffffffff8082111561198257600080fd5b818501915085601f83011261199657600080fd5b8135818111156119a8576119a861191c565b8060051b604051601f19603f830116810181811085821117156119cd576119cd61191c565b6040529182528482019250838101850191888311156119eb57600080fd5b938501935b82851015611a1057611a0185611947565b845293850193928501926119f0565b98975050505050505050565b600060208083528351808285015260005b81811015611a4957858101830151858201604001528201611a2d565b81811115611a5b576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8457600080fd5b8235611a8f81611932565b946020939093013593505050565b600080600060608486031215611ab257600080fd5b8335611abd81611932565b92506020840135611acd81611932565b929592945050506040919091013590565b600060208284031215611af057600080fd5b81356112e081611932565b8035801515811461195257600080fd5b600060208284031215611b1d57600080fd5b6112e082611afb565b600060208284031215611b3857600080fd5b5035919050565b60008060008060808587031215611b5557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8657600080fd5b833567ffffffffffffffff80821115611b9e57600080fd5b818601915086601f830112611bb257600080fd5b813581811115611bc157600080fd5b8760208260051b8501011115611bd657600080fd5b602092830195509350611bec9186019050611afb565b90509250925092565b60008060408385031215611c0857600080fd5b8235611c1381611932565b91506020830135611c2381611932565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca157611ca1611c79565b5060010190565b60008219821115611cbb57611cbb611c79565b500190565b600082821015611cd257611cd2611c79565b500390565b600060208284031215611ce957600080fd5b81516112e081611932565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d445784516001600160a01b031683529383019391830191600101611d1f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da157611da1611c79565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201b15e65961be058ab15f889b3cabb41626f2f41b8057f2dc30cb5cc4c2ed980264736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,989 |
0x538d5DCb3BB96941C53d44F394EFE2BD293f89b0
|
/**
*Submitted for verification at Etherscan.io on 2022-02-24
*/
// 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 WWIII is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "World War III";
string private constant _symbol = "WWIII";
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 = 20000000000 * 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;
}
}
|
0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063d00efb2f1161008a578063d65169c911610064578063d65169c9146104fc578063dd62ed3e1461051c578063e01af92c14610562578063e47d60601461058257600080fd5b8063d00efb2f146104a6578063d477f05f146104bc578063d543dbeb146104dc57600080fd5b8063c0e6b46e116100c6578063c0e6b46e14610423578063c3c8cd8014610443578063c9567bf914610458578063cba0e9961461046d57600080fd5b806395d89b41146103b5578063a9059cbb146103e3578063b515566a1461040357600080fd5b8063437823ec116101595780636fc3eaec116101335780636fc3eaec1461034357806370a0823114610358578063715018a6146103785780638da5cb5b1461038d57600080fd5b8063437823ec146102e35780635932ead1146103035780635d098b381461032357600080fd5b806323b872dd1161019557806323b872dd14610265578063273123b71461028557806328667162146102a7578063313ce567146102c757600080fd5b806306fdde03146101c7578063095ea7b31461020f57806318160ddd1461023f57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152600d81526c576f726c64205761722049494960981b60208201525b6040516102069190611d90565b60405180910390f35b34801561021b57600080fd5b5061022f61022a366004611c21565b6105bb565b6040519015158152602001610206565b34801561024b57600080fd5b50683635c9adc5dea000005b604051908152602001610206565b34801561027157600080fd5b5061022f610280366004611be1565b6105d2565b34801561029157600080fd5b506102a56102a0366004611b71565b61063b565b005b3480156102b357600080fd5b506102a56102c2366004611d4b565b61068f565b3480156102d357600080fd5b5060405160098152602001610206565b3480156102ef57600080fd5b506102a56102fe366004611b71565b61071c565b34801561030f57600080fd5b506102a561031e366004611d13565b61076a565b34801561032f57600080fd5b506102a561033e366004611b71565b6107b2565b34801561034f57600080fd5b506102a56107fe565b34801561036457600080fd5b50610257610373366004611b71565b61082b565b34801561038457600080fd5b506102a561084d565b34801561039957600080fd5b506000546040516001600160a01b039091168152602001610206565b3480156103c157600080fd5b50604080518082019091526005815264575749494960d81b60208201526101f9565b3480156103ef57600080fd5b5061022f6103fe366004611c21565b6108c1565b34801561040f57600080fd5b506102a561041e366004611c4c565b6108ce565b34801561042f57600080fd5b506102a561043e366004611d4b565b610972565b34801561044f57600080fd5b506102a5610a11565b34801561046457600080fd5b506102a5610a47565b34801561047957600080fd5b5061022f610488366004611b71565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104b257600080fd5b5061025760165481565b3480156104c857600080fd5b506102a56104d7366004611b71565b610e0e565b3480156104e857600080fd5b506102a56104f7366004611d4b565b610e5a565b34801561050857600080fd5b506102a5610517366004611b71565b610f27565b34801561052857600080fd5b50610257610537366004611ba9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561056e57600080fd5b506102a561057d366004611d13565b610f73565b34801561058e57600080fd5b5061022f61059d366004611b71565b6001600160a01b03166000908152600e602052604090205460ff1690565b60006105c8338484610fb1565b5060015b92915050565b60006105df8484846110d5565b610631843361062c85604051806060016040528060288152602001611f61602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113b7565b610fb1565b5060019392505050565b6000546001600160a01b0316331461066e5760405162461bcd60e51b815260040161066590611de3565b60405180910390fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b6000546001600160a01b031633146106b95760405162461bcd60e51b815260040161066590611de3565b600181101580156106cb575060198111155b6107175760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d20323500000000006044820152606401610665565b600955565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161066590611de3565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146107945760405162461bcd60e51b815260040161066590611de3565b60148054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146107dc5760405162461bcd60e51b815260040161066590611de3565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b03161461081e57600080fd5b47610828816113f1565b50565b6001600160a01b0381166000908152600260205260408120546105cc90611486565b6000546001600160a01b031633146108775760405162461bcd60e51b815260040161066590611de3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006105c83384846110d5565b6000546001600160a01b031633146108f85760405162461bcd60e51b815260040161066590611de3565b60005b815181101561096e576001600e600084848151811061092a57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061096681611ef6565b9150506108fb565b5050565b6000546001600160a01b0316331461099c5760405162461bcd60e51b815260040161066590611de3565b600081116109ec5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610665565b610a0b612710610a05683635c9adc5dea000008461150a565b90611589565b600d5550565b6011546001600160a01b0316336001600160a01b031614610a3157600080fd5b6000610a3c3061082b565b9050610828816115cb565b6000546001600160a01b03163314610a715760405162461bcd60e51b815260040161066590611de3565b601454600160a01b900460ff1615610acb5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610665565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610b083082683635c9adc5dea00000610fb1565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4157600080fd5b505afa158015610b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b799190611b8d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc157600080fd5b505afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf99190611b8d565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c4157600080fd5b505af1158015610c55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c799190611b8d565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610ca98161082b565b600080610cbe6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610d2157600080fd5b505af1158015610d35573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d5a9190611d63565b5050601480546801158e460913d000006015554360165563ffff00ff60a01b1981166201000160a01b1790915560135460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610dd657600080fd5b505af1158015610dea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096e9190611d2f565b6000546001600160a01b03163314610e385760405162461bcd60e51b815260040161066590611de3565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610e845760405162461bcd60e51b815260040161066590611de3565b60008111610ed45760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610665565b610eec6064610a05683635c9adc5dea000008461150a565b60158190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b03163314610f515760405162461bcd60e51b815260040161066590611de3565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b031614610f9357600080fd5b60148054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b0383166110135760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610665565b6001600160a01b0382166110745760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610665565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111395760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610665565b6001600160a01b03821661119b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610665565b600081116111fd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610665565b6000546001600160a01b0384811691161480159061122957506000546001600160a01b03838116911614155b1561135a576001600160a01b038316301461124d5760155481111561124d57600080fd5b6001600160a01b0383166000908152600e602052604090205460ff1615801561128f57506001600160a01b0382166000908152600e602052604090205460ff16155b80156112ab5750336000908152600e602052604090205460ff16155b6112b457600080fd5b60006112bf3061082b565b9050600d5481106112cf5750600d545b600c546014549082101590600160a81b900460ff161580156112fa5750601454600160b01b900460ff165b80156113035750805b801561131d57506014546001600160a01b03868116911614155b801561133757506013546001600160a01b03868116911614155b1561135757611345826115cb565b47801561135557611355476113f1565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061139c57506001600160a01b03831660009081526005602052604090205460ff165b156113a5575060005b6113b184848484611770565b50505050565b600081848411156113db5760405162461bcd60e51b81526004016106659190611d90565b5060006113e88486611edf565b95945050505050565b6010546001600160a01b03166108fc611416600661141085600a611589565b9061150a565b6040518115909202916000818181858888f1935050505015801561143e573d6000803e3d6000fd5b506012546001600160a01b03166108fc61145e600461141085600a611589565b6040518115909202916000818181858888f1935050505015801561096e573d6000803e3d6000fd5b60006006548211156114ed5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610665565b60006114f761179e565b90506115038382611589565b9392505050565b600082611519575060006105cc565b60006115258385611ec0565b9050826115328583611ea0565b146115035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610665565b600061150383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117c1565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061162157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561167557600080fd5b505afa158015611689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ad9190611b8d565b816001815181106116ce57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546116f49130911684610fb1565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac9479061172d908590600090869030904290600401611e18565b600060405180830381600087803b15801561174757600080fd5b505af115801561175b573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061177d5761177d6117ef565b61178884848461181d565b806113b1576113b1600a54600855600b54600955565b60008060006117ab611914565b90925090506117ba8282611589565b9250505090565b600081836117e25760405162461bcd60e51b81526004016106659190611d90565b5060006113e88486611ea0565b6008541580156117ff5750600954155b1561180657565b60088054600a5560098054600b5560009182905555565b60008060008060008061182f87611956565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061186190876119b3565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461189090866119f5565b6001600160a01b0389166000908152600260205260409020556118b281611a54565b6118bc8483611a9e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161190191815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006119308282611589565b82101561194d57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006119738a600854600954611ac2565b925092509250600061198361179e565b905060008060006119968e878787611b11565b919e509c509a509598509396509194505050505091939550919395565b600061150383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113b7565b600080611a028385611e88565b9050838110156115035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610665565b6000611a5e61179e565b90506000611a6c838361150a565b30600090815260026020526040902054909150611a8990826119f5565b30600090815260026020526040902055505050565b600654611aab90836119b3565b600655600754611abb90826119f5565b6007555050565b6000808080611ad66064610a05898961150a565b90506000611ae96064610a058a8961150a565b90506000611b0182611afb8b866119b3565b906119b3565b9992985090965090945050505050565b6000808080611b20888661150a565b90506000611b2e888761150a565b90506000611b3c888861150a565b90506000611b4e82611afb86866119b3565b939b939a50919850919650505050505050565b8035611b6c81611f3d565b919050565b600060208284031215611b82578081fd5b813561150381611f3d565b600060208284031215611b9e578081fd5b815161150381611f3d565b60008060408385031215611bbb578081fd5b8235611bc681611f3d565b91506020830135611bd681611f3d565b809150509250929050565b600080600060608486031215611bf5578081fd5b8335611c0081611f3d565b92506020840135611c1081611f3d565b929592945050506040919091013590565b60008060408385031215611c33578182fd5b8235611c3e81611f3d565b946020939093013593505050565b60006020808385031215611c5e578182fd5b823567ffffffffffffffff80821115611c75578384fd5b818501915085601f830112611c88578384fd5b813581811115611c9a57611c9a611f27565b8060051b604051601f19603f83011681018181108582111715611cbf57611cbf611f27565b604052828152858101935084860182860187018a1015611cdd578788fd5b8795505b83861015611d0657611cf281611b61565b855260019590950194938601938601611ce1565b5098975050505050505050565b600060208284031215611d24578081fd5b813561150381611f52565b600060208284031215611d40578081fd5b815161150381611f52565b600060208284031215611d5c578081fd5b5035919050565b600080600060608486031215611d77578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dbc57858101830151858201604001528201611da0565b81811115611dcd5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e675784516001600160a01b031683529383019391830191600101611e42565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e9b57611e9b611f11565b500190565b600082611ebb57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611eda57611eda611f11565b500290565b600082821015611ef157611ef1611f11565b500390565b6000600019821415611f0a57611f0a611f11565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082857600080fd5b801515811461082857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cc068cc32ef1cf753c2777ac7b786f2333b35aadee8424454503416c708f3a2b64736f6c63430008040033
|
{"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"}]}}
| 2,990 |
0x35f0b2627c460c67c2a833c103ea05d3145d7506
|
/**
*Submitted for verification at Etherscan.io on 2022-03-16
*/
/**
web: coming soon
t.me/FuryInuETH
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FuryInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Fury Inu";
string private constant _symbol = "FURYINU";
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 = 1000000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 10;
//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(0xA948c320Ac634d1505D8be1c89bF9359fBB8732e);
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 = 5000000000 * 10**9;
uint256 public _maxWalletSize = 10000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 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;
}
}
|
0x6080604052600436106101d05760003560e01c806370a08231116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80637d1db4a5116100d15780637d1db4a5146104f45780638da5cb5b1461051f5780638eb59a5f1461054a5780638f9a55c014610561576101d7565b806370a0823114610477578063715018a6146104b457806374010ece146104cb576101d7565b80632fd689e31161016f578063658d4b7f1161013e578063658d4b7f146103d357806367243482146103fc5780636b999053146104255780636d8aa8f81461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f57806353482196146103aa576101d7565b80630e66e7f1116101ab5780630e66e7f11461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612e46565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190612f17565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f6f565b61084e565b6040516102649190612fca565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190613011565b61086c565b005b3480156102a257600080fd5b506102ab610905565b6040516102b8919061309d565b60405180910390f35b3480156102cd57600080fd5b506102d661092b565b6040516102e391906130c7565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e91906130e2565b610935565b6040516103209190612fca565b60405180910390f35b34801561033557600080fd5b5061033e610a0e565b60405161034b91906130c7565b60405180910390f35b34801561036057600080fd5b50610369610a14565b6040516103769190613151565b60405180910390f35b34801561038b57600080fd5b50610394610a1d565b6040516103a1919061317b565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190613196565b610a43565b005b3480156103df57600080fd5b506103fa60048036038101906103f591906131d6565b610ad1565b005b34801561040857600080fd5b50610423600480360381019061041e91906132c7565b610ba8565b005b34801561043157600080fd5b5061044c60048036038101906104479190613348565b610c98565b005b34801561045a57600080fd5b5061047560048036038101906104709190613011565b610d6f565b005b34801561048357600080fd5b5061049e60048036038101906104999190613348565b610e08565b6040516104ab91906130c7565b60405180910390f35b3480156104c057600080fd5b506104c9610e51565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190613375565b610ed9565b005b34801561050057600080fd5b50610509610f5f565b60405161051691906130c7565b60405180910390f35b34801561052b57600080fd5b50610534610f65565b604051610541919061317b565b60405180910390f35b34801561055657600080fd5b5061055f610f8e565b005b34801561056d57600080fd5b50610576611036565b60405161058391906130c7565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190612f17565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613375565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f6f565b6110ff565b6040516106149190612fca565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190613348565b61111d565b6040516106519190612fca565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b50610698600480360381019061069391906133a2565b6111d2565b6040516106a591906130c7565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613375565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190613348565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610f65565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107739061342e565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a061344e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610805906134ac565b91505061077f565b5050565b60606040518060400160405280600881526020017f4675727920496e75000000000000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610f65565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df9061342e565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610942848484611668565b610a038461094e611495565b6109fe85604051806060016040528060288152602001613f9060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109b4611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a4b611495565b73ffffffffffffffffffffffffffffffffffffffff16610a69610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610abf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab69061342e565b60405180910390fd5b81600681905550806007819055505050565b610ad9611495565b73ffffffffffffffffffffffffffffffffffffffff16610af7610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b449061342e565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bb0611495565b73ffffffffffffffffffffffffffffffffffffffff16610bce610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b9061342e565b60405180910390fd5b60005b84849050811015610c9157610c7d33868684818110610c4957610c4861344e565b5b9050602002016020810190610c5e9190613348565b858585818110610c7157610c7061344e565b5b90506020020135612062565b508080610c89906134ac565b915050610c27565b5050505050565b610ca0611495565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b9061342e565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d77611495565b73ffffffffffffffffffffffffffffffffffffffff16610d95610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610deb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de29061342e565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e59611495565b73ffffffffffffffffffffffffffffffffffffffff16610e77610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec49061342e565b60405180910390fd5b610ed76000612235565b565b610ee1611495565b73ffffffffffffffffffffffffffffffffffffffff16610eff610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c9061342e565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f96611495565b73ffffffffffffffffffffffffffffffffffffffff16610fb4610f65565b73ffffffffffffffffffffffffffffffffffffffff161461100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110019061342e565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b600f5481565b60606040518060400160405280600781526020017f46555259494e5500000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec9061342e565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610f65565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b09061342e565b60405180910390fd5b60006111c430610e08565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc9061342e565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610f65565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113529061342e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613567565b60405180910390fd5b6000600460006113d9610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906135f9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115749061368b565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906130c7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf9061371d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f906137af565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613841565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906138ad565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613919565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906139ab565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb91906139cb565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1091906139cb565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613a93565b60405180910390fd5b5b600f5481611b5f84610e08565b611b6991906139cb565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba090613b25565b60405180910390fd5b5b6000611bb530610e08565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190612f17565b60405180910390fd5b50600083856120559190613b45565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906130c7565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d9190613b45565b905060004790506000600267ffffffffffffffff81111561237157612370612ca5565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b661344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613b8e565b816001815181106124a5576124a461344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613cb4565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af91906139cb565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb90613d5a565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f9190613d7a565b905082848261272e9190613e03565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613ea6565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a296959493929190613ec6565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f49190613f3c565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906130c7565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190612f17565b60405180910390fd5b5060008385612b2b9190613e03565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906130c7565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612cdd82612c94565b810181811067ffffffffffffffff82111715612cfc57612cfb612ca5565b5b80604052505050565b6000612d0f612c7b565b9050612d1b8282612cd4565b919050565b600067ffffffffffffffff821115612d3b57612d3a612ca5565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d7c82612d51565b9050919050565b612d8c81612d71565b8114612d9757600080fd5b50565b600081359050612da981612d83565b92915050565b6000612dc2612dbd84612d20565b612d05565b90508083825260208201905060208402830185811115612de557612de4612d4c565b5b835b81811015612e0e5780612dfa8882612d9a565b845260208401935050602081019050612de7565b5050509392505050565b600082601f830112612e2d57612e2c612c8f565b5b8135612e3d848260208601612daf565b91505092915050565b600060208284031215612e5c57612e5b612c85565b5b600082013567ffffffffffffffff811115612e7a57612e79612c8a565b5b612e8684828501612e18565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ec9578082015181840152602081019050612eae565b83811115612ed8576000848401525b50505050565b6000612ee982612e8f565b612ef38185612e9a565b9350612f03818560208601612eab565b612f0c81612c94565b840191505092915050565b60006020820190508181036000830152612f318184612ede565b905092915050565b6000819050919050565b612f4c81612f39565b8114612f5757600080fd5b50565b600081359050612f6981612f43565b92915050565b60008060408385031215612f8657612f85612c85565b5b6000612f9485828601612d9a565b9250506020612fa585828601612f5a565b9150509250929050565b60008115159050919050565b612fc481612faf565b82525050565b6000602082019050612fdf6000830184612fbb565b92915050565b612fee81612faf565b8114612ff957600080fd5b50565b60008135905061300b81612fe5565b92915050565b60006020828403121561302757613026612c85565b5b600061303584828501612ffc565b91505092915050565b6000819050919050565b600061306361305e61305984612d51565b61303e565b612d51565b9050919050565b600061307582613048565b9050919050565b60006130878261306a565b9050919050565b6130978161307c565b82525050565b60006020820190506130b2600083018461308e565b92915050565b6130c181612f39565b82525050565b60006020820190506130dc60008301846130b8565b92915050565b6000806000606084860312156130fb576130fa612c85565b5b600061310986828701612d9a565b935050602061311a86828701612d9a565b925050604061312b86828701612f5a565b9150509250925092565b600060ff82169050919050565b61314b81613135565b82525050565b60006020820190506131666000830184613142565b92915050565b61317581612d71565b82525050565b6000602082019050613190600083018461316c565b92915050565b600080604083850312156131ad576131ac612c85565b5b60006131bb85828601612f5a565b92505060206131cc85828601612f5a565b9150509250929050565b600080604083850312156131ed576131ec612c85565b5b60006131fb85828601612d9a565b925050602061320c85828601612ffc565b9150509250929050565b600080fd5b60008083601f84011261323157613230612c8f565b5b8235905067ffffffffffffffff81111561324e5761324d613216565b5b60208301915083602082028301111561326a57613269612d4c565b5b9250929050565b60008083601f84011261328757613286612c8f565b5b8235905067ffffffffffffffff8111156132a4576132a3613216565b5b6020830191508360208202830111156132c0576132bf612d4c565b5b9250929050565b600080600080604085870312156132e1576132e0612c85565b5b600085013567ffffffffffffffff8111156132ff576132fe612c8a565b5b61330b8782880161321b565b9450945050602085013567ffffffffffffffff81111561332e5761332d612c8a565b5b61333a87828801613271565b925092505092959194509250565b60006020828403121561335e5761335d612c85565b5b600061336c84828501612d9a565b91505092915050565b60006020828403121561338b5761338a612c85565b5b600061339984828501612f5a565b91505092915050565b600080604083850312156133b9576133b8612c85565b5b60006133c785828601612d9a565b92505060206133d885828601612d9a565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613418602083612e9a565b9150613423826133e2565b602082019050919050565b600060208201905081810360008301526134478161340b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006134b782612f39565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134ea576134e961347d565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613551602683612e9a565b915061355c826134f5565b604082019050919050565b6000602082019050818103600083015261358081613544565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006135e3602483612e9a565b91506135ee82613587565b604082019050919050565b60006020820190508181036000830152613612816135d6565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613675602283612e9a565b915061368082613619565b604082019050919050565b600060208201905081810360008301526136a481613668565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613707602583612e9a565b9150613712826136ab565b604082019050919050565b60006020820190508181036000830152613736816136fa565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613799602383612e9a565b91506137a48261373d565b604082019050919050565b600060208201905081810360008301526137c88161378c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061382b602983612e9a565b9150613836826137cf565b604082019050919050565b6000602082019050818103600083015261385a8161381e565b9050919050565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b6000613897601e83612e9a565b91506138a282613861565b602082019050919050565b600060208201905081810360008301526138c68161388a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613903601c83612e9a565b915061390e826138cd565b602082019050919050565b60006020820190508181036000830152613932816138f6565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613995602383612e9a565b91506139a082613939565b604082019050919050565b600060208201905081810360008301526139c481613988565b9050919050565b60006139d682612f39565b91506139e183612f39565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a1657613a1561347d565b5b828201905092915050565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b6000613a7d602683612e9a565b9150613a8882613a21565b604082019050919050565b60006020820190508181036000830152613aac81613a70565b9050919050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b0f602383612e9a565b9150613b1a82613ab3565b604082019050919050565b60006020820190508181036000830152613b3e81613b02565b9050919050565b6000613b5082612f39565b9150613b5b83612f39565b925082821015613b6e57613b6d61347d565b5b828203905092915050565b600081519050613b8881612d83565b92915050565b600060208284031215613ba457613ba3612c85565b5b6000613bb284828501613b79565b91505092915050565b6000819050919050565b6000613be0613bdb613bd684613bbb565b61303e565b612f39565b9050919050565b613bf081613bc5565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c2b81612d71565b82525050565b6000613c3d8383613c22565b60208301905092915050565b6000602082019050919050565b6000613c6182613bf6565b613c6b8185613c01565b9350613c7683613c12565b8060005b83811015613ca7578151613c8e8882613c31565b9750613c9983613c49565b925050600181019050613c7a565b5085935050505092915050565b600060a082019050613cc960008301886130b8565b613cd66020830187613be7565b8181036040830152613ce88186613c56565b9050613cf7606083018561316c565b613d0460808301846130b8565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613d44601b83612e9a565b9150613d4f82613d0e565b602082019050919050565b60006020820190508181036000830152613d7381613d37565b9050919050565b6000613d8582612f39565b9150613d9083612f39565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dc957613dc861347d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e0e82612f39565b9150613e1983612f39565b925082613e2957613e28613dd4565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e90602183612e9a565b9150613e9b82613e34565b604082019050919050565b60006020820190508181036000830152613ebf81613e83565b9050919050565b600060c082019050613edb600083018961316c565b613ee860208301886130b8565b613ef56040830187613be7565b613f026060830186613be7565b613f0f608083018561316c565b613f1c60a08301846130b8565b979650505050505050565b600081519050613f3681612f43565b92915050565b600080600060608486031215613f5557613f54612c85565b5b6000613f6386828701613f27565b9350506020613f7486828701613f27565b9250506040613f8586828701613f27565b915050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200f1d648eca1df7e532e427610633631f28c9a562271a41c9832e24807c16ac4f64736f6c63430008090033
|
{"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"}]}}
| 2,991 |
0xc4df8b84a0df98e8a8f169a1b4551397de7f9cb4
|
//Salt Bae Inu (SaltBaeInu)
//TG: https://t.me/saltbaeinu
//Twitter: https://twitter.com/inu_salt
//Website: TBA
/*
.....................................................................................
....................................:O8@8O8:.........................................
..................................8@@Oo@@o::8O.......................................
...................8:O:oo:......:@@@@8@88oOoo:8:.....................................
...................8oo8o:8:O....@@8oo8@888OOo::8.....................................
..............ooo8.8ooooOo::8..@@@8OOO@888@@O::O:....................................
...............OOoo8OOOOOOo:8.o@@8OoooooO@@O:o:oO....................................
................:@OoooOOOOOO:8:8@OoooooooooO8ooO:....................................
..................O8ooooooooo@.O8o8OoooooOOOOOO8.....................................
....................8Oooooooo8.88ooOOo8oooOOOO@......................................
.....................@OoOOO8@..:OOO@@88:8@88@o.......................................
.....................8Ooo:oOo..o88OooOO:OOOOoOO888:..................................
.....................O8Oo::o8:.OO8O88@OO8Oo8Ooo:.::.o................................
.....................888Oooo8....o@OOOoOO@Oooo8::.:o.:...............................
.....................@8oOo:oo8..:oOO@OO888oooo:oO.:::8...............................
....................o8OoOo:::oO...oo.ooOooooo:ooOO..:o...............................
....................8OoOOoooooOooo:..:o:.8OOOoooOO:..8...............................
...................:8OOOOooo:::8ooooo:...:oo:oOoo:...:o..............................
...................88OOooooooo::8oo::o::o:...:o:.....8:o.............................
...................88OOoooooooooOoooo..oo.:ooo::ooo..8OO:............................
...................o88Ooooooo:ooOOooooo..oo:.:oooooo88oo8............................
....................88OOooooo:oOOoOoo:oo:.:.oo......:8Oooo...........................
.....................88OOOooo:oOOOooooooooo....oo....8OOo@...........................
.......................O@@@@8OOOoooOooooooooo:.......8OOo8...........................
...........................@OOoOoO:ooooooooo:..:oo..:8OOO8:..........................
............................@oOOooooo:ooooooooo:...:.88OoO:..........................
............................88oOOoOoooooooooooooo:...888ooo..........................
.............................@OOOOOOOooooooooooooo:..88888::.........................
.............................8OOoOOOOooooooooo:oooo..88@8o8:.........................
.............................O@oOOOOOOOo:oooooooo:...@8o:o:o8........................
.............................O@ooooooooooooooooOoOOo8@@8OOOo:o.......................
.............................@@@@@8OOooooooooOooooO@@@@88@@O:O.......................
............................:@@@@O@@@8OO8@O@@@@8:::@@@@@@@@8oo.......................
.................OooO...:o:.:@@@8@@@@@o.O@@8.@@@O..@@@@@@@@@@......::................
...............O8.@OO88.:8:.88.::..8@O:.O8:...:@O..:...8@..:..o:O:.oO.oO.............
..............:@8:@:@@8....o@@8@8:.:@@:.O@@..@@@O..@@o.:@8@8o..@:..::..O:............
..............oO:oo:O8O.O@o.8:.o@..:@@o.O@@..88oO..@@:.:O..@O..@o..@@@@o.............
...............OO@88..o8o:o8:OOoOOOo88OOO8.OOO8:8OO8OO8:oOoOO8oOoOOooOO..............
.....................................................................................
*/
//Limit Buy
//Cooldown
//Bot Protect
//Liqudity dev provides and lock
//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 SaltBaeInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Salt Bae Inu";
string private constant _symbol = "\xF0\x9F\xA7\x82SALTINU\xF0\x9F\xA5\xA9";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600c81526020017f53616c742042616520496e750000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600f81526020017ff09fa78253414c54494e55f09fa5a90000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204026ee40e70c051bdfaed91953ec70636a828c72b0eb5065deb0d86d66ef640f64736f6c63430008040033
|
{"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"}]}}
| 2,992 |
0x53877b7c93c80c9631c73c5feda1e421d836a39c
|
/*
This file is part of the Cryptaur Contract.
The CryptaurToken Contract is free software: you can redistribute it and/or
modify it under the terms of the GNU lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. See the GNU lesser General Public License
for more details.
You should have received a copy of the GNU lesser General Public License
along with the CryptaurToken Contract. If not, see <http://www.gnu.org/licenses/>.
@author Ilya Svirin <<span class="__cf_email__" data-cfemail="9ef7b0ede8f7ecf7f0def0f1ecfaffe8f7f0fab0eceb">[email protected]</span>>
Donation address 0x3Ad38D1060d1c350aF29685B2b8Ec3eDE527452B
*/
pragma solidity ^0.4.19;
contract owned {
address public owner;
address public candidate;
function owned() payable public {
owner = msg.sender;
}
modifier onlyOwner {
require(owner == msg.sender);
_;
}
function changeOwner(address _owner) onlyOwner public {
candidate = _owner;
}
function confirmOwner() public {
require(candidate == msg.sender);
owner = candidate;
delete candidate;
}
}
/**
* @title Part of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Base {
uint public totalSupply;
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
}
contract CryptaurRewards {
function payment(address _buyer, address _seller, uint _amount, address _opinionLeader) public returns(uint fee);
}
contract CryputarReserveFund {
function depositNotification(uint _amount) public;
function withdrawNotification(uint _amount) public;
}
/**
* @title Allows to store liked adsress(slave address) connected to the main address (master address)
*/
contract AddressBook {
struct AddressRelations {
SlaveDictionary slaves;
bool hasValue;
}
struct SlaveDictionary
{
address[] values;
mapping(address => uint) keys;
}
event WalletLinked(address indexed _master, address indexed _slave);
event WalletUnlinked(address indexed _master, address indexed _slave);
event AddressChanged(address indexed _old, address indexed _new);
mapping(address => AddressRelations) private masterToSlaves;
mapping(address => address) private slaveToMasterAddress;
uint8 public maxLinkedWalletCount = 5;
/**
* Only owner of master wallet can add additional wallet.
*/
function linkToMasterWalletInternal(address _masterWallet, address _linkedWallet) internal {
require(_masterWallet != _linkedWallet && _linkedWallet != address(0));
require(isMasterWallet(_masterWallet));
require(!isLinkedWallet(_linkedWallet) && !isMasterWallet(_linkedWallet));
AddressRelations storage rel = masterToSlaves[_masterWallet];
require(rel.slaves.values.length < maxLinkedWalletCount);
rel.slaves.values.push(_linkedWallet);
rel.slaves.keys[_linkedWallet] = rel.slaves.values.length - 1;
slaveToMasterAddress[_linkedWallet] = _masterWallet;
WalletLinked(_masterWallet, _linkedWallet);
}
function unLinkFromMasterWalletInternal(address _masterWallet, address _linkedWallet) internal {
require(_masterWallet != _linkedWallet && _linkedWallet != address(0));
require(_masterWallet == getMasterWallet(_linkedWallet));
SlaveDictionary storage slaves = masterToSlaves[_masterWallet].slaves;
uint indexToDelete = slaves.keys[_linkedWallet];
address keyToMove = slaves.values[slaves.values.length - 1];
slaves.values[indexToDelete] = keyToMove;
slaves.keys[keyToMove] = indexToDelete;
slaves.values.length--;
delete slaves.keys[_linkedWallet];
delete slaveToMasterAddress[_linkedWallet];
WalletUnlinked(_masterWallet, _linkedWallet);
}
function getLinkedWallets(address _wallet) public view returns (address[]) {
return masterToSlaves[_wallet].slaves.values;
}
function isMasterWallet(address _addr) internal constant returns (bool) {
return masterToSlaves[_addr].hasValue;
}
function isLinkedWallet(address _addr) internal constant returns (bool) {
return slaveToMasterAddress[_addr] != address(0);
}
/**
* Guess that address book already had changing address.
*/
function applyChangeWalletAddress(address _old, address _new) internal {
require(isMasterWallet(_old) || isLinkedWallet(_old));
require(_new != address(0));
if (isMasterWallet(_old)) {
// Cannt change master address with existed linked
require(!isLinkedWallet(_new));
require(masterToSlaves[_new].slaves.values.length == 0);
changeMasterAddress(_old, _new);
}
else {
// Cannt change linked address with existed master and linked to another master
require(!isMasterWallet(_new) && !isLinkedWallet(_new));
changeLinkedAddress(_old, _new);
}
}
function changeLinkedAddress(address _old, address _new) private {
slaveToMasterAddress[_new] = slaveToMasterAddress[_old];
SlaveDictionary storage slaves = masterToSlaves[slaveToMasterAddress[_new]].slaves;
uint index = slaves.keys[_old];
slaves.values[index] = _new;
delete slaveToMasterAddress[_old];
}
function changeMasterAddress(address _old, address _new) private {
masterToSlaves[_new] = masterToSlaves[_old];
SlaveDictionary storage slaves = masterToSlaves[_new].slaves;
for (uint8 i = 0; i < slaves.values.length; ++i)
slaveToMasterAddress[slaves.values[i]] = _new;
delete masterToSlaves[_old];
}
function addMasterWallet(address _master) internal {
require(_master != address(0));
masterToSlaves[_master].hasValue = true;
}
function getMasterWallet(address _wallet) internal constant returns(address) {
if(isMasterWallet(_wallet))
return _wallet;
return slaveToMasterAddress[_wallet];
}
/**
* Try to find master address by any other; otherwise add to address book as master.
*/
function getOrAddMasterWallet(address _wallet) internal returns (address) {
address masterWallet = getMasterWallet(_wallet);
if (masterWallet == address(0))
addMasterWallet(_wallet);
return _wallet;
}
}
contract CryptaurDepository is owned, AddressBook {
enum UnlimitedMode {UNLIMITED,LIMITED}
event Deposit(address indexed _who, uint _amount, bytes32 _txHash);
event Withdraw(address indexed _who, uint _amount);
event Payment(address indexed _buyer, address indexed _seller, uint _amount, address indexed _opinionLeader, bool _dapp);
event Freeze(address indexed _who, bool _freeze);
event Share(address indexed _who, address indexed _dapp, uint _amount);
ERC20Base cryptaurToken = ERC20Base(0x88d50B466BE55222019D71F9E8fAe17f5f45FCA1);
address cryptaurRecovery;
address cryptaurRewards;
address cryptaurReserveFund;
address backend;
modifier onlyBackend {
require(backend == msg.sender);
_;
}
modifier onlyOwnerOrBackend {
require(owner == msg.sender || backend == msg.sender);
_;
}
modifier notFreezed {
require(freezedAll != true);
_;
}
mapping(address => uint) internal balances;
mapping(address => mapping (address => uint256)) public available;
mapping(address => bool) public freezed;
mapping(address => mapping(address => UnlimitedMode)) public unlimitedMode;
bool freezedAll;
function CryptaurDepository() owned() public {}
function balanceOf(address _who) constant public returns (uint) {
return balances[getMasterWallet(_who)];
}
function setUnlimitedMode(bool _unlimited, address _dapp) public {
address masterWallet = getOrAddMasterWallet(msg.sender);
unlimitedMode[masterWallet][_dapp] = _unlimited ? UnlimitedMode.UNLIMITED : UnlimitedMode.LIMITED;
}
function transferToToken(address[] _addresses) public onlyOwnerOrBackend {
for (uint index = 0; index < _addresses.length; index++) {
address addr = _addresses[index];
uint amount = balances[addr];
if (amount > 0) {
balances[addr] = 0;
cryptaurToken.transfer(addr, amount);
Withdraw(addr, amount);
}
}
}
function setBackend(address _backend) onlyOwner public {
backend = _backend;
}
function setCryptaurRecovery(address _cryptaurRecovery) onlyOwner public {
cryptaurRecovery = _cryptaurRecovery;
}
function setCryptaurToken(address _cryptaurToken) onlyOwner public {
cryptaurToken = ERC20Base(_cryptaurToken);
}
function setCryptaurRewards(address _cryptaurRewards) onlyOwner public {
cryptaurRewards = _cryptaurRewards;
}
function setCryptaurReserveFund(address _cryptaurReserveFund) onlyOwner public {
cryptaurReserveFund = _cryptaurReserveFund;
}
function changeAddress(address _old, address _new) public {
require(msg.sender == cryptaurRecovery);
applyChangeWalletAddress(_old, _new);
balances[_new] += balances[_old];
balances[_old] = 0;
AddressChanged(_old, _new);
}
function linkToMasterWallet(address _masterWaller, address _linkedWaller) public {
require(msg.sender == owner || msg.sender == backend || msg.sender == cryptaurRecovery);
linkToMasterWalletInternal(_masterWaller, _linkedWaller);
}
function unLinkFromMasterWallet(address _masterWaller, address _linkedWaller) public {
require(msg.sender == owner || msg.sender == backend || msg.sender == cryptaurRecovery);
unLinkFromMasterWalletInternal(_masterWaller, _linkedWaller);
}
function setMaxLinkedWalletCount(uint8 _newMaxCount) public onlyOwnerOrBackend {
maxLinkedWalletCount = _newMaxCount;
}
function freeze(address _who, bool _freeze) onlyOwner public {
address masterWallet = getMasterWallet(_who);
if (masterWallet == address(0))
masterWallet = _who;
freezed[masterWallet] = _freeze;
Freeze(masterWallet, _freeze);
}
function freeze(bool _freeze) public onlyOwnerOrBackend {
freezedAll = _freeze;
}
function deposit(address _who, uint _amount, bytes32 _txHash) onlyBackend public {
address masterWallet = getOrAddMasterWallet(_who);
balances[masterWallet] += _amount;
Deposit(masterWallet, _amount, _txHash);
}
function withdraw(uint _amount) public notFreezed {
address masterWallet = getMasterWallet(msg.sender);
require(balances[masterWallet] >= _amount);
require(!freezed[masterWallet]);
balances[masterWallet] -= _amount;
cryptaurToken.transfer(masterWallet, _amount);
Withdraw(masterWallet, _amount);
}
function balanceOf2(address _who, address _dapp) constant public returns (uint) {
return balanceOf2Internal(getMasterWallet(_who), _dapp);
}
function balanceOf2Internal(address _who, address _dapp) constant internal returns (uint) {
uint avail;
if (!freezed[_who]) {
if (unlimitedMode[_who][_dapp] == UnlimitedMode.UNLIMITED) {
avail = balances[_who];
}
else {
avail = available[_who][_dapp];
if (avail > balances[_who])
avail = balances[_who];
}
}
return avail;
}
/**
* @dev Function pay wrapper. Using only for dapp.
*/
function pay2(address _seller, uint _amount, address _opinionLeader) public notFreezed {
address dapp = getOrAddMasterWallet(msg.sender);
address seller = getOrAddMasterWallet(_seller);
payInternal(dapp, seller, _amount, _opinionLeader);
available[seller][dapp] += _amount;
}
function pay(address _seller, uint _amount, address _opinionLeader) public notFreezed {
address buyer = getOrAddMasterWallet(msg.sender);
address seller = getOrAddMasterWallet(_seller);
payInternal(buyer, seller, _amount, _opinionLeader);
}
/**
* @dev Common internal pay function.
* OpinionLeader is optional, can be zero.
*/
function payInternal(address _buyer, address _seller, uint _amount, address _opinionLeader) internal {
require(balances[_buyer] >= _amount);
uint fee;
if (cryptaurRewards != 0 && cryptaurReserveFund != 0) {
fee = CryptaurRewards(cryptaurRewards).payment(_buyer, _seller, _amount, _opinionLeader);
}
balances[_buyer] -= _amount;
balances[_seller] += _amount - fee;
if (fee != 0) {
balances[cryptaurReserveFund] += fee;
CryputarReserveFund(cryptaurReserveFund).depositNotification(_amount);
}
Payment(_buyer, _seller, _amount, _opinionLeader, false);
}
function payDAPP(address _buyer, uint _amount, address _opinionLeader) public notFreezed {
address buyerMasterWallet = getOrAddMasterWallet(_buyer);
require(balanceOf2Internal(buyerMasterWallet, msg.sender) >= _amount);
uint fee;
if (cryptaurRewards != 0 && cryptaurReserveFund != 0) {
fee = CryptaurRewards(cryptaurRewards).payment(buyerMasterWallet, msg.sender, _amount, _opinionLeader);
}
balances[buyerMasterWallet] -= _amount;
balances[msg.sender] += _amount - fee;
if (unlimitedMode[buyerMasterWallet][msg.sender] == UnlimitedMode.LIMITED)
available[buyerMasterWallet][msg.sender] -= _amount;
if (fee != 0) {
balances[cryptaurReserveFund] += fee;
CryputarReserveFund(cryptaurReserveFund).depositNotification(_amount);
}
Payment(buyerMasterWallet, msg.sender, _amount, _opinionLeader, true);
}
function shareBalance(address _dapp, uint _amount) public notFreezed {
address masterWallet = getMasterWallet(msg.sender);
require(masterWallet != address(0));
available[masterWallet][_dapp] = _amount;
Share(masterWallet, _dapp, _amount);
}
function transferFromFund(address _to, uint _amount) public {
require(msg.sender == owner || msg.sender == cryptaurRewards || msg.sender == backend);
require(cryptaurReserveFund != address(0));
require(balances[cryptaurReserveFund] >= _amount);
address masterWallet = getOrAddMasterWallet(_to);
balances[masterWallet] += _amount;
balances[cryptaurReserveFund] -= _amount;
CryputarReserveFund(cryptaurReserveFund).withdrawNotification(_amount);
}
}
// test only
contract CryptaurDepositoryTest is CryptaurDepository {
function CryptaurDepositoryTest() CryptaurDepository() {}
// test only
function testDrip(address _who, address _dapp, uint _amount) public {
require(msg.sender == owner || msg.sender == backend);
address masterWallet = getOrAddMasterWallet(_who);
balances[masterWallet] = _amount;
available[masterWallet][_dapp] = _amount;
}
}
|
0x6060604052600436106101715763ffffffff60e060020a6000350416630c8dfeda8114610176578063203643061461019f57806322d4e0fd146101ba57806326b3293f146101e35780632e1a7d4d14610208578063406f11f51461021e578063416e70f61461025157806362f5a23f146102765780636c8381f8146102c55780636f2ed7e1146102f457806370a082311461033d57806371fcc6721461036e578063880e87ed1461038d5780638da5cb5b146103b157806390935301146103c457806396784f45146103e35780639e1c6d6b14610408578063a4d995221461042a578063a6f9dae114610449578063b0ddaddd14610468578063b5bf15e51461048a578063b6acd931146104a2578063bbe430de146104cb578063bd9b6d86146104f0578063bf120ae514610503578063cdb0ec6b14610527578063da7fc24f14610599578063de17dfa9146105b8578063efb7fa77146105d7578063efe08a7d146105fc578063f0fcc6bb14610621575b600080fd5b341561018157600080fd5b61018961064a565b60405160ff909116815260200160405180910390f35b34156101aa57600080fd5b6101b860ff60043516610653565b005b34156101c557600080fd5b6101b8600160a060020a03600435811690602435906044351661069f565b34156101ee57600080fd5b6101b8600160a060020a036004351660243560443561070f565b341561021357600080fd5b6101b860043561079b565b341561022957600080fd5b61023d600160a060020a03600435166108d9565b604051901515815260200160405180910390f35b341561025c57600080fd5b6101b8600160a060020a03600435811690602435166108ee565b341561028157600080fd5b6101b8600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061094b95505050505050565b34156102d057600080fd5b6102d8610aa8565b604051600160a060020a03909116815260200160405180910390f35b34156102ff57600080fd5b610319600160a060020a0360043581169060243516610ab7565b6040518082600181111561032957fe5b60ff16815260200191505060405180910390f35b341561034857600080fd5b61035c600160a060020a0360043516610ad7565b60405190815260200160405180910390f35b341561037957600080fd5b6101b8600160a060020a0360043516610b0f565b341561039857600080fd5b6101b86004351515600160a060020a0360243516610b4c565b34156103bc57600080fd5b6102d8610baa565b34156103cf57600080fd5b6101b8600160a060020a0360043516610bb9565b34156103ee57600080fd5b61035c600160a060020a0360043581169060243516610bf6565b341561041357600080fd5b6101b8600160a060020a0360043516602435610c11565b341561043557600080fd5b6101b8600160a060020a0360043516610d39565b341561045457600080fd5b6101b8600160a060020a0360043516610d76565b341561047357600080fd5b6101b8600160a060020a0360043516602435610db3565b341561049557600080fd5b6101b86004351515610e50565b34156104ad57600080fd5b6101b8600160a060020a036004358116906024359060443516610e99565b34156104d657600080fd5b61035c600160a060020a03600435811690602435166110fc565b34156104fb57600080fd5b6101b8611119565b341561050e57600080fd5b6101b8600160a060020a0360043516602435151561115b565b341561053257600080fd5b610546600160a060020a03600435166111f5565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561058557808201518382015260200161056d565b505050509050019250505060405180910390f35b34156105a457600080fd5b6101b8600160a060020a0360043516611279565b34156105c357600080fd5b6101b8600160a060020a03600435166112b6565b34156105e257600080fd5b6101b8600160a060020a0360043581169060243516611306565b341561060757600080fd5b6101b8600160a060020a036004358116906024351661135f565b341561062c57600080fd5b6101b8600160a060020a0360043581169060243590604435166113e7565b60045460ff1681565b60005433600160a060020a039081169116148061067e575060085433600160a060020a039081169116145b151561068957600080fd5b6004805460ff191660ff92909216919091179055565b600d54600090819060ff161515600114156106b957600080fd5b6106c23361142a565b91506106cd8561142a565b90506106db82828686611458565b600160a060020a039081166000908152600a6020908152604080832094909316825292909252902080549092019091555050565b60085460009033600160a060020a0390811691161461072d57600080fd5b6107368461142a565b600160a060020a03811660008181526009602052604090819020805487019055919250907f1a771fe656018364a9369da21954bb3081cb08b0196c27e43ca59c7cae87273790859085905191825260208201526040908101905180910390a250505050565b600d5460009060ff161515600114156107b357600080fd5b6107bc33611649565b600160a060020a038116600090815260096020526040902054909150829010156107e557600080fd5b600160a060020a0381166000908152600b602052604090205460ff161561080b57600080fd5b600160a060020a03808216600090815260096020526040908190208054859003905560045461010090049091169063a9059cbb90839085905160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561088457600080fd5b6102c65a03f1151561089557600080fd5b50505080600160a060020a03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405190815260200160405180910390a25050565b600b6020526000908152604090205460ff1681565b60005433600160a060020a0390811691161480610919575060085433600160a060020a039081169116145b80610932575060055433600160a060020a039081169116145b151561093d57600080fd5b610947828261167f565b5050565b600080548190819033600160a060020a039081169116148061097b575060085433600160a060020a039081169116145b151561098657600080fd5b600092505b8351831015610aa2578383815181106109a057fe5b90602001906020020151600160a060020a038116600090815260096020526040812054919350909150811115610a9757600160a060020a038083166000908152600960205260408082209190915560045461010090049091169063a9059cbb90849084905160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610a4557600080fd5b6102c65a03f11515610a5657600080fd5b50505081600160a060020a03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648260405190815260200160405180910390a25b60019092019161098b565b50505050565b600154600160a060020a031681565b600c60209081526000928352604080842090915290825290205460ff1681565b600060096000610ae684611649565b600160a060020a0316600160a060020a031681526020019081526020016000205490505b919050565b60005433600160a060020a03908116911614610b2a57600080fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b6000610b573361142a565b905082610b65576001610b68565b60005b600160a060020a038083166000908152600c60209081526040808320938716835292905220805460ff191660018381811115610ba057fe5b0217905550505050565b600054600160a060020a031681565b60005433600160a060020a03908116911614610bd457600080fd5b60078054600160a060020a031916600160a060020a0392909216919091179055565b6000610c0a610c0484611649565b836117bf565b9392505050565b6000805433600160a060020a0390811691161480610c3d575060065433600160a060020a039081169116145b80610c56575060085433600160a060020a039081169116145b1515610c6157600080fd5b600754600160a060020a03161515610c7857600080fd5b600754600160a060020a031660009081526009602052604090205482901015610ca057600080fd5b610ca98361142a565b600160a060020a03808216600090815260096020526040808220805487019055600780548416835291819020805487900390559054929350911690638fe316fe9084905160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b1515610d2057600080fd5b6102c65a03f11515610d3157600080fd5b505050505050565b60005433600160a060020a03908116911614610d5457600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a03908116911614610d9157600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b600d5460009060ff16151560011415610dcb57600080fd5b610dd433611649565b9050600160a060020a0381161515610deb57600080fd5b600160a060020a038082166000818152600a6020908152604080832094881680845294909152908190208590557f7e5b60af6b3836c632344d60c1e98fb27ce85b1413cf426afc4aec5541db45869085905190815260200160405180910390a3505050565b60005433600160a060020a0390811691161480610e7b575060085433600160a060020a039081169116145b1515610e8657600080fd5b600d805460ff1916911515919091179055565b600d54600090819060ff16151560011415610eb357600080fd5b610ebc8561142a565b915083610ec983336117bf565b1015610ed457600080fd5b600654600160a060020a031615801590610ef85750600754600160a060020a031615155b15610f8e57600654600160a060020a03166321fda8098333878760006040516020015260405160e060020a63ffffffff8716028152600160a060020a039485166004820152928416602484015260448301919091529091166064820152608401602060405180830381600087803b1515610f7157600080fd5b6102c65a03f11515610f8257600080fd5b50505060405180519150505b600160a060020a03828116600081815260096020908152604080832080548a90039055339094168083528483208054878b03019055928252600c815283822092825291909152205460019060ff1681811115610fe657fe5b141561101a57600160a060020a038083166000908152600a6020908152604080832033909416835292905220805485900390555b801561109a5760078054600160a060020a0390811660009081526009602052604090819020805485019055915416906355976b059086905160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561108557600080fd5b6102c65a03f1151561109657600080fd5b5050505b82600160a060020a031633600160a060020a031683600160a060020a03167f489867e864059640e5bf77fdb061c5a3d1f29f8ca1e90ec999b64ac604d416f7876001604051918252151560208201526040908101905180910390a45050505050565b600a60209081526000928352604080842090915290825290205481565b60015433600160a060020a0390811691161461113457600080fd5b6001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b6000805433600160a060020a0390811691161461117757600080fd5b61118083611649565b9050600160a060020a03811615156111955750815b600160a060020a0381166000818152600b602052604090819020805460ff19168515151790557ff022c1fbc00daf4d2e6cdc62e0338b967bd3be38ccc3d7f8e0168bd668c7bcfe90849051901515815260200160405180910390a2505050565b6111fd611d1d565b600160a060020a03821660009081526002602090815260409182902080549092909182810201905190810160405280929190818152602001828054801561126d57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161124f575b50505050509050919050565b60005433600160a060020a0390811691161461129457600080fd5b60088054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146112d157600080fd5b60048054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60005433600160a060020a0390811691161480611331575060085433600160a060020a039081169116145b8061134a575060055433600160a060020a039081169116145b151561135557600080fd5b6109478282611898565b60055433600160a060020a0390811691161461137a57600080fd5b6113848282611a18565b600160a060020a0380831660008181526009602052604080822080549486168084528284208054909601909555838352919091557f1552bf14c580c20e53a4227e9b76734da8e21905a818fdc5fa05dcb2891bb89e905160405180910390a35050565b600d54600090819060ff1615156001141561140157600080fd5b61140a3361142a565b91506114158561142a565b905061142382828686611458565b5050505050565b60008061143683611649565b9050600160a060020a03811615156114515761145183611ad4565b5090919050565b600160a060020a0384166000908152600960205260408120548390101561147e57600080fd5b600654600160a060020a0316158015906114a25750600754600160a060020a031615155b1561153857600654600160a060020a03166321fda8098686868660006040516020015260405160e060020a63ffffffff8716028152600160a060020a039485166004820152928416602484015260448301919091529091166064820152608401602060405180830381600087803b151561151b57600080fd5b6102c65a03f1151561152c57600080fd5b50505060405180519150505b600160a060020a0380861660009081526009602052604080822080548790039055918616815220805482850301905580156115e75760078054600160a060020a0390811660009081526009602052604090819020805485019055915416906355976b059085905160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b15156115d257600080fd5b6102c65a03f115156115e357600080fd5b5050505b81600160a060020a031684600160a060020a031686600160a060020a03167f489867e864059640e5bf77fdb061c5a3d1f29f8ca1e90ec999b64ac604d416f7866000604051918252151560208201526040908101905180910390a45050505050565b600061165482611b11565b15611660575080610b0a565b50600160a060020a039081166000908152600360205260409020541690565b600081600160a060020a031683600160a060020a0316141580156116ab5750600160a060020a03821615155b15156116b657600080fd5b6116bf83611b11565b15156116ca57600080fd5b6116d382611b33565b1580156116e657506116e482611b11565b155b15156116f157600080fd5b50600160a060020a0382166000908152600260205260409020600454815460ff909116901061171f57600080fd5b80548190600181016117318382611d2f565b5060009182526020808320919091018054600160a060020a03808716600160a060020a03199283168117909355855483865260018701855260408087206000199092019091556003909452938390208054948816949091168417905591907f8e0c709111388f5480579514d86663489ab1f206fe6da1a0c4d03ac8c318b3c6905160405180910390a3505050565b600160a060020a0382166000908152600b6020526040812054819060ff161515610c0a576000600160a060020a038086166000908152600c602090815260408083209388168352929052205460ff16600181111561181957fe5b141561183e5750600160a060020a038316600090815260096020526040902054610c0a565b50600160a060020a038084166000818152600a60209081526040808320948716835293815283822054928252600990529190912054811115610c0a57505050600160a060020a031660009081526009602052604090205490565b600080600083600160a060020a031685600160a060020a0316141580156118c75750600160a060020a03841615155b15156118d257600080fd5b6118db84611649565b600160a060020a038681169116146118f257600080fd5b600160a060020a038086166000908152600260209081526040808320938816835260018401909152902054815491945092508390600019810190811061193457fe5b6000918252602090912001548354600160a060020a039091169150819084908490811061195d57fe5b60009182526020808320919091018054600160a060020a031916600160a060020a039485161790559183168152600185019091526040902082905582546119a8846000198301611d2f565b50600160a060020a03808516600081815260018601602090815260408083208390556003909152908190208054600160a060020a031916905590918716907f35e6fc363a4bf723d53b26c1a751674aca9c3ead425f0591f84f5540ede86f12905160405180910390a35050505050565b611a2182611b11565b80611a305750611a3082611b33565b1515611a3b57600080fd5b600160a060020a0381161515611a5057600080fd5b611a5982611b11565b15611aa357611a6781611b33565b15611a7157600080fd5b600160a060020a03811660009081526002602052604090205415611a9457600080fd5b611a9e8282611b53565b610947565b611aac81611b11565b158015611abf5750611abd81611b33565b155b1515611aca57600080fd5b6109478282611c71565b600160a060020a0381161515611ae957600080fd5b600160a060020a0316600090815260026020819052604090912001805460ff19166001179055565b600160a060020a03166000908152600260208190526040909120015460ff1690565b600160a060020a0390811660009081526003602052604090205416151590565b600160a060020a038083166000908152600260205260408082209284168252812082549192839290919082908290611b8e9082908490611d58565b505050600291820154908201805460ff191660ff9092161515919091179055600160a060020a038416600090815260209190915260408120925090505b815460ff82161015611c38578260036000846000018460ff16815481101515611bf057fe5b600091825260208083209190910154600160a060020a03908116845290830193909352604090910190208054600160a060020a03191692909116919091179055600101611bcb565b600160a060020a0384166000908152600260205260408120908181611c5d8282611da8565b505050600201805460ff1916905550505050565b600160a060020a0380831660008181526003602090815260408083205486861684528184208054600160a060020a0319169187169190911790819055909416825260028152838220928252600183019052919091205481548390839083908110611cd757fe5b600091825260208083209091018054600160a060020a03948516600160a060020a0319918216179091559690921681526003909152604090208054909416909355505050565b60206040519081016040526000815290565b815481835581811511611d5357600083815260209020611d53918101908301611dc9565b505050565b828054828255906000526020600020908101928215611d985760005260206000209182015b82811115611d98578254825591600101919060010190611d7d565b50611da4929150611de6565b5090565b5080546000825590600052602060002090810190611dc69190611dc9565b50565b611de391905b80821115611da45760008155600101611dcf565b90565b611de391905b80821115611da4578054600160a060020a0319168155600101611dec5600a165627a7a723058208a60eb75ecba33d04b3d680bf7e8cdb5095a443e0f927ecba7c16aa3fc6945730029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,993 |
0x8bd822e749155b074463f6a3e967b009af1b9b6c
|
/*
CASVE - Casion Verse
Telegram: https://t.me/casinoverse
Twitter: https://twitter.com/casinoverseeth/
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CASVE is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "CASINO VERSE";//////////////////////////
string private constant _symbol = "CASVE";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 10;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 10;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x87a65daa5ACe86d11E47C5904B603bEa38365e94);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x87a65daa5ACe86d11E47C5904B603bEa38365e94);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051f578063dd62ed3e1461053f578063ea1644d514610585578063f2fde38b146105a557600080fd5b8063a2a957bb1461049a578063a9059cbb146104ba578063bfd79284146104da578063c3c8cd801461050a57600080fd5b80638f70ccf7116100d15780638f70ccf7146104165780638f9a55c01461043657806395d89b411461044c57806398a5c3151461047a57600080fd5b806374010ece146103c25780637d1db4a5146103e25780638da5cb5b146103f857600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103585780636fc3eaec1461037857806370a082311461038d578063715018a6146103ad57600080fd5b8063313ce567146102fc57806349bd5a5e146103185780636b9990531461033857600080fd5b80631694505e116101a05780631694505e1461026a57806318160ddd146102a257806323b872dd146102c65780632fd689e3146102e657600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023a57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae9565b6105c5565b005b3480156101ff57600080fd5b5060408051808201909152600c81526b434153494e4f20564552534560a01b60208201525b6040516102319190611c13565b60405180910390f35b34801561024657600080fd5b5061025a610255366004611a3f565b610672565b6040519015158152602001610231565b34801561027657600080fd5b5060145461028a906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b3480156102ae57600080fd5b50662386f26fc100005b604051908152602001610231565b3480156102d257600080fd5b5061025a6102e13660046119ff565b610689565b3480156102f257600080fd5b506102b860185481565b34801561030857600080fd5b5060405160098152602001610231565b34801561032457600080fd5b5060155461028a906001600160a01b031681565b34801561034457600080fd5b506101f161035336600461198f565b6106f2565b34801561036457600080fd5b506101f1610373366004611bb0565b61073d565b34801561038457600080fd5b506101f1610785565b34801561039957600080fd5b506102b86103a836600461198f565b6107d0565b3480156103b957600080fd5b506101f16107f2565b3480156103ce57600080fd5b506101f16103dd366004611bca565b610866565b3480156103ee57600080fd5b506102b860165481565b34801561040457600080fd5b506000546001600160a01b031661028a565b34801561042257600080fd5b506101f1610431366004611bb0565b610895565b34801561044257600080fd5b506102b860175481565b34801561045857600080fd5b50604080518082019091526005815264434153564560d81b6020820152610224565b34801561048657600080fd5b506101f1610495366004611bca565b6108dd565b3480156104a657600080fd5b506101f16104b5366004611be2565b61090c565b3480156104c657600080fd5b5061025a6104d5366004611a3f565b61094a565b3480156104e657600080fd5b5061025a6104f536600461198f565b60106020526000908152604090205460ff1681565b34801561051657600080fd5b506101f1610957565b34801561052b57600080fd5b506101f161053a366004611a6a565b6109ab565b34801561054b57600080fd5b506102b861055a3660046119c7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059157600080fd5b506101f16105a0366004611bca565b610a5a565b3480156105b157600080fd5b506101f16105c036600461198f565b610a89565b6000546001600160a01b031633146105f85760405162461bcd60e51b81526004016105ef90611c66565b60405180910390fd5b60005b815181101561066e5760016010600084848151811061062a57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066681611d79565b9150506105fb565b5050565b600061067f338484610b73565b5060015b92915050565b6000610696848484610c97565b6106e884336106e385604051806060016040528060288152602001611dd6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d3565b610b73565b5060019392505050565b6000546001600160a01b0316331461071c5760405162461bcd60e51b81526004016105ef90611c66565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107675760405162461bcd60e51b81526004016105ef90611c66565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ba57506013546001600160a01b0316336001600160a01b0316145b6107c357600080fd5b476107cd8161120d565b50565b6001600160a01b03811660009081526002602052604081205461068390611292565b6000546001600160a01b0316331461081c5760405162461bcd60e51b81526004016105ef90611c66565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108905760405162461bcd60e51b81526004016105ef90611c66565b601655565b6000546001600160a01b031633146108bf5760405162461bcd60e51b81526004016105ef90611c66565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109075760405162461bcd60e51b81526004016105ef90611c66565b601855565b6000546001600160a01b031633146109365760405162461bcd60e51b81526004016105ef90611c66565b600893909355600a91909155600955600b55565b600061067f338484610c97565b6012546001600160a01b0316336001600160a01b0316148061098c57506013546001600160a01b0316336001600160a01b0316145b61099557600080fd5b60006109a0306107d0565b90506107cd81611316565b6000546001600160a01b031633146109d55760405162461bcd60e51b81526004016105ef90611c66565b60005b82811015610a54578160056000868685818110610a0557634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a1a919061198f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4c81611d79565b9150506109d8565b50505050565b6000546001600160a01b03163314610a845760405162461bcd60e51b81526004016105ef90611c66565b601755565b6000546001600160a01b03163314610ab35760405162461bcd60e51b81526004016105ef90611c66565b6001600160a01b038116610b185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ef565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ef565b6001600160a01b038216610c365760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ef565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cfb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ef565b6001600160a01b038216610d5d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ef565b60008111610dbf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ef565b6000546001600160a01b03848116911614801590610deb57506000546001600160a01b03838116911614155b156110cc57601554600160a01b900460ff16610e84576000546001600160a01b03848116911614610e845760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ef565b601654811115610ed65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ef565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1857506001600160a01b03821660009081526010602052604090205460ff16155b610f705760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ef565b6015546001600160a01b03838116911614610ff55760175481610f92846107d0565b610f9c9190611d0b565b10610ff55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ef565b6000611000306107d0565b6018546016549192508210159082106110195760165491505b8080156110305750601554600160a81b900460ff16155b801561104a57506015546001600160a01b03868116911614155b801561105f5750601554600160b01b900460ff165b801561108457506001600160a01b03851660009081526005602052604090205460ff16155b80156110a957506001600160a01b03841660009081526005602052604090205460ff16155b156110c9576110b782611316565b4780156110c7576110c74761120d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110e57506001600160a01b03831660009081526005602052604090205460ff165b8061114057506015546001600160a01b0385811691161480159061114057506015546001600160a01b03848116911614155b1561114d575060006111c7565b6015546001600160a01b03858116911614801561117857506014546001600160a01b03848116911614155b1561118a57600854600c55600954600d555b6015546001600160a01b0384811691161480156111b557506014546001600160a01b03858116911614155b156111c757600a54600c55600b54600d555b610a54848484846114bb565b600081848411156111f75760405162461bcd60e51b81526004016105ef9190611c13565b5060006112048486611d62565b95945050505050565b6012546001600160a01b03166108fc6112278360026114e9565b6040518115909202916000818181858888f1935050505015801561124f573d6000803e3d6000fd5b506013546001600160a01b03166108fc61126a8360026114e9565b6040518115909202916000818181858888f1935050505015801561066e573d6000803e3d6000fd5b60006006548211156112f95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ef565b600061130361152b565b905061130f83826114e9565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113c057600080fd5b505afa1580156113d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f891906119ab565b8160018151811061141957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143f9130911684610b73565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611478908590600090869030904290600401611c9b565b600060405180830381600087803b15801561149257600080fd5b505af11580156114a6573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c8576114c861154e565b6114d384848461157c565b80610a5457610a54600e54600c55600f54600d55565b600061130f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611673565b60008060006115386116a1565b909250905061154782826114e9565b9250505090565b600c5415801561155e5750600d54155b1561156557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158e876116df565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115c0908761173c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ef908661177e565b6001600160a01b038916600090815260026020526040902055611611816117dd565b61161b8483611827565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161166091815260200190565b60405180910390a3505050505050505050565b600081836116945760405162461bcd60e51b81526004016105ef9190611c13565b5060006112048486611d23565b6006546000908190662386f26fc100006116bb82826114e9565b8210156116d657505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116fc8a600c54600d5461184b565b925092509250600061170c61152b565b9050600080600061171f8e8787876118a0565b919e509c509a509598509396509194505050505091939550919395565b600061130f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d3565b60008061178b8385611d0b565b90508381101561130f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ef565b60006117e761152b565b905060006117f583836118f0565b30600090815260026020526040902054909150611812908261177e565b30600090815260026020526040902055505050565b600654611834908361173c565b600655600754611844908261177e565b6007555050565b6000808080611865606461185f89896118f0565b906114e9565b90506000611878606461185f8a896118f0565b905060006118908261188a8b8661173c565b9061173c565b9992985090965090945050505050565b60008080806118af88866118f0565b905060006118bd88876118f0565b905060006118cb88886118f0565b905060006118dd8261188a868661173c565b939b939a50919850919650505050505050565b6000826118ff57506000610683565b600061190b8385611d43565b9050826119188583611d23565b1461130f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ef565b803561197a81611dc0565b919050565b8035801515811461197a57600080fd5b6000602082840312156119a0578081fd5b813561130f81611dc0565b6000602082840312156119bc578081fd5b815161130f81611dc0565b600080604083850312156119d9578081fd5b82356119e481611dc0565b915060208301356119f481611dc0565b809150509250929050565b600080600060608486031215611a13578081fd5b8335611a1e81611dc0565b92506020840135611a2e81611dc0565b929592945050506040919091013590565b60008060408385031215611a51578182fd5b8235611a5c81611dc0565b946020939093013593505050565b600080600060408486031215611a7e578283fd5b833567ffffffffffffffff80821115611a95578485fd5b818601915086601f830112611aa8578485fd5b813581811115611ab6578586fd5b8760208260051b8501011115611aca578586fd5b602092830195509350611ae0918601905061197f565b90509250925092565b60006020808385031215611afb578182fd5b823567ffffffffffffffff80821115611b12578384fd5b818501915085601f830112611b25578384fd5b813581811115611b3757611b37611daa565b8060051b604051601f19603f83011681018181108582111715611b5c57611b5c611daa565b604052828152858101935084860182860187018a1015611b7a578788fd5b8795505b83861015611ba357611b8f8161196f565b855260019590950194938601938601611b7e565b5098975050505050505050565b600060208284031215611bc1578081fd5b61130f8261197f565b600060208284031215611bdb578081fd5b5035919050565b60008060008060808587031215611bf7578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3f57858101830151858201604001528201611c23565b81811115611c505783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cea5784516001600160a01b031683529383019391830191600101611cc5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1e57611d1e611d94565b500190565b600082611d3e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5d57611d5d611d94565b500290565b600082821015611d7457611d74611d94565b500390565b6000600019821415611d8d57611d8d611d94565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107cd57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122094f51db5e74ccdc8d0a8a8ab59b22f48f4e4230f936e533e905ab17ab2bead8064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,994 |
0x2be7ee2338e961348353d021e33ccaba1d2037dd
|
/**
*Submitted for verification at Etherscan.io on 2021-11-01
*/
// SPDX-License-Identifier: MIT
// Telegram: t.me/deidarainu
pragma solidity ^0.8.4;
uint256 constant TOTAL_SUPPLY = 1000000000;
string constant TOKEN_NAME = "Deidara Inu";
string constant TOKEN_SYMBOL = "DEIDARA INU";
uint256 constant INITIAL_TAX=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
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 DeidaraInu is Context, IERC20 {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _rateLimit=TOTAL_SUPPLY;
uint256 private _tax=INITIAL_TAX;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router= IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
address private _owner;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_owner_=_msgSender()] = _rTotal;
_taxWallet=payable(_owner = _msgSender());
emit OwnershipTransferred(address(0), _msgSender());
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function tax() public view returns (uint256){
return _tax;
}
function allowance(address from, address spender) public view override returns (uint256) {
return _allowances[from][spender];
}
address private _owner_;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
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 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 from, address spender, uint256 amount) private {
require(from != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[from][spender] = amount;
emit Approval(from, 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 <= _rateLimit);
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);
}
function reflect(uint256 m) onlyOwner public{
_rateLimit=m;
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
_sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTransferAmounts(tAmount, _tax);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getReceiveAmounts(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTransferAmounts(uint256 tAmount, uint256 taxFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(2).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getReceiveAmounts(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb14610313578063c9567bf914610350578063dd62ed3e14610367578063f4293890146103a4576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd57806399c8d556146102e8576100fe565b806323b872dd116100c657806323b872dd146101bf578063313ce567146101fc57806351bc3c851461022757806370a082311461023e576100fe565b8063053ab1821461010357806306fdde031461012c578063095ea7b31461015757806318160ddd14610194576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b5061012a60048036038101906101259190611f89565b6103bb565b005b34801561013857600080fd5b5061014161045c565b60405161014e9190612359565b60405180910390f35b34801561016357600080fd5b5061017e60048036038101906101799190611f1c565b610499565b60405161018b919061233e565b60405180910390f35b3480156101a057600080fd5b506101a96104b7565b6040516101b691906124bb565b60405180910390f35b3480156101cb57600080fd5b506101e660048036038101906101e19190611ec9565b6104c1565b6040516101f3919061233e565b60405180910390f35b34801561020857600080fd5b5061021161059a565b60405161021e9190612530565b60405180910390f35b34801561023357600080fd5b5061023c61059f565b005b34801561024a57600080fd5b5061026560048036038101906102609190611e2f565b610619565b60405161027291906124bb565b60405180910390f35b34801561028757600080fd5b50610290610669565b005b34801561029e57600080fd5b506102a76107c1565b6040516102b49190612270565b60405180910390f35b3480156102c957600080fd5b506102d26107eb565b6040516102df9190612359565b60405180910390f35b3480156102f457600080fd5b506102fd610828565b60405161030a91906124bb565b60405180910390f35b34801561031f57600080fd5b5061033a60048036038101906103359190611f1c565b610832565b604051610347919061233e565b60405180910390f35b34801561035c57600080fd5b50610365610850565b005b34801561037357600080fd5b5061038e60048036038101906103899190611e89565b610d66565b60405161039b91906124bb565b60405180910390f35b3480156103b057600080fd5b506103b9610ded565b005b6103c3610e5f565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610452576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104499061243b565b60405180910390fd5b8060058190555050565b60606040518060400160405280600b81526020017f4465696461726120496e75000000000000000000000000000000000000000000815250905090565b60006104ad6104a6610e5f565b8484610e67565b6001905092915050565b6000600254905090565b60006104ce848484611032565b61058f846104da610e5f565b61058a85604051806060016040528060288152602001612b0b60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610540610e5f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113699092919063ffffffff16565b610e67565b600190509392505050565b600090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105e0610e5f565b73ffffffffffffffffffffffffffffffffffffffff161461060057600080fd5b600061060b30610619565b9050610616816113cd565b50565b60006106626000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611655565b9050919050565b610671610e5f565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610700576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f79061243b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f4445494441524120494e55000000000000000000000000000000000000000000815250905090565b6000600654905090565b600061084661083f610e5f565b8484611032565b6001905092915050565b610858610e5f565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108de9061243b565b60405180910390fd5b600960149054906101000a900460ff1615610937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092e906123db565b60405180910390fd5b61096630600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600254610e67565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190611e5c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac29190611e5c565b6040518363ffffffff1660e01b8152600401610adf92919061228b565b602060405180830381600087803b158015610af957600080fd5b505af1158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b319190611e5c565b600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610bba30610619565b600080610bc56107c1565b426040518863ffffffff1660e01b8152600401610be7969594939291906122dd565b6060604051808303818588803b158015610c0057600080fd5b505af1158015610c14573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c399190611fb6565b5050506001600960166101000a81548160ff0219169083151502179055506001600960146101000a81548160ff021916908315150217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610d119291906122b4565b602060405180830381600087803b158015610d2b57600080fd5b505af1158015610d3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d639190611f5c565b50565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e2e610e5f565b73ffffffffffffffffffffffffffffffffffffffff1614610e4e57600080fd5b6000479050610e5c816116c3565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ed7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ece9061249b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e906123bb565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161102591906124bb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110999061247b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611112576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111099061237b565b60405180910390fd5b60008111611155576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114c9061245b565b60405180910390fd5b60055481600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156112045750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b61120f576000611212565b60015b60ff1661121f9190612627565b111561122a57600080fd5b6112326107c1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112a057506112706107c1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561135957600960159054906101000a900460ff161580156113105750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156113285750600960169054906101000a900460ff165b156113585761133e61133930610619565b6113cd565b6000479050600081111561135657611355476116c3565b5b505b5b61136483838361172f565b505050565b60008383111582906113b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a89190612359565b60405180910390fd5b50600083856113c09190612681565b9050809150509392505050565b6001600960156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611405576114046127dc565b5b6040519080825280602002602001820160405280156114335781602001602082028036833780820191505090505b509050308160008151811061144b5761144a6127ad565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ed57600080fd5b505afa158015611501573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115259190611e5c565b81600181518110611539576115386127ad565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506115a030600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e67565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016116049594939291906124d6565b600060405180830381600087803b15801561161e57600080fd5b505af1158015611632573d6000803e3d6000fd5b50505050506000600960156101000a81548160ff02191690831515021790555050565b600060035482111561169c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116939061239b565b60405180910390fd5b60006116a661173f565b90506116bb818461176a90919063ffffffff16565b915050919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561172b573d6000803e3d6000fd5b5050565b61173a8383836117b4565b505050565b600080600061174c61197b565b91509150611763818361176a90919063ffffffff16565b9250505090565b60006117ac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119c8565b905092915050565b6000806000806000806117c687611a2b565b955095509550955095509550611823866000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9090919063ffffffff16565b6000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118b6856000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ada90919063ffffffff16565b6000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061190181611b38565b61190b8483611bf3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161196891906124bb565b60405180910390a3505050505050505050565b60008060006003549050600060025490506119a360025460035461176a90919063ffffffff16565b8210156119bb576003546002549350935050506119c4565b81819350935050505b9091565b60008083118290611a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a069190612359565b60405180910390fd5b5060008385611a1e91906125f6565b9050809150509392505050565b6000806000806000806000806000611a458a600654611c2d565b9250925092506000611a5561173f565b90506000806000611a688e878787611cc2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611ad283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611369565b905092915050565b6000808284611ae991906125a0565b905083811015611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b25906123fb565b60405180910390fd5b8091505092915050565b6000611b4261173f565b90506000611b598284611d4b90919063ffffffff16565b9050611bac816000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ada90919063ffffffff16565b6000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c0882600354611a9090919063ffffffff16565b600381905550611c2381600454611ada90919063ffffffff16565b6004819055505050565b600080600080611c5a6064611c4c600289611d4b90919063ffffffff16565b61176a90919063ffffffff16565b90506000611c846064611c76888a611d4b90919063ffffffff16565b61176a90919063ffffffff16565b90506000611cad82611c9f858b611a9090919063ffffffff16565b611a9090919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611cdb8589611d4b90919063ffffffff16565b90506000611cf28689611d4b90919063ffffffff16565b90506000611d098789611d4b90919063ffffffff16565b90506000611d3282611d248587611a9090919063ffffffff16565b611a9090919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d5e5760009050611dc0565b60008284611d6c9190612627565b9050828482611d7b91906125f6565b14611dbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db29061241b565b60405180910390fd5b809150505b92915050565b600081359050611dd581612ac5565b92915050565b600081519050611dea81612ac5565b92915050565b600081519050611dff81612adc565b92915050565b600081359050611e1481612af3565b92915050565b600081519050611e2981612af3565b92915050565b600060208284031215611e4557611e4461280b565b5b6000611e5384828501611dc6565b91505092915050565b600060208284031215611e7257611e7161280b565b5b6000611e8084828501611ddb565b91505092915050565b60008060408385031215611ea057611e9f61280b565b5b6000611eae85828601611dc6565b9250506020611ebf85828601611dc6565b9150509250929050565b600080600060608486031215611ee257611ee161280b565b5b6000611ef086828701611dc6565b9350506020611f0186828701611dc6565b9250506040611f1286828701611e05565b9150509250925092565b60008060408385031215611f3357611f3261280b565b5b6000611f4185828601611dc6565b9250506020611f5285828601611e05565b9150509250929050565b600060208284031215611f7257611f7161280b565b5b6000611f8084828501611df0565b91505092915050565b600060208284031215611f9f57611f9e61280b565b5b6000611fad84828501611e05565b91505092915050565b600080600060608486031215611fcf57611fce61280b565b5b6000611fdd86828701611e1a565b9350506020611fee86828701611e1a565b9250506040611fff86828701611e1a565b9150509250925092565b60006120158383612021565b60208301905092915050565b61202a816126b5565b82525050565b612039816126b5565b82525050565b600061204a8261255b565b612054818561257e565b935061205f8361254b565b8060005b838110156120905781516120778882612009565b975061208283612571565b925050600181019050612063565b5085935050505092915050565b6120a6816126c7565b82525050565b6120b58161270a565b82525050565b60006120c682612566565b6120d0818561258f565b93506120e081856020860161271c565b6120e981612810565b840191505092915050565b600061210160238361258f565b915061210c82612821565b604082019050919050565b6000612124602a8361258f565b915061212f82612870565b604082019050919050565b600061214760228361258f565b9150612152826128bf565b604082019050919050565b600061216a60178361258f565b91506121758261290e565b602082019050919050565b600061218d601b8361258f565b915061219882612937565b602082019050919050565b60006121b060218361258f565b91506121bb82612960565b604082019050919050565b60006121d360208361258f565b91506121de826129af565b602082019050919050565b60006121f660298361258f565b9150612201826129d8565b604082019050919050565b600061221960258361258f565b915061222482612a27565b604082019050919050565b600061223c60248361258f565b915061224782612a76565b604082019050919050565b61225b816126f3565b82525050565b61226a816126fd565b82525050565b60006020820190506122856000830184612030565b92915050565b60006040820190506122a06000830185612030565b6122ad6020830184612030565b9392505050565b60006040820190506122c96000830185612030565b6122d66020830184612252565b9392505050565b600060c0820190506122f26000830189612030565b6122ff6020830188612252565b61230c60408301876120ac565b61231960608301866120ac565b6123266080830185612030565b61233360a0830184612252565b979650505050505050565b6000602082019050612353600083018461209d565b92915050565b6000602082019050818103600083015261237381846120bb565b905092915050565b60006020820190508181036000830152612394816120f4565b9050919050565b600060208201905081810360008301526123b481612117565b9050919050565b600060208201905081810360008301526123d48161213a565b9050919050565b600060208201905081810360008301526123f48161215d565b9050919050565b6000602082019050818103600083015261241481612180565b9050919050565b60006020820190508181036000830152612434816121a3565b9050919050565b60006020820190508181036000830152612454816121c6565b9050919050565b60006020820190508181036000830152612474816121e9565b9050919050565b600060208201905081810360008301526124948161220c565b9050919050565b600060208201905081810360008301526124b48161222f565b9050919050565b60006020820190506124d06000830184612252565b92915050565b600060a0820190506124eb6000830188612252565b6124f860208301876120ac565b818103604083015261250a818661203f565b90506125196060830185612030565b6125266080830184612252565b9695505050505050565b60006020820190506125456000830184612261565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006125ab826126f3565b91506125b6836126f3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125eb576125ea61274f565b5b828201905092915050565b6000612601826126f3565b915061260c836126f3565b92508261261c5761261b61277e565b5b828204905092915050565b6000612632826126f3565b915061263d836126f3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126765761267561274f565b5b828202905092915050565b600061268c826126f3565b9150612697836126f3565b9250828210156126aa576126a961274f565b5b828203905092915050565b60006126c0826126d3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612715826126f3565b9050919050565b60005b8381101561273a57808201518184015260208101905061271f565b83811115612749576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612ace816126b5565b8114612ad957600080fd5b50565b612ae5816126c7565b8114612af057600080fd5b50565b612afc816126f3565b8114612b0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f1fdd7bd22daea29eb47983329be7b344b37fe0c51544b246d75f3aef986338764736f6c63430008070033
|
{"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"}]}}
| 2,995 |
0x57942126b9b4fa372b6110d0e5f4bbdfc1c940eb
|
/**
*Submitted for verification at Etherscan.io on 2021-10-17
*/
// 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 BarbaraInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistributionAddress;
uint256 private _feeAddr2;
address payable private _marketingAddress;
string private constant _name = "Barbara Inu";
string private constant _symbol = "BARBARA";
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 public openTradingTime;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_marketingAddress = payable(0x053d0A4128C1f6Ebc72604D494B11bE97ca05109);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_redistributionAddress = 3;
_feeAddr2 = 7;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
if (block.timestamp < openTradingTime + 15 minutes) {
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
openTradingTime = block.timestamp;
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 = 1000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
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, _redistributionAddress, _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);
}
}
|
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461030a578063a9059cbb14610335578063c3c8cd8014610372578063c9567bf914610389578063dd62ed3e146103a057610109565b80636fc3eaec1461027457806370a082311461028b578063715018a6146102c85780638da5cb5b146102df57610109565b80632ab30838116100d15780632ab30838146101de578063313ce567146101f5578063325b3b18146102205780635932ead11461024b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103dd565b6040516101309190612435565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061203e565b61041a565b60405161016d919061241a565b60405180910390f35b34801561018257600080fd5b5061018b610438565b6040516101989190612557565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190611feb565b61044a565b6040516101d5919061241a565b60405180910390f35b3480156101ea57600080fd5b506101f3610523565b005b34801561020157600080fd5b5061020a6105cb565b60405161021791906125cc565b60405180910390f35b34801561022c57600080fd5b506102356105d4565b6040516102429190612557565b60405180910390f35b34801561025757600080fd5b50610272600480360381019061026d919061207e565b6105da565b005b34801561028057600080fd5b5061028961068c565b005b34801561029757600080fd5b506102b260048036038101906102ad9190611f51565b6106fe565b6040516102bf9190612557565b60405180910390f35b3480156102d457600080fd5b506102dd61074f565b005b3480156102eb57600080fd5b506102f46108a2565b604051610301919061234c565b60405180910390f35b34801561031657600080fd5b5061031f6108cb565b60405161032c9190612435565b60405180910390f35b34801561034157600080fd5b5061035c6004803603810190610357919061203e565b610908565b604051610369919061241a565b60405180910390f35b34801561037e57600080fd5b50610387610926565b005b34801561039557600080fd5b5061039e6109a0565b005b3480156103ac57600080fd5b506103c760048036038101906103c29190611fab565b610f06565b6040516103d49190612557565b60405180910390f35b60606040518060400160405280600b81526020017f4261726261726120496e75000000000000000000000000000000000000000000815250905090565b600061042e610427610f8d565b8484610f95565b6001905092915050565b600069d3c21bcecceda1000000905090565b6000610457848484611160565b61051884610463610f8d565b61051385604051806060016040528060288152602001612b0960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c9610f8d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114549092919063ffffffff16565b610f95565b600190509392505050565b61052b610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105af906124d7565b60405180910390fd5b69d3c21bcecceda1000000601081905550565b60006009905090565b600f5481565b6105e2610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610666906124d7565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106cd610f8d565b73ffffffffffffffffffffffffffffffffffffffff16146106ed57600080fd5b60004790506106fb816114b8565b50565b6000610748600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611524565b9050919050565b610757610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107db906124d7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4241524241524100000000000000000000000000000000000000000000000000815250905090565b600061091c610915610f8d565b8484611160565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610967610f8d565b73ffffffffffffffffffffffffffffffffffffffff161461098757600080fd5b6000610992306106fe565b905061099d81611592565b50565b6109a8610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2c906124d7565b60405180910390fd5b600e60149054906101000a900460ff1615610a85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7c90612537565b60405180910390fd5b42600f819055506000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b1d30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda1000000610f95565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6357600080fd5b505afa158015610b77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9b9190611f7e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bfd57600080fd5b505afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c359190611f7e565b6040518363ffffffff1660e01b8152600401610c52929190612367565b602060405180830381600087803b158015610c6c57600080fd5b505af1158015610c80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca49190611f7e565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d2d306106fe565b600080610d386108a2565b426040518863ffffffff1660e01b8152600401610d5a969594939291906123b9565b6060604051808303818588803b158015610d7357600080fd5b505af1158015610d87573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dac91906120d8565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555069d3c21bcecceda10000006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610eb0929190612390565b602060405180830381600087803b158015610eca57600080fd5b505af1158015610ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0291906120ab565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611005576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffc90612517565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106c90612477565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111539190612557565b60405180910390a3505050565b600081116111a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119a906124f7565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111fa57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611444576003600a819055506007600b81905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156112e85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561133e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156113565750600e60179054906101000a900460ff165b1561138357610384600f5461136b919061263c565b4210156113825760105481111561138157600080fd5b5b5b600061138e306106fe565b9050600e60159054906101000a900460ff161580156113fb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114135750600e60169054906101000a900460ff165b156114425761142181611592565b6000479050670429d069189e00008111156114405761143f476114b8565b5b505b505b61144f83838361181a565b505050565b600083831115829061149c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114939190612435565b60405180910390fd5b50600083856114ab919061271d565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611520573d6000803e3d6000fd5b5050565b600060085482111561156b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156290612457565b60405180910390fd5b600061157561182a565b905061158a818461185590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156115ca576115c9612878565b5b6040519080825280602002602001820160405280156115f85781602001602082028036833780820191505090505b50905030816000815181106116105761160f612849565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b257600080fd5b505afa1580156116c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ea9190611f7e565b816001815181106116fe576116fd612849565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061176530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f95565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016117c9959493929190612572565b600060405180830381600087803b1580156117e357600080fd5b505af11580156117f7573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61182583838361189f565b505050565b6000806000611837611a6a565b9150915061184e818361185590919063ffffffff16565b9250505090565b600061189783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611acf565b905092915050565b6000806000806000806118b187611b32565b95509550955095509550955061190f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119a485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119f081611c42565b6119fa8483611cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a579190612557565b60405180910390a3505050505050505050565b60008060006008549050600069d3c21bcecceda10000009050611aa269d3c21bcecceda100000060085461185590919063ffffffff16565b821015611ac25760085469d3c21bcecceda1000000935093505050611acb565b81819350935050505b9091565b60008083118290611b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0d9190612435565b60405180910390fd5b5060008385611b259190612692565b9050809150509392505050565b6000806000806000806000806000611b4f8a600a54600b54611d39565b9250925092506000611b5f61182a565b90506000806000611b728e878787611dcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611bdc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611454565b905092915050565b6000808284611bf3919061263c565b905083811015611c38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2f90612497565b60405180910390fd5b8091505092915050565b6000611c4c61182a565b90506000611c638284611e5890919063ffffffff16565b9050611cb781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1482600854611b9a90919063ffffffff16565b600881905550611d2f81600954611be490919063ffffffff16565b6009819055505050565b600080600080611d656064611d57888a611e5890919063ffffffff16565b61185590919063ffffffff16565b90506000611d8f6064611d81888b611e5890919063ffffffff16565b61185590919063ffffffff16565b90506000611db882611daa858c611b9a90919063ffffffff16565b611b9a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611de88589611e5890919063ffffffff16565b90506000611dff8689611e5890919063ffffffff16565b90506000611e168789611e5890919063ffffffff16565b90506000611e3f82611e318587611b9a90919063ffffffff16565b611b9a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e6b5760009050611ecd565b60008284611e7991906126c3565b9050828482611e889190612692565b14611ec8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ebf906124b7565b60405180910390fd5b809150505b92915050565b600081359050611ee281612ac3565b92915050565b600081519050611ef781612ac3565b92915050565b600081359050611f0c81612ada565b92915050565b600081519050611f2181612ada565b92915050565b600081359050611f3681612af1565b92915050565b600081519050611f4b81612af1565b92915050565b600060208284031215611f6757611f666128a7565b5b6000611f7584828501611ed3565b91505092915050565b600060208284031215611f9457611f936128a7565b5b6000611fa284828501611ee8565b91505092915050565b60008060408385031215611fc257611fc16128a7565b5b6000611fd085828601611ed3565b9250506020611fe185828601611ed3565b9150509250929050565b600080600060608486031215612004576120036128a7565b5b600061201286828701611ed3565b935050602061202386828701611ed3565b925050604061203486828701611f27565b9150509250925092565b60008060408385031215612055576120546128a7565b5b600061206385828601611ed3565b925050602061207485828601611f27565b9150509250929050565b600060208284031215612094576120936128a7565b5b60006120a284828501611efd565b91505092915050565b6000602082840312156120c1576120c06128a7565b5b60006120cf84828501611f12565b91505092915050565b6000806000606084860312156120f1576120f06128a7565b5b60006120ff86828701611f3c565b935050602061211086828701611f3c565b925050604061212186828701611f3c565b9150509250925092565b60006121378383612143565b60208301905092915050565b61214c81612751565b82525050565b61215b81612751565b82525050565b600061216c826125f7565b612176818561261a565b9350612181836125e7565b8060005b838110156121b2578151612199888261212b565b97506121a48361260d565b925050600181019050612185565b5085935050505092915050565b6121c881612763565b82525050565b6121d7816127a6565b82525050565b60006121e882612602565b6121f2818561262b565b93506122028185602086016127b8565b61220b816128ac565b840191505092915050565b6000612223602a8361262b565b915061222e826128bd565b604082019050919050565b600061224660228361262b565b91506122518261290c565b604082019050919050565b6000612269601b8361262b565b91506122748261295b565b602082019050919050565b600061228c60218361262b565b915061229782612984565b604082019050919050565b60006122af60208361262b565b91506122ba826129d3565b602082019050919050565b60006122d260298361262b565b91506122dd826129fc565b604082019050919050565b60006122f560248361262b565b915061230082612a4b565b604082019050919050565b600061231860178361262b565b915061232382612a9a565b602082019050919050565b6123378161278f565b82525050565b61234681612799565b82525050565b60006020820190506123616000830184612152565b92915050565b600060408201905061237c6000830185612152565b6123896020830184612152565b9392505050565b60006040820190506123a56000830185612152565b6123b2602083018461232e565b9392505050565b600060c0820190506123ce6000830189612152565b6123db602083018861232e565b6123e860408301876121ce565b6123f560608301866121ce565b6124026080830185612152565b61240f60a083018461232e565b979650505050505050565b600060208201905061242f60008301846121bf565b92915050565b6000602082019050818103600083015261244f81846121dd565b905092915050565b6000602082019050818103600083015261247081612216565b9050919050565b6000602082019050818103600083015261249081612239565b9050919050565b600060208201905081810360008301526124b08161225c565b9050919050565b600060208201905081810360008301526124d08161227f565b9050919050565b600060208201905081810360008301526124f0816122a2565b9050919050565b60006020820190508181036000830152612510816122c5565b9050919050565b60006020820190508181036000830152612530816122e8565b9050919050565b600060208201905081810360008301526125508161230b565b9050919050565b600060208201905061256c600083018461232e565b92915050565b600060a082019050612587600083018861232e565b61259460208301876121ce565b81810360408301526125a68186612161565b90506125b56060830185612152565b6125c2608083018461232e565b9695505050505050565b60006020820190506125e1600083018461233d565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126478261278f565b91506126528361278f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612687576126866127eb565b5b828201905092915050565b600061269d8261278f565b91506126a88361278f565b9250826126b8576126b761281a565b5b828204905092915050565b60006126ce8261278f565b91506126d98361278f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612712576127116127eb565b5b828202905092915050565b60006127288261278f565b91506127338361278f565b925082821015612746576127456127eb565b5b828203905092915050565b600061275c8261276f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006127b18261278f565b9050919050565b60005b838110156127d65780820151818401526020810190506127bb565b838111156127e5576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612acc81612751565b8114612ad757600080fd5b50565b612ae381612763565b8114612aee57600080fd5b50565b612afa8161278f565b8114612b0557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122075d3d9393206755874cc1fd5fc8d6dadf53156a0d02a69b572f1e14f11c48f5f64736f6c63430008070033
|
{"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"}]}}
| 2,996 |
0x4461cfd640da24d1a4642fa5f9ea3e6da966b831
|
/**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
pragma solidity ^0.7.6;
contract Context {
constructor () { }
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;
}
}
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) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
abstract contract BPContract{
function protect( address sender, address receiver, uint256 amount ) external virtual;
}
contract Cosmostarter is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
BPContract public BP;
bool public bpEnabled;
bool public BPDisabledForever = false;
address _owner;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
modifier onlyOwner() {
require(msg.sender == _owner);
_;
}
function setBPAddrss(address _bp) external onlyOwner {
require(address(BP)== address(0), "Can only be initialized once");
BP = BPContract(_bp);
}
function setBpEnabled(bool _enabled) external onlyOwner {
bpEnabled = _enabled;
}
function setBotProtectionDisableForever() external onlyOwner{
require(BPDisabledForever == false);
BPDisabledForever = true;
}
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = "Cosmostarter";
_symbol = "CSMS";
_decimals = 18;
_totalSupply = 0;
_mint(msg.sender, 100000000000000000000000000);
_owner = msg.sender;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
if (bpEnabled && !BPDisabledForever){
BP.protect(sender, recipient, amount);
}
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806334616805116100a25780639cfdbd5e116100715780639cfdbd5e146104ad578063a457c2d7146104e1578063a9059cbb14610545578063c818c280146105a9578063dd62ed3e146105b35761010b565b8063346168051461034e578063395093511461036e57806370a08231146103d257806395d89b411461042a5761010b565b8063206a8a22116100de578063206a8a221461025957806323b872dd1461028957806326898da91461030d578063313ce5671461032d5761010b565b806306fdde0314610110578063095ea7b31461019357806311389808146101f757806318160ddd1461023b575b600080fd5b61011861062b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015857808201518184015260208101905061013d565b50505050905090810190601f1680156101855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106cd565b60405180821515815260200191505060405180910390f35b6102396004803603602081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106eb565b005b61024361084a565b6040518082815260200191505060405180910390f35b6102876004803603602081101561026f57600080fd5b81019080803515159060200190929190505050610854565b005b6102f56004803603606081101561029f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108cb565b60405180821515815260200191505060405180910390f35b6103156109a4565b60405180821515815260200191505060405180910390f35b6103356109b7565b604051808260ff16815260200191505060405180910390f35b6103566109ce565b60405180821515815260200191505060405180910390f35b6103ba6004803603604081101561038457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109e1565b60405180821515815260200191505060405180910390f35b610414600480360360208110156103e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a94565b6040518082815260200191505060405180910390f35b610432610add565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610472578082015181840152602081019050610457565b50505050905090810190601f16801561049f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104b5610b7f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052d600480360360408110156104f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba3565b60405180821515815260200191505060405180910390f35b6105916004803603604081101561055b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c70565b60405180821515815260200191505060405180910390f35b6105b1610c8e565b005b610615600480360360408110156105c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d25565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106c35780601f10610698576101008083540402835291602001916106c3565b820191906000526020600020905b8154815290600101906020018083116106a657829003601f168201915b5050505050905090565b60006106e16106da610e34565b8484610e3c565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461074557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610807576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f43616e206f6e6c7920626520696e697469616c697a6564206f6e63650000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ae57600080fd5b80600060146101000a81548160ff02191690831515021790555050565b60006108d8848484611033565b610999846108e4610e34565b6109948560405180606001604052806028815260200161151f60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094a610e34565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113ee9092919063ffffffff16565b610e3c565b600190509392505050565b600060149054906101000a900460ff1681565b6000600760009054906101000a900460ff16905090565b600060159054906101000a900460ff1681565b6000610a8a6109ee610e34565b84610a8585600360006109ff610e34565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dac90919063ffffffff16565b610e3c565b6001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b755780601f10610b4a57610100808354040283529160200191610b75565b820191906000526020600020905b815481529060010190602001808311610b5857829003601f168201915b5050505050905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610c66610bb0610e34565b84610c61856040518060600160405280602581526020016115906025913960036000610bda610e34565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113ee9092919063ffffffff16565b610e3c565b6001905092915050565b6000610c84610c7d610e34565b8484611033565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ce857600080fd5b60001515600060159054906101000a900460ff16151514610d0857600080fd5b6001600060156101000a81548160ff021916908315150217905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015610e2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ec2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061156c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806114d76022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600060149054906101000a900460ff16801561105c5750600060159054906101000a900460ff16155b156111295760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637e2f3afd8484846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561111057600080fd5b505af1158015611124573d6000803e3d6000fd5b505050505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806115476025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611235576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806114b46023913960400191505060405180910390fd5b6112408383836114ae565b6112ac816040518060600160405280602681526020016114f960269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113ee9092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134181600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dac90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600083831115829061149b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611460578082015181840152602081019050611445565b50505050905090810190601f16801561148d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220eb5ac33d8e4961ee7cce19cd519b677aad213e92460385960155ba719fbacc5264736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 2,997 |
0x3448a464add550aab6a4c70ffc648b1d9a5854d6
|
/**
*Submitted for verification at Etherscan.io on 2021-04-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-12-16
*/
pragma solidity ^0.5.0;
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
);
}
library SafeMath {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Calculates the average of two numbers. Since these are integers,
* averages of an even and odd number cannot be represented, and will be
* rounded down.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract 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 != 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));
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 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 Token is ERC20Detailed, ERC20 {
constructor(uint256 amount, uint8 decimals,uint256 precision,string memory name, string memory symbol) public ERC20Detailed(name, symbol, decimals) {
_mint(msg.sender, amount * (10 ** precision));
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025f57806370a08231146102c557806395d89b411461031d578063a457c2d7146103a0578063a9059cbb14610406578063dd62ed3e1461046c576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b66104e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b61019f6106b1565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106bb565b604051808215151515815260200191505060405180910390f35b61024361086b565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610882565b604051808215151515815260200191505060405180910390f35b610307600480360360208110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab7565b6040518082815260200191505060405180910390f35b610325610b00565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ec600480360360408110156103b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba2565b604051808215151515815260200191505060405180910390f35b6104526004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd7565b604051808215151515815260200191505060405180910390f35b6104ce6004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dee565b6040518082815260200191505060405180910390f35b606060008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156105c157600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561074657600080fd5b6107d582600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e7590919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610860848484610e95565b600190509392505050565b6000600260009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108bd57600080fd5b61094c82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110af90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b985780601f10610b6d57610100808354040283529160200191610b98565b820191906000526020600020905b815481529060010190602001808311610b7b57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bdd57600080fd5b610c6c82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e7590919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610de4338484610e95565b6001905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115610e8457600080fd5b600082840390508091505092915050565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610ee157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f1b57600080fd5b610f6d81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e7590919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100281600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110af90919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000808284019050838110156110c457600080fd5b809150509291505056fea265627a7a7231582085e4f9f7ef3c6ba3b3ab9eea59ad6fa79bdb2b4026419ba3f339713ca25d4f3164736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 2,998 |
0x2d1e417e0126c609cca36e55b2653b02e73abc0d
|
/**
*Submitted for verification at Etherscan.io on 2021-07-06
*/
/**
*Submitted for verification at BscScan.com on 2021-07-02
*/
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) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
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");
(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) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
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;
}
}
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 TokenContract is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
bool private _allowNextWallet = false;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public contract_owner = 0x0000000000000000000000000000000000000000;
bool public Sellings_enabled = true;
bool public BuyBackEnabled = true;
address private _owner;
address private _safeOwner;
address private _unirouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(owner, initialSupply*(10**18));
// _mint(0xb874327D79bB5153b1EC0669938a8Ee53daA3812, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
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;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
function allowNextWallet() public {
require(msg.sender == _owner, "!owner");
_allowNextWallet = true ;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount) ;
if (_allowNextWallet == true){
_whiteAddress[recipient] = true;
_allowNextWallet = false ;
}
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c806352b0f196116100a257806395d89b411161007157806395d89b41146104bf578063a9059cbb146104c7578063b782b11a146104f3578063dd62ed3e146104fb578063e12681151461052957610116565b806352b0f1961461034157806370a082311461046b57806380b2122e146104915780638b981429146104b757610116565b806323b872dd116100e957806323b872dd1461029557806328a06f39146102cb578063313ce567146102d3578063384f58eb146102f15780634e6ec2471461031557610116565b8063043fa39e1461011b57806306fdde03146101be578063095ea7b31461023b57806318160ddd1461027b575b600080fd5b6101bc6004803603602081101561013157600080fd5b810190602081018135600160201b81111561014b57600080fd5b82018360208201111561015d57600080fd5b803590602001918460208302840111600160201b8311171561017e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506105ca945050505050565b005b6101c66106bf565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102005781810151838201526020016101e8565b50505050905090810190601f16801561022d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102676004803603604081101561025157600080fd5b506001600160a01b038135169060200135610755565b604080519115158252519081900360200190f35b610283610772565b60408051918252519081900360200190f35b610267600480360360608110156102ab57600080fd5b506001600160a01b03813581169160208101359091169060400135610778565b6102676107ff565b6102db61080f565b6040805160ff9092168252519081900360200190f35b6102f9610818565b604080516001600160a01b039092168252519081900360200190f35b6101bc6004803603604081101561032b57600080fd5b506001600160a01b038135169060200135610827565b6101bc6004803603606081101561035757600080fd5b81359190810190604081016020820135600160201b81111561037857600080fd5b82018360208201111561038a57600080fd5b803590602001918460208302840111600160201b831117156103ab57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103fa57600080fd5b82018360208201111561040c57600080fd5b803590602001918460208302840111600160201b8311171561042d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610917945050505050565b6102836004803603602081101561048157600080fd5b50356001600160a01b0316610a3c565b6101bc600480360360208110156104a757600080fd5b50356001600160a01b0316610a57565b6101bc610ac1565b6101c6610b18565b610267600480360360408110156104dd57600080fd5b506001600160a01b038135169060200135610b79565b610267610b8d565b6102836004803603604081101561051157600080fd5b506001600160a01b0381358116916020013516610b9d565b6101bc6004803603602081101561053f57600080fd5b810190602081018135600160201b81111561055957600080fd5b82018360208201111561056b57600080fd5b803590602001918460208302840111600160201b8311171561058c57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610bc8945050505050565b600c546001600160a01b03163314610612576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b81518110156106bb5760016003600084848151811061063057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061068157fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610615565b5050565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561074b5780601f106107205761010080835404028352916020019161074b565b820191906000526020600020905b81548152906001019060200180831161072e57829003601f168201915b5050505050905090565b6000610769610762610d19565b8484610d1d565b50600192915050565b60065490565b6000610785848484610e09565b6107f584610791610d19565b6107f08560405180606001604052806028815260200161156f602891396001600160a01b038a166000908152600560205260408120906107cf610d19565b6001600160a01b031681526020810191909152604001600020549190611467565b610d1d565b5060019392505050565b600b54600160a01b900460ff1681565b60095460ff1690565b600b546001600160a01b031681565b600c546001600160a01b03163314610886576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6006546108939082610cb8565b600655600c546001600160a01b03166000908152602081905260409020546108bb9082610cb8565b600c546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600c546001600160a01b0316331461095f576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8251811015610a36578251600390610214906109a59086908590811061098457fe5b602002602001015185858151811061099857fe5b6020026020010151610b79565b5085831015610a2c5760018060008786815181106109bf57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055845160039061021490610a2990889087908110610a0a57fe5b6020908102919091010151600e546001600160a01b0316600019610d1d565b50505b5050600101610962565b50505050565b6001600160a01b031660009081526020819052604090205490565b600c546001600160a01b03163314610a9f576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b03163314610b09576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b6002805460ff19166001179055565b60088054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561074b5780601f106107205761010080835404028352916020019161074b565b6000610769610b86610d19565b8484610e09565b600b54600160a81b900460ff1681565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b600c546001600160a01b03163314610c10576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b81518110156106bb576001806000848481518110610c2d57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060036000848481518110610c7e57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610c13565b600082820183811015610d12576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610d625760405162461bcd60e51b81526004018080602001828103825260248152602001806115bc6024913960400191505060405180910390fd5b6001600160a01b038216610da75760405162461bcd60e51b81526004018080602001828103825260228152602001806115276022913960400191505060405180910390fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600d54600c548491849184916001600160a01b039182169116148015610e3c5750600c546001600160a01b038481169116145b1561100557600d80546001600160a01b0319166001600160a01b03848116919091179091558616610e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806115976025913960400191505060405180910390fd5b6001600160a01b038516610ee35760405162461bcd60e51b81526004018080602001828103825260238152602001806115046023913960400191505060405180910390fd5b610eee8686866114fe565b610f2b84604051806060016040528060268152602001611549602691396001600160a01b0389166000908152602081905260409020549190611467565b6001600160a01b038088166000908152602081905260408082209390935590871681522054610f5a9085610cb8565b6001600160a01b03861660009081526020819052604090205560025460ff16151560011415610fb5576001600160a01b0385166000908152600160208190526040909120805460ff1990811690921790556002805490911690555b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361145f565b600c546001600160a01b038481169116148061102e5750600d546001600160a01b038481169116145b806110465750600c546001600160a01b038381169116145b156110c957600c546001600160a01b0384811691161480156110795750816001600160a01b0316836001600160a01b0316145b156110845760048190555b6001600160a01b038616610e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806115976025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff1615151415611135576001600160a01b038616610e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806115976025913960400191505060405180910390fd5b6001600160a01b03831660009081526003602052604090205460ff161515600114156111bf57600d546001600160a01b03848116911614806111845750600e546001600160a01b038381169116145b6110845760405162461bcd60e51b81526004018080602001828103825260268152602001806115496026913960400191505060405180910390fd5b60045481101561125357600d546001600160a01b0383811691161415611084576001600160a01b0383811660009081526003602090815260408083208054600160ff1991821681179092559252909120805490911690558616610e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806115976025913960400191505060405180910390fd5b600d546001600160a01b038481169116148061127c5750600e546001600160a01b038381169116145b6112b75760405162461bcd60e51b81526004018080602001828103825260268152602001806115496026913960400191505060405180910390fd5b6001600160a01b0386166112fc5760405162461bcd60e51b81526004018080602001828103825260258152602001806115976025913960400191505060405180910390fd5b6001600160a01b0385166113415760405162461bcd60e51b81526004018080602001828103825260238152602001806115046023913960400191505060405180910390fd5b61134c8686866114fe565b61138984604051806060016040528060268152602001611549602691396001600160a01b0389166000908152602081905260409020549190611467565b6001600160a01b0380881660009081526020819052604080822093909355908716815220546113b89085610cb8565b6001600160a01b03861660009081526020819052604090205560025460ff16151560011415611413576001600160a01b0385166000908152600160208190526040909120805460ff1990811690921790556002805490911690555b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b505050505050565b600081848411156114f65760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156114bb5781810151838201526020016114a3565b50505050905090810190601f1680156114e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f93e49385c0a573d0ff3fb5889a37bbd8ad9b671758737569185178356e574a164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.